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, plan, and backdate_start_date.

    curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBXUtjZo0nHBmW \ -d items[0][plan]=plan_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: [{plan: 'plan_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=[{'plan': 'plan_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'); StripeSubscription::create([ 'customer' => 'cus_GBXUtjZo0nHBmW', 'items' => [['plan' => 'plan_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"; Map<String, Object> item = new HashMap<>(); item.put("plan", "plan_1234"); Map<String, Object> items = new HashMap<>(); items.put("0", item); Map<String, Object> params = new HashMap<>(); params.put("customer", "cus_GBXUtjZo0nHBmW"); params.put("items", items); params.put("backdate_start_date", 1575176400); 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: [{plan: 'plan_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{ { Plan: stripe.String("plan_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 = new List<SubscriptionItemOptions> { new SubscriptionItemOptions {Plan = "plan_1234"} }; var options = new SubscriptionCreateOptions { Customer = "cus_GBXUtjZo0nHBmW", Items = items, BackdateStartDate = 1575176400, }; var service = new SubscriptionService(); Subscription 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 prorate=false when you create the subscriptions. This sets the start_date so that it matches the 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 15th and you’re migrating to Stripe. You have a subscription that started on September 1st and the next billing date is November 1st. To migrate this subscription, you’d create a new subscription and set backdate_start_date to September 1st and billing_cycle_anchor to November 1st.

    curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBXUtjZo0nHBmW \ -d items[0][plan]=plan_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: [{plan: 'plan_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=[{'plan': 'plan_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'); StripeSubscription::create([ 'customer' => 'cus_GBXUtjZo0nHBmW', 'items' => [['plan' => 'plan_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"; Map<String, Object> item = new HashMap<>(); item.put("plan", "plan_1234"); Map<String, Object> items = new HashMap<>(); items.put("0", item); Map<String, Object> params = new HashMap<>(); params.put("customer", "cus_GBXUtjZo0nHBmW"); params.put("items", items); params.put("backdate_start_date", 1575176400); params.put("billing_cycle_anchor", 1572580800); 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: [{plan: 'plan_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{ { Plan: stripe.String("plan_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 = new List<SubscriptionItemOptions> { new SubscriptionItemOptions {Plan = "plan_1234"} }; var options = new SubscriptionCreateOptions { Customer = "cus_GBXUtjZo0nHBmW", Items = items, BackdateStartDate = 1575176400, BillingCycleAnchor = 1572580800, }; var service = new SubscriptionService(); Subscription subscription = service.Create(options);

    This immediatley 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?

    Feedback about this page?

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.

    On this page