#Nadiya-subscriptions

1 messages ยท Page 1 of 1 (latest)

void bronze
#

you can add multiple products to a subscription which would generate a single invoice and hence PaymentIntent

torn jewel
#

so, for different billing cycle, is it possible to achieve with a single purchase button?

#

i saw this, but is it achievable with single card element - button?

#

i was using the paymentIntent and confirmPayment for single product purchase

tall crag
#

Hi @torn jewel I'll take over this thread ๐Ÿ™‚

#

You can only associate one subscription in a Checkout Session. So I'd suggest you to create another Checkout Session to manage the other subscription so that you have the flexibility with a different billing cycle.

torn jewel
#

sorry, then what's the above Screenshot is about?

#

"Multiple subscriptions for a customer"

tall crag
#

This is an example of creating multiple subscriptions, which is not directly related to Stripe Checkout.

Technically Stripe Checkout in subscription mode is just a shortcut for you to create a Subscription + Payment in one flow. If you want to minimize the user actions involved for creating two subscriptions. I've another proposal for you to consider.

  1. Use Checkout setup mode to create a SetupIntent for a customer, once the SetupIntent is completed and the Payment Method is confirmed (you can listen to the webhook event setup_intent.succeeded), set this payment method to the customer's invoice_settings.default_payment_method (https://stripe.com/docs/api/customers/create#create_customer-invoice_settings-default_payment_method) -> The payment method that the customer setup through this Checkout Session can be reused in the subsequent subscriptions.
  2. Call the Subscription creation API (as shown in the screenshot) to create multiple subscriptions for the user.
torn jewel
#

i'm not using stripe checkout

tall crag
#

You can use Payment Element with SetupIntent as well.

#

So you just need to replace the Checkout with Payment Element in Step 1.

torn jewel
#

sorry, can you please elaborate 2?
i can't use webhook either for some reason

#

oh was it the continuation of step 1? i thought it was another option

tall crag
#

Let me rephrase

#
  1. Create a SetupIntent from your backend, and pass the clientSecret to your front-end, and use your existing card element to confirm the setupIntent
  2. Call the Subscription creation API (as shown in the screenshot) to create multiple subscriptions for the user.

You might want to set the payment method as customer's default payment method in the success callback upon SetupIntent confirmation
in the frontend. However, there's always a possibility that the frontend code might miss the callback (i.e., network issues). I'd strongly recommend you to use webhook to listen to setup_intent.succeeded event, and set this payment method to the customer's invoice_settings.default_payment_method in the webhook event handling.

torn jewel
#

i see.. understood. Thank you so much for the detailed instruction