Billing
Additional features
Backdating subscriptions

Backdating subscriptions

Learn about backdating subscriptions.

Backdating subscriptions is used to bill customers for time that has already elapsed. This is often used when migrating to Stripe or for record keeping purposes. When backdating subscriptions, the start_date field reflects the date the subscription is backdated to. You can optionally bill customers for this elapsed time and set the next billing date.

Backdating and charging users

Sometimes users might have access to your service before a subscription is created for them. To charge users for this time, create and backdate a subscription by passing the customer, price, and backdate_start_date.

curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBXUtjZo0nHBmW \ -d items[0][price]=price_1234 \ -d backdate_start_date=1575176400
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' Stripe::Subscription.create({ customer: 'cus_GBXUtjZo0nHBmW', items: [{price: 'price_1234'}], backdate_start_date: 1575176400, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' stripe.Subscription.create( customer='cus_GBXV9Q95NFT80k', items=[{'price': 'price_1234'}], backdate_start_date=1575176400, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); \Stripe\Subscription::create([ 'customer' => 'cus_GBXUtjZo0nHBmW', 'items' => [['price' => 'price_1234']], 'backdate_start_date' => 1575176400, ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; SubscriptionCreateParams params = SubscriptionCreateParams.builder() .setCustomer("cus_GBXUtjZo0nHBmW") .addItem( SubscriptionCreateParams.Item.builder() .setPrice("price_1234") .build()) .setBackdateStartDate(1575176400L) .build(); Subscription subscription = Subscription.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const subscription = await stripe.subscriptions.create({ customer: 'cus_GBXUtjZo0nHBmW', items: [{price: 'price_1234'}], backdate_start_date: 1575176400, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.SubscriptionParams{ Customer: stripe.String("cus_GBXUtjZo0nHBmW"), Items: []*stripe.SubscriptionItemsParams{ { Price: stripe.String("price_1234"), }, }, BackdateStartDate: 1575176400, } s, _ := sub.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var items = var options = new SubscriptionCreateOptions { Customer = "cus_GBXUtjZo0nHBmW", Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = "price_1234", }, }, BackdateStartDate = 1575176400, }; var service = new SubscriptionService(); var subscription = service.Create(options);

This creates an invoice with a prorated amount for the time between the backdated start date and the current time. In this example, it also sets the start_date on the subscription to September 1st and the billing cycle anchor to the current date.

Backdating without charging users

If you’re migrating to Stripe, you might want to backdate your subscriptions without charging your customers. You can do this by passing proration_behavior: 'none' when you create the subscriptions. This sets the start_date to the same value as backdate_start_date, but it doesn’t charge the customer for backdated time.

Backdating and setting the billing cycle anchor

You can combine backdate_start_date with billing_cycle_anchor to backdate a subscription and set the billing cycle anchor to a date in the future. This creates a prorated item on the next invoice for the time between the backdated start date and the billing cycle anchor. This is useful if you’re migrating to Stripe and need to carry over the next billing date for your subscriptions. It also allows you to bill customers for elapsed time and to carry over the start dates for your subscriptions from your previous integration.

For example, let’s say it’s October 15 and you’re migrating to Stripe. You have a subscription that started on September 1 and the next billing date is November 1. To migrate this subscription, you’d create a new subscription and set backdate_start_date to September 1st and billing_cycle_anchor to November 1.

curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBXUtjZo0nHBmW \ -d items[0][price]=price_1234 \ -d backdate_start_date=1575176400 \ -d billing_cycle_anchor=1572580800
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' Stripe::Subscription.create({ customer: 'cus_GBXUtjZo0nHBmW', items: [{price: 'price_1234'}], backdate_start_date: 1575176400, billing_cycle_anchor: 1572580800, })
# Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' stripe.Subscription.create( customer='cus_GBXV9Q95NFT80k', items=[{'price': 'price_1234'}], backdate_start_date=1575176400, billing_cycle_anchor=1572580800, )
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); \Stripe\Subscription::create([ 'customer' => 'cus_GBXUtjZo0nHBmW', 'items' => [['price' => 'price_1234']], 'backdate_start_date' => 1575176400, 'billing_cycle_anchor' => 1572580800, ]);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; SubscriptionCreateParams params = SubscriptionCreateParams.builder() .setCustomer("cus_GBXUtjZo0nHBmW") .addItem( SubscriptionCreateParams.Item.builder() .setPrice("price_1234") .build()) .setBackdateStartDate(1575176400L) .setBillingCycleAnchor(1572580800L) .build(); Subscription subscription = Subscription.create(params);
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const subscription = await stripe.subscriptions.create({ customer: 'cus_GBXUtjZo0nHBmW', items: [{price: 'price_1234'}], backdate_start_date: 1575176400, billing_cycle_anchor: 1572580800, });
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.SubscriptionParams{ Customer: stripe.String("cus_GBXUtjZo0nHBmW"), Items: []*stripe.SubscriptionItemsParams{ { Price: stripe.String("price_1234"), }, }, BackdateStartDate: 1575176400, BillingCycleAnchor: 1572580800, } s, _ := sub.New(params)
// Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var items = ; var options = new SubscriptionCreateOptions { Customer = "cus_GBXUtjZo0nHBmW", Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = "price_1234", }, }, BackdateStartDate = 1575176400, BillingCycleAnchor = 1572580800, }; var service = new SubscriptionService(); Subscription subscription = service.Create(options);

This immediately issues an invoice for the prorated amount from the time between September 1st and November 1st. The next invoice will be issued on November 1st. It also sets the start_date of the subscription to September 1st.

Was this page helpful?
Questions? Contact us.
Developer tutorials on YouTube.