#fdc8cd4cff2c19e0d1022e78481ddf36
1 messages ยท Page 1 of 1 (latest)
this is how it looks from stripe dashboard, no default payment method
However in the detail of customer:
You need to explicitly set the default payment method: https://stripe.com/docs/api/subscriptions/create#create_subscription-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.
Whats the proper way to retrieve it off the customer then?
As per docs, I can retrieve the list of his payment methods https://stripe.com/docs/api/payment_methods/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Do I just pick a random one of those? I suppose there is a better way to do it ๐
Well that's up to you and your integration. I recommend giving your customer the choice to select the one they want to use
Well the flow I got advised is to create a checkout session with initial payment + after such payment create a subscription with trial till the first day of month after next month (without user's choice)
Since the user already chosen this path beforee...
Well you can use the payment method from their checkout session then
Is there any ttl of such session?
What do you mean?
I am trying to get the payment method id from session as you said, however it seems like its not there. Do I have to wait for it? If so, how long?
"livemode": false,
"locale": null,
"metadata": {},
"mode": "payment",
"object": "checkout.session",
"payment_intent": "pi_xxx",
"payment_link": null,
"payment_method_collection": "always",
"payment_method_options": {},
"payment_method_types": [
"card",
"link"
],
"payment_status": "paid",
This is what I am receiving from such checkout session. There is no payment method id I can reuse, only payment intent id, which throws this:
No such PaymentMethod: 'pi_xxx'
(redacted)
You'll need to get it off the associated payment intent
No such PaymentMethod: 'pi_xxx'
That's because you're trying to retrieve the payment intent as if it were a payment method but it's not
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
And the payment method will be on that object
Alright ๐ What happens if such payment method expires / is removed by user?
- I assume such checkout session should be only used for those 2 actions and not reused in the future?
Does user receive any email / can update his subscription payment method or does such subscription just expire?
If payment method is removed by the user you will have to collect another one. There's not a way around that. Checkout sessions aren't reusable. The payment method created is though because you passed setup_future_usage: off_session.
Does user receive any email / can update his subscription payment method or does such subscription just expire?
What do you mean?
I was thinking maybe his card will expire in few days while he has it attached to the subscription. Will the user receive any notification from Stripe - maybe offering to update his payment method?
Or the payment will just fail -> subscription will expire?
You need to configure that in your settings here: https://dashboard.stripe.com/settings/billing/automatic
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Under prevent failed payments
Alright ๐ I will implement the information gained during today and get in touch tomorrow if there is anything else. Thanks for your help!