#Aubreywodonga
1 messages · Page 1 of 1 (latest)
Hi, yes PaymentIntent API doesn't support Tax, and using Invoice with Tax Rate is correct approach.
To generate Invoice and charge immediately, yes you need to have a payment method, already collected, on this specific customer
Thanks for your quick response!
So in that case if we wanted to charge a different payment method we would first have to collect that and set it as the default payment method before generating the new invoice? Would that then theoretically affect other existing subscriptions that are set to use the default payment method?
Alternatively, since creating an invoice creates a payment intent after it is finalized, would it be possible to create the invoice, finalize it, and then return the client secret from the payment intent to the frontend to pass into an elements component and pay from there?
For the first part. you can pay an Invoice by a non-default payment method, when you call the Pay Invoice API and explicitly specify the payment_method parameter. This is the Payment Method you can collect beforehand, using SetupIntent for example.
Using the default would affect Subscriptions, yes, because Subscription has a chain of precedences (Sub's default_payment_method -> Sub's default_source -> Customer's default_payment_method -> Customer's default_source)
For the later part, yeah theoretically it could work (please test it out in Test mode) but I am not sure if the Invoice will automatically change its status upon the confirmation by elements. I know Subscription will, but this is one-off Invoice
Thank you this is very helpful!
So to clarify, to use the pay invoice api I would have to:
- Collect and set up new payment method using setup intents api
- Generate (and finalize?) the invoice
- Call the pay invoice api passing in the previously set up payment method
Is that correct?
Yep! (Please test it thourously in Test mode)
You can absolutely trust that I'll be doing a lot of that! 😁 Thanks @solemn lotus, after so long pouring through docs you've been a big help!
Oh actually one last follow up question (sorry) but for collecting and setting up new payment methods is it possible to do that using the elements component or something similar? Or would I need to just manually collect all of the details and set it up using the api on my server?
No you should collect via Elements or any UI provided by Stripe, that way you can avoid the PCI CSS requirements
(to not have card info exposed to any of your server/client code)
That makes sense. So when it comes to generating a client secret for the Elements component does that come from the stripe.setupIntents.create? I've only pulled client secrets from payment intents before so just want to be sure
SetupIntent does generate a client_secret. They are similar
Here for the flow https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#retrieve-the-client-secret
Fab, thank you for confirming and thanks again for all of your help! You're a legend!