Set the billing cycle date
Set a subscription's billing cycle anchor to a fixed date.
When you create a Checkout Session, you can explicitly set a subscription’s billing cycle anchor to a fixed date, such as the 1st of the next month. The billing cycle anchor determines the first date when customers are billed the full subscription amount. The billing cycle anchor and the recurring interval of its price determine a subscription’s future billing dates. For example, a monthly subscription created on May 15 with an anchor at June 1 is billed on May 15, then on the 1st of the month for the life of the subscription.
There are two ways to set the billing cycle anchor:
- Use subscription_data.billing_cycle_anchor_config to describe a recurring billing date with explicit fields for
day_,of_ month month,hour,minute, andsecond(monthly and yearly subscriptions only). Stripe automatically accounts for short months and leap years. - Use subscription_data.billing_cycle_anchor to set the anchor directly as a future UNIX timestamp.
Use the proration_behavior parameter to customize how to handle prorations for the initial billing period up until the first full invoice date. By default, proration_ is set to create_, and customers receive a prorated invoice. If proration_ is none, the first invoice is waived, meaning that they are subscribed for free during the first period and they only get an invoice after the billing cycle anchor, which would then include the full amount.
Set the billing cycle date with a config object
For monthly and yearly subscriptions, use subscription_ to specify the billing renewal date with a config object instead of a raw timestamp. Stripe automatically handles edge cases like short months and leap years.
For example, to anchor billing to the 1st of every month, set day_ to 1. To anchor a yearly subscription to July 1, set month to 7 and day_ to 1.
Mutually exclusive parameters
The following parameters are mutually exclusive: billing_, billing_, and any trial period settings.
curl https://api.stripe.com/v1/checkout/sessions \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d "line_items[0][price]=" \ -d "line_items[0][quantity]=1" \ -d mode=subscription \ --data-urlencode "success_url=https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ -d "subscription_data[billing_cycle_anchor_config][day_of_month]=1"{{PRICE_ID}}
You can also specify hour, minute, and second for precise control over the anchor time. If omitted, they default to the time of the subscription creation request (in UTC).
billing_ is only compatible with monthly and yearly subscriptions. For daily or weekly subscriptions, use billing_ with a UNIX timestamp instead.
Create a Checkout Session with a billing cycle anchor
To configure a billing cycle anchor with a UNIX timestamp, set the subscription_ parameter when you create a Checkout Session in subscription mode. The anchor must be a future UNIX timestamp within the first billing period (the current timestamp plus the recurring interval duration).
curl https://api.stripe.com/v1/checkout/sessions \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d "line_items[0][price]=" \ -d "line_items[0][quantity]=1" \ -d mode=subscription \ --data-urlencode "success_url=https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ -d "subscription_data[billing_cycle_anchor]=1611008505"{{PRICE_ID}}
If a customer attempts payment after a session’s active period has passed the date set for the billing cycle anchor, Checkout charges for the full period starting with the billing cycle anchor instead of the prorated period before the billing cycle anchor.
Disable prorations
To disable prorations, set the subscription_ parameter to none when creating a Checkout Session.
curl https://api.stripe.com/v1/checkout/sessions \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -d "line_items[0][price]=" \ -d "line_items[0][quantity]=1" \ -d mode=subscription \ --data-urlencode "success_url=https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ -d "subscription_data[billing_cycle_anchor]=1611008505" \ -d "subscription_data[proration_behavior]=none"{{PRICE_ID}}
Similar to a free trial, the customer isn’t charged for the initial period up to the billing cycle anchor. Unlike a trial, no 0 USD invoice is generated. Customers receive an invoice with the full subscription amount on the billing cycle anchor date.
In the Checkout Session response object, amounts attached to the line items and total details are always 0 when prorations are disabled. Additionally, the payment status of the Session is set to no_ to reflect that payment is delayed to a future date.
Limitations
- You can’t use trials in Checkout Sessions with a billing cycle anchor.
- You can’t use one-time prices in Checkout Sessions when
proration_isbehavior none. - You can’t apply amount_off coupons to Checkout Sessions with a default
proration_ofbehavior create_.prorations