#pro-pooja_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1268549000458534954
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Yes, you'll need to update default_payment_method on the Subscription manually with the new pm_xxx from Checkout
Really though you should just use the customer portal to allow customers to update their payment methods
Customer is filling the card details , we are just creating the link via coding.
Is there any workaround to achieve that in single api request, when we are creating a checkout session link via api
Via api call?
$this->stripe->checkout->sessions->create([
'payment_method_types' => ['card'],
'billing_address_collection' => 'required',
'success_url' => {{$url}},
'mode' => 'setup',
'setup_intent_data' => [
'metadata' => [
'customer_id' => $stripeId,
'subscription_id' => $subscriptionId,
],
],
'metadata' => ['is_new_plan' => $isNewPlan],
'cancel_url' => {{$url}},
'customer' => $stripeId,
]);
In Php above is the code, we are using mode = 'setup' not actually charging user, only asking for their payment details. I can't find the docs referring this scenario. In there any provision in above code to attach subscription with default payment method
I already explained this to you, no: Checkout won't automatically update the subscription(s) with the new payment details
If you want to use Checkout, then you'll need to make a subsequent API request to update the subscription with those details
Otherwise, you can use the customer portal where the user can opt to set the new card as the default and it'll update their subscription(s) automatically
Can you help me understand defaulting the payment method scenario,
There are two ways we can make the card default
- Attach to customer
- Attach to Subscription
In my understanding, Card details filled while checkout is the default subscription payment method.
๐ stepping in as ynnoj needs to step away
If you create a Subscription using Stripe Checkout then yes, that PaymentMethod will be set as the default_payment_method on the Subscription
But to update that default payment method you should send your customer to the Customer Portal as my colleague said above
If I use this
'mode' = 'setup', when creating a stripe checkout link, shouldn't it set the payment details filled by the customer a default_payment_method?
No
Can you please give a little explanation about this scenarion, what exactly happens on the stripe side in this case with payment detail
If you use mode: setup?
Yes
It creates a PaymentMethod and attaches it to the Customer