#claudiuyoro_best-practices

1 messages ยท Page 1 of 1 (latest)

mossy nestBOT
#

๐Ÿ‘‹ 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/1350054035197136896

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

chrome onyxBOT
digital oxide
#

Hi there ๐Ÿ‘‹ it looks like you linked to our Checkout Sessions guide, so am I correct in understanding that you're planning to leverage Checkout Sessions for this flow?

knotty lintel
#

Hi!
Not necessarily with Checkout Sessions. I want to have a way in which I am able to create subscription as well as payments for addons at the same time, not multiple transactions. Not sure if I can achieve that with Checkout Sessions.

digital oxide
#

You can do that with Checkout Sessions, you put all of your recurring and one-time Prices in the line_items and the Checkout Session puts the one-time prices on just the first Invoice of the resulting Subscription.

line_items array of objects Required unless setup mode
A list of items the customer is purchasing. Use this parameter to pass one-time or recurring Prices.

For payment mode, there is a maximum of 100 line items, however it is recommended to consolidate line items if there are more than a few dozen.

For subscription mode, there is a maximum of 20 line items with recurring Prices and 20 line items with one-time Prices. Line items with one-time Prices will be on the initial invoice only.
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items

knotty lintel
#

I see that, however from my understanding with Checkout Sessions I have to offer a success_url / redirect, but I want to complete the payment at that point. Is that possible?
I want to achieve as I mentioned both: create subscription and create payment intent (i think it's called this way), so I won't have 2 transactions.

digital oxide
#

No you don't. The Subscription will create an Invoice, which will create a Payment Intent, for both the recurring prices and one-time ones all included in that single payment. If you created a Subscription and a Payment Intent then you would have two transactions.

I see that, however from my understanding with Checkout Sessions I have to offer a success_url / redirect, but I want to complete the payment at that point. Is that possible?
I'm not sure what this means. The payment is completed within the Checkout Session. The URLs you referenced are there so we know where to send the customer once they complete the payment.

mossy nestBOT
knotty lintel
#

I have a custom checkout page, so once they complete the payment, it will simply return success from the server.

opaque sluice
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

#

I'm not sure I fully understand the issue

#

would you mind elaborating a bit more?

knotty lintel
#

Hello,
Sure!
In my app,I made a custom checkout page, I am not using the pre-built ones.
Also, in the checkout the user can do the following:
Subscribe to a specific plan only
or
Subscribe to a specific plan and pay for addons that are not subscriptions, are more like one time payments. (you can check nordvpn checkout so you have an idea of what I have)

What I want to achieve:
Once I know what the user decides to buy, server side, I could have create subscription and create payment intent (hopefully it's called this way), basically one for subscription and one for the addon.
However, If I do it like this, it's going to create 2 transactions which I don't want. I want to have only one transaction: Subscription (recurrent) and addon (non-recurrent)
How can I solve this issue?

opaque sluice
#

you don't have to create a separate payment_intent

knotty lintel
#

Oh, Okay, this looks good.
So first invoice extra basically means that only for the first invoice the user will pay X extra more. But for the upcoming subscriptions payments, it's going to be the established cost, have I understood it correctly?

opaque sluice
#

correct

knotty lintel
#

Sounds great! Thank you!

opaque sluice
#

let me know if you need any more help

knotty lintel
#

for now, that's it. All clear