Setting a trail period on a product or price in Stripe is no longer recommended for compatibility with Checkout and quotes.
However StartStack supports setting a trail period on a price by adding the trailPeriodDays
metadata key to a
price.
The /services/checkout.ts
file has logic to handle this. See: checkout.sessions.create
.
Note the trial settings.
// if we have a trialPeriodDays in the metadata, and the mode is subscription, set the trial settings...(mode === "subscription" &&(priceDetails.metadata as Metadata)["trialPeriodDays"] && {subscription_data: {trial_settings: {end_behavior: {missing_payment_method: "cancel",},},trial_period_days: parseInt((priceDetails.metadata as Metadata)["trialPeriodDays"]),},}),// if we have a trialPeriodDays in the metadata, and the mode is subscription, set the payment method collection to if_required...(mode === "subscription" &&(priceDetails.metadata as Metadata)["trialPeriodDays"] && {payment_method_collection: "if_required",}),
By default when you set a trial period on a price, StartStack will add a Trial badge to the price card.