#xmy_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ 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/1282627841220935712
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
I also have an additional question but there was not enough space in the form:
Right now my flow looks like the following:
- Creating the subscription with
payment_behavior: "default_incomplete" - Using the
payment_intent'sclient_secretto pay (with card or paypal in my case)
I want to offer a one-time trial per account. From what I've seen I'd need to create a subscription with trial_period_days, but this creates a $0 invoice item and no payment information is required.
As far as I understand, this means the customer would come back another time to actually go through with the payment?
Do I need to change my flow to the following?
First subscription:
- Create a setup intent to add a payment method
- If the payment method is valid, create a stripe customer attach the payment method as default
- Create a subscription with the payment method, adding
trial_period_days - Disabling trial eligibility in my business logic
Nth subscription:
- Check if customer has a least one payment method set up (otherwise kick off setup intent flow)
- Create a subscription with the payment method, not adding
trial_period_daysas trial eligibility is disabled
hi!
question 1 : yes
question 2 : you can use https://docs.stripe.com/billing/subscriptions/subscription-schedules/ to schedule the change, otherwise you need to set up your server to call the API at the right time
for your other question, the flow for a trial is the same, just you use the pending_setup_intent.client_secret on the frontend instead of latest_invoice.payment_intent.client_secret. Or you can collect the card first with a SI and then create the Sub, as you describe, if you prefer that
So my frontend would require no changes? Just conditionally return a different client secret
you have to call confirmSetup instead of confirmPayment, for example
Oh alright, but pending_setup_intent.client_secret is coming from the created subscription?