#Raene-paymentintents
1 messages · Page 1 of 1 (latest)
Thanks
"If it's a new payment method I attach it to the customer via the attach payment intent method. "
What do you mean by the attach payment intent method? Do you mean the "attach a payment method to a customer" call (see https://stripe.com/docs/api/payment_methods/attach) ? Alternatively, you could also pass in setup_future_usage and customer when you create the Payment Intent and it'll be automatically attached for you (https://stripe.com/docs/api/payment_intents/create#create_payment_intent-customer)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
"Also how do I attach multiple payment methods. Using the payment intent API. Do I just call the same method and it sorts that out?"
This wouldn't be with the Payment Intents API - you would attach them one at a time with this call: https://stripe.com/docs/api/payment_methods/attach
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
"Also how do I update a payment method. If say a user card expires"
This is something we can actually handle automatically on our end. Banks will let us know when cards expire and we'll automatically update them with the inforamtion they provide (see https://stripe.com/docs/saving-cards#automatic-card-updates)
const card = await stripe.paymentMethods.attach(
'{{PAYMENT_METHOD_ID}}',
{
customer: '{{CUSTOMER_ID}}',
}
);
This is the line of code in the docs
Gotcha - so that's the correct code, I just wouldn't call is the "attach payment intent" API. It's just attaching the Payment Method to the Customer, nothing to do with the intent
Oh. Nice really smooth
Oh okay thanks. Alot
Also. Setup future usage has on_session
On session means the user has to initiate the payment from the front end by themselves right?
While off_session is for situations like Subscriptions?
Yup! off_session would be for things like Subscriptions or invoices that you are charging for immediately (without the user being on sessino)
Okay. I think I get it. One last thing. Is there a card object that the front end can use to display to a user. You something like the last 4 digits. So the user can recognize the card they are selecting
Yup - you can check card.last4 on the Payment Method (https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-last4)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.