#abishek-checkout-subs
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.
No, that's not something Checkout supports today
we have a cart functionality where a parent can subscribe to a plan for 2 of their kids. We currently allow our customers to use the Customer Portal to manage their plans. If they want to unsubscribe one of their kids, it is currently not possible, unless we create 2 separate subscriptions
does it make sense. They can only cancel the whole subscription and not just one
Gotcha.. The other option would be that you just collect the payment method using the checkout session and then use Subscriptions API directly to create separate subscriptions when the customer wants to checkout from the cart.
Stripe Checkout won't be able to create multiple subscriptions unfortunately.
how would that work? will the checkout session show the final amount to be charged?
No, you'd need to handle that on the cart page. Checkout page will only collect the payment method details (setup mode)
https://docs.stripe.com/payments/save-and-reuse
ok, thank you. i think in this case, the embedded-form would be the ideal way to do from a UX perspective. Does the embedded-form support all the features of Stripe Checkout ? Like Link, enabled Payment methods and other terms and conditions info?
yup as far as I know, it should all be supported
https://docs.stripe.com/content/payments/accept-a-payment/web/compare-integrations
thank you
a bit confused. I am going through the docs. if I am using the embedded form or hosted checkout to only setup the payment method, the customer gets redirected to the return url, so am not sure what to do next.
how do I add the items to the checkout
Thinking... maybe return URL could be the same URL as the cart page? but since the customer already provided their payment method details, you could hide the embedded checkout form..
For setup mode checkouts, you don't need to add items
https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=embedded-checkout
it only collects the payment method details.
remember, you'd create the subscriptions separately by calling the API
ok, the reason I ask is because, we have a cart functionality, that may include a couple of one-time items and a couple of membership items in one go. So if the customer adds all the items to the cart and clicks checkout, we launch the embed form and get the payment info as we discussed above. Once they complete adding the payment info, I am assuming, stripe will automatically redirect to the return URL (which would be our intermediate page).
Now I need to get the payment method as shown here (https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=embedded-checkout) and using that payment method we can create multiple subscriptions using the API, but how do we go about purchasing the one-time items?
Let me know if it makes sense
Ah okay, so mix carts makes it more complicated
thats why we went with Stripe Checkout, but the subscription getting grouped complicated things
I don't think checkout would be a good fit for your usecase if you need subscriptions to be separate
can you advice how I can do it using the above scenario I discussed without Stripe Checkout
The only way I can think of is to use the PaymentIntents API (for one-time payments) + Subscriptions API (for recurring payments) + Stripe Elements (to collect payment method details)
Alternatively, you could build your own UI to handle subscription updates rather than using Customer Portal
ok, at this point building our own UI to handle subscription updates is easier, since we have done all our checkout functionality
i have one other question, this is after I saw the UI of customer portal
sure
abishek-checkout-subs
Actually a couple of questions. The screenshot is from the Customer Portal.
- Each subscription has an edit payment method functionality. Will updating one update the others also?
- When I click on the edit payment info button as shown on the screenshot, the URL seems to be specific to the subscriptions payment method and not the payment method in general. How does that work?
I think it depends on how you create the subscription.
by default we'd use customer's default payment method under customer.invoice_settings.default_payment_method
but if you want to individually assign payment methods to subscription then you can pass the payment method to subscription's default_payment_method parameter
https://docs.stripe.com/api/subscriptions/create#create_subscription-default_payment_method
That sets the payment method on the subscription (and doesnt' use customer's default payment method from invoice_settings)
^that also allows you to use a payment method that's attached to a customer (but isn't default)
i am going to use the Stripe Checkout
๐ Stepping in for my teammate! Give me a minute to catch up
sure
If you use Checkout for Subscriptions, we'll automatically create a Customer object and attach the PaymentMethod to the customer. We'll also set that PaymentMethod as the value for the Subscription's default_payment_method
If you want to use that PaymentMethod for any future Subscriptions for this Customer, you'll need to update the Customer to set the value of invoice_settings.default_payment_method
if the Stripe Checkout has multiple items, 2 subscriptions and 2 one-off items, will the payment method be available on the checkout session object?
since there will be only one payment method for all these items together
If this Customer uses the Portal, they will see the PaymentMethod they saved during Checkout as one of their available PaymentMethods. They can make this their default PaymentMethod, which will set their invoice_settings.default_payment_method
I cannot use the Customer Portal because it has a disadvantage I mentioned in the above conversation, so I have to build our own UI
if the Stripe Checkout has multiple items, 2 subscriptions and 2 one-off items
Not sure I follow this, as a single Checkout Session with multiple recurring items will create a single Subscription
correct
so our site allows parents to create subscription for their kids, so assuming if a parent has 2 kids and they add 2 subscriptions to the checkout, then Checkout session combines them into a single subscription with 2 subscription items
currently the Customer Portal doesn't have the option to cancel one subscription item from the Subscription
Right, understood
you will have to cancel the whole subscription, which means it cancels both
that is why we have to build our own UI to manage subscription and orders
which is why I was asking questions regarding the payment method
I want to save the payment method info for the Checkout Session, so I can associate it to the total Order
You had me until:
I want to save the payment method info for the Checkout Session, so I can associate it to the total Order
As my teammate mentioned, you can't use a Checkout Session in subscription mode to create multiple Subscriptions with one Session
You can use a Checkout Session in setup mode if you simply want to collect payment details from a parent and then create their Subscriptions off session/separately
Or, as my teammate mentioned, you can work with the PaymentElement
I cannot use that because it complicates stuff more because our cart functionality supports adding both one-off and subscription items together. So as your previous team mate said I have to use the PaymentIntents API (for one-time payments) + Subscriptions API (for recurring payments) + Stripe Elements (to collect payment method details)
Since we have already completed all the checkout functionality, we were planning to use the Customer Portal, since we cannot use the Customer Portal, we are going to build that part
We use the checkout.session.completed webhook trigger
once the checkout is completed by the customer
we use that to get the cart info and create the order on our end since the payment was successful
Hold on a second. You mentioned you plan on using the PaymentElement instead of Checkout given the limitations with # of Subscriptions and the Portal.
now what we want to do is to get the payment method used for the checkout session on the webhook trigger, so we can store the pm_id and we can use that to allow the customer to update info our own UI
Since you plan on using the PaymentElement, you won't listen for checkout.session.completed since that event will no longer be emitted
that was a suggestion from your other team mate
I mentioned that that would be too much effort since the checkout functionality is already implemented
our cart functionality with Stripe Checkout is final
we are only going to build our own UI instead of the Customer Portal
does it make sense till now?
Okay, so you will continue to use Stripe Checkout even though that means parents can only create one Subscription per Session
correct, so on our end, we will provide the option to delete a subscription item and that should solve it
we need to build the functionality to update the payment information that was used for the subscription item which is where the other team mate transferred to you ๐
so, I was asking how I can get the payment method used from the checkout session.
You can look at the Subscription's default_payment_method as Checkout will automatically add the PM used during the Session here
can I use checkout_session.payment_intent.payment_method ? will that be the same ?
the reason, I am trying to look at the checkout session is because the session could have subscription and one-off items
i will have to loop through line items to figure out the subscription and then read the default_payment_method. Just trying to see if there is a property that is easier to approach
No, checkout_session.payment_intent is only populated for payment mode Checkout Sessions
else checkout_session.invoice.default_payment_method if it is subscription correct?
checkout.session.completed events for subscription mode Checkout Sessions will have invoice populated, yes. This means you'd have to make a separate get call to retrieve the invoice and expand invoice.payment_intent to get the payment method or you can listen for customer.subscription.updated events which should include default_payment_method
All good! I got a little mixed up after we started talking about the customer portal and what the different buttons/icons do
Thank you for understanding and being polite about it ๐ Appreciate your help and time once again
take care
you too!