#afonso
1 messages · Page 1 of 1 (latest)
After the invoice is finalised, the information can't be changed. Any update on the customer will be reflected in the next invoice.
So I have to re render the payment element right?
Right now I’m creating an invoice behind the scenes and extracting the payment intent so I can render the payment element on the client side
Yup! Re-render Payment Element with new Payment Intent client secret will be required.
Alternatively, you can prompt customer to check for the billing details first, then create invoice and show Payment Element later
Right, that sucks.
In the stripe's native checkout you get to do it all at once, no re-render is needed.
What I thought about doing also, is creating the invoice after payment
Using
There are two types of billing details here. For updating billing details on the payment method, it can be done anytime regardless whether the invoice is finalised. For billing details update on the customer, then it will only be reflected in the next invoice.
In the stripe's native checkout you get to do it all at once, no re-render is needed.
Which native checkout are you referring to? Is it Checkout Session?
Yes
The problem here really is with the invoice
We need the invoice to have correct billing details
So I think for us not to change the whole flow, we'll generate the invoice afterwards
with this flag paid out of band
what do you think?
I see! For Checkout Session, it will only create invoice/payment receipt after payment method is collected.
Another alternative I can think of is to:
- Use Setup Intent to collect payment method: https://stripe.com/docs/payments/save-and-reuse
- Update customer details whenever necessary
- Create invoice and set the default_payment_method collected in Step 1: https://stripe.com/docs/api/invoices/create#create_invoice-default_payment_method
How does it create invoice only after that?
Without using that flag?
When you render the Payment Element, it uses Setup Intent client secret that is not associated with invoice to collect payment method only. After the payment method is collected, it will generate a payment method ID (pm_xxx). With this payment method ID, you can then create the invoice after updating the customer details
Oh that makes sense
Is it smart enough not to charge again?
How do you mark it as paid?
The invoice will attempt to charge automatically from this payment method ID after it's finalised
Only one invoice is created, so it won't be charge again
Setup Intent is for payment method collection only and it doesn't charge to customer
Checkout Session works similarly
No problem! Happy to help 😄
How do I specify the payment method when creating the invoice?
You may set default_payment_method when creating the invoice: https://stripe.com/docs/api/invoices/create#create_invoice-default_payment_method
Got it, and when I finalize it's going to be paid?
Or do I need to explicitly pay
Maybe that's auto_advance.
Hello?
Thanks for waiting! Discord is busy now
If auto_advance is set to true, the invoice will attempt to charge to the default payment method. You may refer to the details here: https://stripe.com/docs/invoicing/integration/automatic-advancement-collection
right I understand, your support is great I really appreciate it.