#oss-checkout

1 messages · Page 1 of 1 (latest)

bleak wedge
#

hi there

blissful sun
#

Hello

bleak wedge
blissful sun
#

like this?

    checkout_session = stripe.checkout.Session.create(
        line_items=[
            {
                'price': PRICE_ID,
                'quantity': 1,
            },
        ],

        mode='subscription',

        subscription_data.trial_period_days = 14,

        customer_email=email,
        success_url=url_for('thankyou', _external=True),
        cancel_url=url_for('initial', _external=True),
bleak wedge
#

you many need to un-flatten the line subscription_data.trial_period_days

#

I think you would need smth like subscription_data= {trial_period_day=14}

#

Not familiar with syntax, sorry

blissful sun
#

This is what the website says:

subscription_data.trial_period_days
optional
Integer representing the number of trial period days before the customer is charged for the first time. Has to be at least 1.

#

Where does it go?

bleak wedge
#

Yes, so it's 2 level parameters, I believe

#

subscription_data is inside Session, then trial_period_days is inside subscription_data

blissful sun
#

When i do this:::

        trial_period_days=14,
        customer_email=email,
        success_url=url_for('thankyou', _external=True),
        cancel_url=url_for('initial', _external=True),
#

I get an error on the webpage

#

Request req_4BUxDlj5IGadpX: Received unknown parameter: trial_period_days

bleak wedge
#

because you can't directly specify trial_period_days

#

you need to specify subscription_data first, then inside it specify trial_period_day

blissful sun
#

Thank you for your help

#

This worked:::

        subscription_data={
            "trial_period_days": 14,
        },