#atanas
1 messages · Page 1 of 1 (latest)
hey!
I can't first get the PI's id to save
I'm not sure what that means exactly
the idea is you have in your Stripe account a Customer cus_xxx with a saved PaymentMethod pm_xxx( created during a previous Payment or Setup Intent). You then create a new PaymentIntent passing those two things, to charge the saved details.
So essentially in the guide linked below it says to create a PI with confirm: true, which will then charge the PI. This is a problem because I want to get the PI id and save it, before it gets charged.
https://stripe.com/docs/payments/ach-debit/set-up-payment?platform=web#web-future-payments
hmm ok. Not sure why you want to save the incomplete PI ID, but you can!
just omit confirm:true on creation of the PI and instead call the confirm endpoint (https://stripe.com/docs/api/payment_intents/confirm) separately after you save the returned ID.
Will this work for ACH?
Can you link the confirm method in the API docs?
yes and yes
So in the docs there I see that await stripe.paymentIntents.confirm is one option. Can a confirmation be done client-side? For example, how would you use stripe.confirmUsBankAccountPayment
it can be done client side yes. https://stripe.com/docs/js/payment_intents/confirm_us_bank_account_payment#stripe_confirm_us_bank_account_payment-attached_payment_method is the version of the call that just takes the client_secret of a PaymentIntent you previously created on the backend with a supplied customer/PM ID
One more question, can I create a PI without supplying the customer object or payment method info? I see that one of the versions of that functions passes in an existing Payment Method, Confirm an ACH Direct Debit paymentwith an existing PaymentMethod
Idea being, create a PI server-side, record the ID and then associate it to the correct customer at confirmation time client-side.
yes all of that works
all that matters is that at the time you confirm the PI, all the information is/has been provided. The default shown in the docs is that you process the payment on the server side (or e.g. processing some recurring payment on the saved details from a cron job or so on)
Excellent, thanks for all the help.