#blank_docs

1 messages ¡ Page 1 of 1 (latest)

short carbonBOT
#

👋 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/1222794410354278432

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

short dove
#

hi there!

#

you want to create a Subscription with a free trial, and collect a payment method upfront?

#

If so, that's possible with Checkout Session.

#

let me find the parameter for this

tepid forge
#

hello! Kind of, we already create a free-trial subscription without any payment method when a user creates an account. We want to then later send them through the payment flow while their subscription is still trialing.

short dove
#

got it. in this case you would simply collect a new payment method from the user, for example with a Checkout Session in setup mode, and set that PaymentMethod as a default. Then when the trial is over, Stripe will automatically charge the default PaymentMethod

tepid forge
#

Yep that's what we do currently, however it happens at the end of the subscription, at the moment users are getting confused because they think they're paying at that point (but we're just setting up for the later payment)

#

We then get some disputes etc later as they think we've charged them twice or the charge looks strange to them (as its up to 7 days later)

short dove
#

so you want the trial to stop when they add a payment method?

tepid forge
#

well we want this checkout screen essentially

#

however doing that would generate 2 subscriptions, one that has just been paid and the still trialing subscription

#

basically we need something like a subscription_update_confirm saying "Do you want to pay now and end your trial?" kind of thing

short dove
#

however doing that would generate 2 subscriptions, one that has just been paid and the still trialing subscription
correct, with Checkout Session you can create a brand new Subscripiton, but not update an existing subscription

#

basically we need something like a subscription_update_confirm saying "Do you want to pay now and end your trial?" kind of thing
Not possible out of the box. That's something you would need to build yourself with the Payment Element

tepid forge
short dove
#

not sure what you mean. if you create a Checkout Session in subscription mode, it will always create a brand new Subscription.

#

or redirect you to the customer portal to update the existing Subscription.

tepid forge
#

yes sorry, using a portal session

short dove
#

oh I see.

tepid forge
#

like this ```ts
{
return_url: redirectUrls.cancel,
customer: customer.id,
flow_data: {
type: 'subscription_update_confirm',
subscription_update_confirm: {
subscription: subscription.id,
items: [{ id: item.id, quantity: 1, price: price.id }],
},
after_completion: {
type: 'redirect',
redirect: { return_url: redirectUrls.success },
},
},
}

#

this will actually do what we want, but only if the price is a different price

#

it will charge them immediately end the trial etc

short dove
#

doing exactly what you want is not possible with the portal. but that's something you could build on your end with the Payment Element UI.

tepid forge
#

I see, our alternative for now is it to listen for the setup checkout session completion and then end the trial immediately (via the API). Is there anything wrong with that?

short dove
#

yes that's an interesting option! the only downside is that the payment might fail if 3DS is requested, but that can always happen with off_session payments.

tepid forge
#

that's the same if the trial ended normally right? it can fail 3DS then as well?

#

Also is there an accepted way to end a trial immediately, is it just setting the trial_end property?

short dove
#

that's the same if the trial ended normally right? it can fail 3DS then as well?
correct

tepid forge
#

Great, thank you! I think we're all sorted then, thanks for your time.