#corwindev

1 messages ยท Page 1 of 1 (latest)

faint bridgeBOT
#

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.

main jungle
#

Hi, let me help you with this.

#

Could you please share a bit more context?

twilit drum
#

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.

main jungle
main jungle
#

How are you creating this Payment Method? With SetupIntents?

twilit drum
main jungle
#

The PaymentMethod in question was created somewhere else, with a POST /v1/payment_methods method.

twilit drum
main jungle
#

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.

twilit drum
#

I didn't create it

#

I'm getting redirected to checkout session

#

That checkout session creates it

glass basalt
#

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?

twilit drum
glass basalt
#

Ah, gotcha, so you're creating multiple Subscriptions with different frequencies for a single customer. Alright, let me take a closer look here.

twilit drum
#

If there is a better way to do this, let me know please ๐Ÿ™‚

glass basalt
twilit drum
#

Okay lets start over then xD
How do i make a subscription with multiple intervals?

glass basalt
#

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

Learn how to save bank details from an iDEAL payment and charge your customers later with SEPA Direct Debit.

twilit drum
#

Why is it there then?

glass basalt
#

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.