#luxterful_subscription-trial-pm-collection

1 messages ยท Page 1 of 1 (latest)

vestal vergeBOT
#

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

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

grave sedge
#

Hello there

#

Not sure what you mean by that exactly.

#

Can you tell me what you are trying to do here?

rain parcel
#

We would like to update our checkout page. We sell subscriptions and there is also a plan with free trial offered.

Right now we use setup intents to collect the payment method. But we have the issue that customers who buy via google pay see 0.00โ‚ฌ on the google pay popup since we use setup intents. Our plan was to rewrite the code to use payment intents. Thats why i am wondering if the will even work?

grave sedge
#

You should use the SetupIntent or PaymentIntent generated from the Subscription here when you create it.

#

As opposed to creating a SetupIntent or PaymentIntent up front

rain parcel
#

Ahhh, just that i understand correctly:

payment intents dont work with subscriptions with trial since they are meant for direct payments.

so for subscriptions with free trial i would need to create a setup intent. For subscriptions without free trial i would create a payment intent then?

Is that correct?

vestal vergeBOT
grave sedge
#

Nope, when you create a Subscription with a free trial then it creates a SetupIntent for you. You access it via the pending_setup_intent property: https://docs.stripe.com/api/subscriptions/object#subscription_object-pending_setup_intent

When you create a Subscription that is not free, it creates a PaymentIntent for you. You use payment_behavior: 'default_incomplete' if you haven't collected a PaymentMethod yet: https://docs.stripe.com/api/subscriptions/create#create_subscription-payment_behavior and then you use the generated PaymentIntent (accessible via latest_invoice.payment_intent) to collect a PaymentMethod.

#

No need to create a separate PaymentIntent or SetupIntent at all.

rain parcel
#

OK.

So as soon as the customer enters the checkout page i will create a subscription with payment_behavior: 'default_incomplete ??

analog pasture
#

Hi ๐Ÿ‘‹

I'm stepping in as my colleague needs to go.

#

Once your customer reaches the Checkout page and you wish to display Stripe elements to collection payment method information, yes you would create a Subscription and use the pending_setup_intent to render the Stripe Elements (if you are using a free trial period).

rain parcel
#

Ok, on the checkout page we have the plan selection and there automatically the plan with free trial is selected. So i create a subscription with free trial and render the Stripe Elements.

But what happens if the user selects another plan? e.g. one which does not offer free trial?

analog pasture
#

We also have an option where you can collect the payment method information first and then create the Subscription. We document that approach here

rain parcel
#

ok, i already have seen that. But i am still wondering what would have to be done in my described situation if i would create the subscription first?

#

I just want to understand my different options

analog pasture
#

Well you should only create the Subscription once you know what option the customer has selected.

#

Since that determines what data you need to provide in the Subscription items parameter

rain parcel
#

can i update the subscription and put another plan there?

analog pasture
#

You can, but you may wind up with unexpected prorated charges in that case.

#

Since Stripe calculates the amounts to invoice down to the second

#

So if you create a Subscription with Plan A, and then 10 seconds later update it to use Plan B instead, it will generate a line item for 10 seconds of Plan A.

rain parcel
#

Ahhhhh gotcha

#

ok so i will try the "collect payment first" approach you mentioned

#

thank you โค๏ธ

analog pasture
#

Happy to shed what ๐Ÿ’ก I can ๐Ÿ™‚