#jojilede
1 messages ยท Page 1 of 1 (latest)
๐ Hi there, Happy to help!
You can create/add an invoice item to an existing invoice
https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-invoice
You can follow this full guide in order to create an Invoice and then add Invoice Item to it:
https://stripe.com/docs/invoicing/integration/quickstart
I see, how does it work? Do I call stripe.create.invoice then stripe.create.invoice item?
or can I do them both?
you do each call separately, in the guide I shared above explains that step by step
Np!
can I ask one more thing?
My invoice is not charging automatically:
// Create an Invoice
const invoice = await stripe.invoices.create({
customer: req.body.customerId,
collection_method: 'charge_automatically',
auto_advance: true,
});
// Create an Invoice Item with the Price, and Customer you want to charge
const invoiceItem = await stripe.invoiceItems.create({
customer: req.body.customerId,
price: req.body.oneTimePriceId,
invoice: invoice.id,
metadata: {
initialQtyPaid: req.body.initialQtyPaid,
subscriptionPriceId: req.body.subscriptionPriceId,
lengthOfStaty: req.body.lengthOfStay,
nextInvoiceDate: req.body.nextInvoiceDate,
checkoutDate: req.body.checkoutDate,
}
});
};
Correct, you need to finalise it
oh!
like this?:
const invoice = await stripe.invoices.create({
customer: req.body.customerId,
collection_method: 'charge_automatically',
auto_advance: true,
});
// Create an Invoice Item with the Price, and Customer you want to charge
const invoiceItem = await stripe.invoiceItems.create({
customer: req.body.customerId,
price: req.body.oneTimePriceId,
invoice: invoice.id,
metadata: {
initialQtyPaid: req.body.initialQtyPaid,
subscriptionPriceId: req.body.subscriptionPriceId,
lengthOfStaty: req.body.lengthOfStay,
nextInvoiceDate: req.body.nextInvoiceDate,
checkoutDate: req.body.checkoutDate,
}
});
const finalize = await stripe.invoices.finalizeInvoice(invoice.id);
Yep
Depends, really. We can void/cancel them after X amount of failed payments if configured. Otherwise indefinitely until manually voided
In most cases, yes: https://stripe.com/docs/invoicing/integration/workflow-transitions#finalized
alright, thanks!
Hi may I know the timezone followed in stripe dashboard?
It'll be localised to your account/country timezone
so, the time being referenced is set to the timezone of the person who set it up?
It's set here: https://dashboard.stripe.com/settings/account
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I see.
here's my issue btw. I set a schedulesSubscription on Jun 1 and it's appearing as May 31 ๐
Can you share the sub_sched_xxx ID?
The API timestamps use UTC, so depending on the Dashboard setting it may show as a different date
sure let me share it
sub_sched_1MQqvqDTISXyBnp6HudAp8ms
it shows this:
but i want june 01 and july 01
So you set it to 1685577600 via the API (which is 2023-06-01 00:00:00 UTC). I guess your Dashboard timezone is behind UTC
yeah, how to make our dashboard in utc?
I sent you the link above
Kind of obvious from that screenshot, no? ๐
yeah I just think with my hand on that part coz I got tired today ahha sorry
all good