#Bruno777
1 messages · Page 1 of 1 (latest)
Hi there!
How did you accept the first payment? Checkout Session, PaymentIntent, something else?
So you need to set setup_future_usage when creating the PaymentIntent: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
This way you can re-use the PaymentMethod and charge the customer later by creating a new PaymentIntent with the same PaymentMethod.
Ok thanks
You can see an example of this here: https://stripe.com/docs/payments/save-and-reuse?platform=web#charge-saved-payment-method
const paymentIntent = await stripe.paymentIntents.create({
amount: 1099,
currency: 'eur',
customer: '{{CUSTOMER_ID}}',
payment_method: '{{PAYMENT_METHOD_ID}}',
off_session: true,
confirm: true,
});
And for subscriptions in PaymentIntent you advise me to indicate which method ?
What do you mean? If you are creating subscriptions, then the next payments will be managed by Stripe automatically
I don't want to manage payments with webhooks... I prefer to do it how I want on my end.
To make a payment like that yourself, you can make a call like in this step of this guide
https://stripe.com/docs/payments/save-and-reuse?platform=web#charge-saved-payment-method
For that first payment, are you confirming the payment intent client side or server side? Webhooks are highly recommended if you are confirming payment intents client side, otherwise it is possible to charge a user but not get the message that their payment succeeded
In your example to indicate that you have to specify {{PAYMENT_METHOD_ID}}
How do I retrieve this {{PAYMENT_METHOD_ID}}?
That is the ID of the payment method from steps 1-6 in that guide. You can save and retrieve it however you would like. One thing you can do is save the payment method's ID in your customer's invoice_settings.default_payment_method field which is the field Stripe uses to charge for subscriptions https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
This link is failed : https://site-admin.stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Whoops, fixed it: https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.