Home > OS >  Stripe checkout session in subscription mode, with free trial and without requesting payment method
Stripe checkout session in subscription mode, with free trial and without requesting payment method

Time:10-26

Is it possible to remove the payment method field or make it not "required" with Stripe Checkout API ?

Here is my backend code:

const freeTrial = {
    trial_from_plan:  realSubscription.id === 4 ? true : false
} 

if(customerStripeId != undefined || customerStripeId != null){
    const session = await stripe.checkout.sessions.create({
        mode: 'subscription',
        payment_method_types: ['card'],
        line_items: [
            {
                price: formData.monthlySetting === true ? realSubscription.monthly_price_id : realSubscription.annual_price_id,
                quantity: 1
            }
        ],
        customer: customerStripeId,
        success_url: `${BASE_URL}/success?session_id={CHECKOUT_SESSION_ID}`,
        cancel_url: BASE_URL,
        subscription_data: freeTrial
    })
    return {customerHasId: 'true', sessionData: session }
}else{
    return {customerHasId: 'false'}
}

In Stripe UI I have set up a 30 day trial for my first plan. It's working but when I checkout, Stripe still ask for a payment methode even though. It's like this checkout demo from Stripe: checkout demo from Stripe link to demo

CodePudding user response:

This is not possible today. Stripe Checkout requires valid payment method details to maximize the chance that you get the first invoice paid at the end of the trial. There is no way to skip payment method details collection on Checkout.

If you don't want a payment method upfront then you would create the Subscription with a trial on your end without using Stripe Checkout.

  • Related