#crawl-checkout-trialandcoupon
1 messages · Page 1 of 1 (latest)
Hey @compact compass ! What have you tried? What's not working?
crawl-checkout-trialandcoupon
Here i have a subscription with a lifetime coupon but this product does also have a 31 day trial
I dont know why it's not showing too
what's not showing exactly?
customer: customer.id,
line_items: [
{
// Provide the exact Price ID (for example, pr_1234) of the product you want to sell
price: STRIPE_PRICE_ID,
quantity: 1,
},
],
mode: 'subscription',
discounts: [{
coupon: STRIPE_COUPON_ID,
}],
// success_url: `${redirect}/?success=true`,
// cancel_url: `${redirect}/?canceled=true`,
success_url: STRIPE_REDIRECT_URI,
cancel_url: STRIPE_REDIRECT_URI,
automatic_tax: {enabled: STRIPE_TAX_ENABLED},
});
return session.url;```
I'm supposed to see the message
free for X days then 30$/ month
Products don't have any trial periods. Legacy/old Plan objects do, but it's ignored by default by Checkout. So I assume your question is how to set a trial period on a Subscription via Checkout? If so you want to set subscription_data[trial_period_days]: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-trial_period_days
Not directly 30$ per month
even though my price does have a trial period on stripe dashboard ?
yes
Ohhh ok, this is Legacy
I guess this has been deprecated recently
It was working before
that behaviour has always been like I described
ok so how do you pass it inside the create i sent above ?
customer: customer.id,
line_items: [
{
// Provide the exact Price ID (for example, pr_1234) of the product you want to sell
price: STRIPE_PRICE_ID,
quantity: 1,
},
],
mode: 'subscription',
discounts: [{
coupon: STRIPE_COUPON_ID,
}],
//Here ???
subscription_data.trial_period_days: 30,
success_url: STRIPE_REDIRECT_URI,
cancel_url: STRIPE_REDIRECT_URI,
automatic_tax: {enabled: STRIPE_TAX_ENABLED},
});```
you pass this similarly to how you passed enabled inside automatic_tax
ok so
subscription_data: {
trial_period_days: 30,
},
yep