#satujamsaja_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/1445165086736908288
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there ๐ did you set the Payment Method that was created from the Setup Intent as the customer's default payment method?
You can do that by updating invoice_settings.default_payment_method. Alternatively, you can provide the payment method as the default_payment_method when creating the Subscription, to only use that Payment Method as the default for that Subscription.
Is it when creating subscription? But payment_method was used for creating payment intent?
The Payment Intens for Subscriptions are created automatically. How do you think you passed the Payment Method to that? Can you share your code?
// Payment intent data.
$payment_intent_data = [
'amount' => $webform_data[$amount_charged] * 100,
'currency' => 'nzd',
'payment_method' => $payment_methods->data[0]->id,
'customer' => $customer->id,
'confirm' => true,
'off_session' => true,
'description' => $product_name,
];
Gotcha, thank you. You don't need to create your own Payment Intents for Subscriptions.
So whats the code for the subscription ?
Where do you want to set the default payment method. At the Customer object level, so it will be used for all Subscriptions, or at the Subscription level (which overrides the Customer level one)?
๐ Toby needs to run, I'll be taking over the thread, let me know if you have any questions after testing.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Thanks @stuck marlin
That's my curret setup when testing with 3d secure card number 4000 0000 0000 3220
My current flow
setupintent created ->
retrieve setupinent ->
creatr customer with payment method attached and invoice settings->
create payment_intent with customer data and payment methode ->
create subscription with customer data and price_id
As Toby mentioned there isn't any need to manually create the Payment Intent.
When you create the Subscription it's going to generate an Invoice, and depending on the collection method you specified during Subscription creation it's either going to send an invoice, or charge the user automatically (using either the PM saved on the customer, or the PM set on the Subscription during creation) In either case there is no need to manually create a Payment Intent.
https://docs.stripe.com/api/subscriptions/create#create_subscription-collection_method
I see so creating payment intent wasn't necessary? Attaching customer id to subscription will automatically charge customer with attached payment method?
Correct, so long as you set charge_automatically as the collection_method it will charge the default_payment_method on the customer
Got it, so it's not related to the use of 3d secure?
Typically, 3DS comes into play during the setup intent when, we request an exemption from the issuer for future payments. Those 3DS test cards are generally for use when the customer is on-session and available to handle the redirect the 3DS modal. (Ie when testing payment forms)
I'd suggest reviewing our documentation around Subscriptions to get a complete understanding of how the flow works.
https://docs.stripe.com/billing/subscriptions/build-subscriptions