#samundrak-trial-payment

1 messages · Page 1 of 1 (latest)

frank rapids
#

Hello! Can you please share a snippet of your code showing how you create the checkout session with a trial? Or an example subscription/invoice id?

finite totem
#

try {
const session = await stripe.checkout.sessions.create({
mode: "subscription",
billing_address_collection: "required",
payment_method_types: ["card"],
subscription_data: priceIds.length > 1 ? {
trial_period_days: 90
} : {},
line_items: priceIds.map((price) => ({
price: price,
quantity: 1,
adjustable_quantity: {
enabled: false,
},
})),
// ?session_id={CHECKOUT_SESSION_ID} means the redirect will have the session ID set as a query param
success_url: ${domainURL}/success.html?session_id={CHECKOUT_SESSION_ID},
cancel_url: ${domainURL}/canceled.html,

frank rapids
#

Ok, this seems as expected, but you're finding a customer is charged a non-zero amount right away?

#

can you share an example invoice/subscription that i can look at?

finite totem
#

actually my requirement was

  • pay 600$ in advance of 3 months
  • After 3 months charge 200$ per month
frank rapids
#

Oh, that sounds different than what you initial described. How are you achieving the up front payment?

#

And how does this align with your question about the unexpected initial payment?

finite totem
#

so the trial end problem is solved now, after doing some search on old threads.
Created 2 plans 1 with one-time payment and another with monthly recurring payment but with trial of 3 months