#pro-pooja_api

1 messages ยท Page 1 of 1 (latest)

proven kilnBOT
#

๐Ÿ‘‹ 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.

pallid kiln
#

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

frozen pike
#

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

pallid kiln
#

Not with Checkout no

#

But the customer portal supports that

frozen pike
#

Via api call?

pallid kiln
proven kilnBOT
frozen pike
#

$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

pallid kiln
#

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

frozen pike
#

Can you help me understand defaulting the payment method scenario,
There are two ways we can make the card default

  1. Attach to customer
  2. Attach to Subscription
    In my understanding, Card details filled while checkout is the default subscription payment method.
crystal pivot
#

๐Ÿ‘‹ 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

frozen pike
#

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?

crystal pivot
#

No

frozen pike
#

Can you please give a little explanation about this scenarion, what exactly happens on the stripe side in this case with payment detail

crystal pivot
#

If you use mode: setup?

frozen pike
#

Yes

crystal pivot
#

It creates a PaymentMethod and attaches it to the Customer