#corwindev
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- corwindev, 2 hours ago, 15 messages
So after the webhook event checkout.session.completed is called i'm doing this:
$paymentMethod = $client->setupIntents->retrieve(
$setupIntent->setup_intent,
[]
)->payment_method;
// Attach the payment method to the customer
$client->paymentMethods->attach(
$paymentMethod,
['customer' => $user]
);
$client->subscriptions->create([
'customer' => $user,
'items' => $items,
'default_payment_method' => $paymentMethod,
]);
$items being a list of products
But then it throws PaymentMethods of type 'ideal' cannot be saved to customers.
Could you please share the Request ID req_xxx? https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_4HZAcyeXt71klO
How are you creating this Payment Method? With SetupIntents?
Checkout session with mode as setup
The PaymentMethod in question was created somewhere else, with a POST /v1/payment_methods method.
Yeah linking it to a customer because otherwise i get: the customer does not have a payment method with the ID pm_1ODRu3Ae4mynQ6gLTtUdVGk8.
No, I am asking how this particular Payment Method was created. There's something on your frontend that called POST /v1/payment_methods that created the Ideal Payment Method that was used in the request that failed.
I didn't create it
I'm getting redirected to checkout session
That checkout session creates it
Hi there ๐ jumping in as my teammate needs to step away, please bear with me a moment while I catch up on the context here.
It sounds like you're discussing using a Checkout Session in setup mode to set up a payment method, then use that to create a Subscription. Out of curiosity, is there a reason you aren't using Checkout Sessions with a mode of subscription so they collect payment method details, attach that to the customer, and create a subscription simultaneously?
Because i need to use different intervals (monthly, etc)
Ah, gotcha, so you're creating multiple Subscriptions with different frequencies for a single customer. Alright, let me take a closer look here.
If there is a better way to do this, let me know please ๐
Sorry, I'm confused, the Payment Method you referenced wasn't created by a Checkout Session:
https://admin.corp.stripe.com/request-log/req_HARI2pSu3dntOT
so I'm not grasping yet how this relates to a checkout.session.completed Event.
Okay lets start over then xD
How do i make a subscription with multiple intervals?
You can't, that's not possible. A subscription can only contain Prices which have a common billing frequency.
You will need to create a separate Subscription for the Customer, for each billing frequency they subscribe to. If you have multiple Prices that all charge monthly, those can be included in a single Subscription, but Prices that bill annually cannot be combined with Prices that bill monthly.
Additionally, going back through your conversation again, I see you mention iDEAL payments in particular. iDEAL Payment Methods cannot directly be used for Subscriptions or recurring payments, so they don't support being set up for reuse. Instead you have to use iDEAL to set up a SEPA payment method. Our flows for doing that can be found here:
https://stripe.com/docs/payments/ideal/set-up-payment
Why is it there then?
Is that a Checkout Session in setup mode? If so it's present there because you're going down the first flow shown in the doc that I referenced.
Checkout Sessions in setup mode already attach Payment Methods to Customers, you don't need to run the code you shared above to attach a Payment Method upon Checkout Session completion.