#Koki Yamaguchi
1 messages · Page 1 of 1 (latest)
hello! can you share more on what's the issue you're facing?
I believe these are the two questions that you have?
want to use confirmPayment method implemented on stripe library, because, to our understanding, this resolves authentications (like 3D Secure) for us on frontend when it is required
want to use invoices that have information about the purchased prices (so that we can know and record the detail of the purchase easily), which we think is feasible by adding prices as invoice items to invoices.
you may want to take a look at these guides : https://stripe.com/docs/invoicing
How can I create and confirm a payment intent for a specific existing invoice?
if you send the invoice (i.e. hosted invoice page) to the customer to pay, you don't need to run confirmPayment, Stripe will automatically handle it : https://stripe.com/docs/invoicing/hosted-invoice-page
but if you don't want to use the hosted invoice page to collect payment - when the invoice is finalized, there will be a PaymentIntent generated - https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent. You can use that PaymentIntent's client secret to initialize the Payment Element and collect payment : https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
but if you don't want to use the hosted invoice page to collect payment - when the invoice is finalized, there will be a PaymentIntent generated
in this case, do I finalize the invoice via API manually?
it's up to you, you can set the invoice to finalize automatically by setting auto_advance=true [0] or you can manually do it as well [1]. I'd suggest going through https://stripe.com/docs/invoicing/integration/automatic-advancement-collection
[0] https://stripe.com/docs/api/invoices/create#create_invoice-auto_advance
[1] https://stripe.com/docs/api/invoices/finalize
I'd like to charge the customer immediately. This automatic invoice advancement doesn't happen immediately after invoice's creation, does it? But even if it does, then it seems that I can't add invoice items to the invoice because it is finalized.
But anyway, "creating invoice, adding invoice items to it, finalizing it, fetching generated payment intent, and confirming it" sounds good at the moment and I'll try it first.
When the automatic advancment is enabled, the invoice will be finalised after one hour from its creation. With this, you will be able to add invoice items within the one-hour draft period before the invoice is finalised automatically.
Alternatively, you can use "creating invoice, adding invoice items to it, finalizing it, fetching generated payment intent, and confirming it" for manual finalisation.
Thank you. I appreciate it.
No problem! Happy to help 😄