Skip to content

Instantly share code, notes, and snippets.

@toruf-stripe
Created October 21, 2021 08:51
Show Gist options
  • Save toruf-stripe/ae3331670bcee9e74d3f5e57e64f41fe to your computer and use it in GitHub Desktop.
Save toruf-stripe/ae3331670bcee9e74d3f5e57e64f41fe to your computer and use it in GitHub Desktop.
Create a Checkout session to subscribe emulating billing cycle anchor and proration
curl -X POST https://api.stripe.com/v1/checkout/sessions \
-u {SECRET_KEY}: \
-d cancel_url="https://example.com" \
-d success_url="https://example.com" \
-d mode="subscription" \
-d line_items[0][price]={DAILY_PRICE_ID} \
-d line_items[0][quantity]=5 \
-d line_items[1][price]={MONTHLY_PRICE_ID} \
-d line_items[1][quantity]=1 \
-d subscription_data[trial_end]=1635724801 \
-d payment_method_types[0]="card"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment