Billing
Additional features
Subscription schedules
Use cases

Subscription schedules use cases

Learn how to use subscription schedules.

The following use cases demonstrate some common ways to use subscription schedules. They’re modeled after a fictional newspaper company called The Pacific. It offers two subscription options: print and digital. The print option is for the physical newspaper and the digital option allows access to the newspaper’s website. Both subscriptions bill monthly.

Starting a subscription in the future

By default, new print subscriptions start on the first day of the next month. To accomplish this, the start_date is set to a point in the future. The code below creates a subscription that starts in the future:

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBHHxuvBvO26Ea \ -d start_date=1604188800 \ -d end_behavior=release \ -d phases[0][items][0][price]=price_print \ -d phases[0][items][0][quantity]=1 \ -d phases[0][iterations]=12
# 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::SubscriptionSchedule.create({ customer: 'cus_GBXUtjZo0nHBmW', start_date: '1604188800', end_behavior: 'release', phases: [ { items: [ {price: 'price_print', quantity: 1}, ], iterations: 12, }, ], })
# 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.SubscriptionSchedule.create( customer='cus_GBXV9Q95NFT80k', start_date='1604188800', end_behavior='release', phases=[ { 'items': [ {'price': 'price_print', 'quantity': 1}, ], 'iterations': 12, }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_GBXVvM3Lyqlb92', 'start_date' => '1604188800', 'end_behavior' => 'release', 'phases' => [ [ 'items' => [ [ 'price' => 'price_print', 'quantity' => 1, ], ], 'iterations' => 12, ], ], ]);
// 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"; SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_GBXVzJZPdLuVU7") .setStartDate(1604188800L) .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.RELEASE) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_print") .setQuantity(1L) .build()) .setIterations(12L) .build()) .build(); SubscriptionSchedule schedule = SubscriptionSchedule.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'); // Starting a subscription 30 days from now const schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_G8BQyXLV4wIrlu', start_date: new Date('2020-11-01').getTime() / 1000, end_behavior: 'release', phases: [ { items: [{price: 'price_print', quantity: 1}], iterations: 12 }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_G8BQyXLV4wIrlu"), StartDate: stripe.Int64("1604188800"), EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_print"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(12), }, }, } schedule, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_GBZpSoDXILjq1a", StartDate = DateTimeOffset.FromUnixTimeSeconds("1604188800").UtcDateTime, EndBehavior = "release", Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_print", Quantity = 1, }, }, Iterations = 12, }, }, }; var service = new SubscriptionScheduleService(); service.Create(options);

Backdating a subscription

When customers subscribe to the digital plan, The Pacific backdates their subscriptions to the first day of the current month. Backdating charges for time in the past and allows digital subscribers to access the website immediately.

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBHHxuvBvO26Ea \ -d start_date=1598918400 \ -d end_behavior=release \ -d phases[0][items][0][price]=price_print \ -d phases[0][items][0][quantity]=1 \ -d phases[0][iterations]=12
# 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::SubscriptionSchedule.create({ customer: 'cus_GBHCmVcdwIb5ye', start_date: '1598918400', end_behavior: 'release', phases: [ { items: [ {price: 'price_print', quantity: 1}, ], iterations: 12, }, ], })
# 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.SubscriptionSchedule.create( customer='cus_GBXV9Q95NFT80k', start_date='1598918400', end_behavior='release', phases=[ { 'items': [ {'price': "price_print", 'quantity': 1}, ], 'iterations': 12, }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_GBXVvM3Lyqlb92', 'start_date' => '1598918400', 'end_behavior' => 'release', 'phases' => [ [ 'items' => [ [ 'price' => 'price_print', 'quantity' => 1, ], ], 'iterations' => 12, ], ], ]);
// 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"; SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_GBXVzJZPdLuVU7") .setStartDate(1598918400L) .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.RELEASE) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_print") .setQuantity(1L) .build()) .setIterations(12L) .build()) .build(); SubscriptionSchedule schedule = SubscriptionSchedule.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'); // Backdating a subscription to the first day of the previous month. const schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_G8BQyXLV4wIrlu', start_date: new Date('2020-09-01').getTime() / 1000, end_behavior: 'release', phases: [ { items: [{price: 'price_print', quantity: 1}], iterations: 12, }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_G8BQyXLV4wIrlu"), StartDate: stripe.Int64("1598918400}"), EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_print"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(12), }, }, } schedule, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_GBa4ZI52MEpjSz", StartDate = DateTimeOffset.FromUnixTimeSeconds("1598918400").UtcDateTime, EndBehavior = "release", Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_print", Quantity = 1, }, }, Iterations = 12, }, }, }; var service = new SubscriptionScheduleService(); service.Create(options);

Adding a schedule to an existing subscription

The Pacific may discover that some of their original customers are on subscriptions without schedules. Because these subscriptions exist already, the subscription IDs can be passed in the from_subscription attribute to add a schedule. Passing the subscription IDs in this way creates a schedule with one phase that’s based on the current billing period of the subscription.

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d from_subscription=sub_GB98WOvaRAWPl6
# 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::SubscriptionSchedule.create({ from_subscription: 'sub_GB98WOvaRAWPl6', })
# 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.SubscriptionSchedule.create( from_subscription='sub_GB98WOvaRAWPl6', )
// 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\SubscriptionSchedule::create([ 'from_subscription' => 'sub_GB98WOvaRAWPl6', ]);
// 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"; SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder() .setFromSubscription("sub_GB98WOvaRAWPl6") .build(); SubscriptionSchedule schedule = SubscriptionSchedule.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 schedule = await stripe.subscriptionSchedules.create({ from_subscription: 'sub_GB98WOvaRAWPl6' });
// 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.SubscriptionScheduleParams{ FromSubscription: stripe.String("sub_GB98WOvaRAWPl6"), } schedule, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { FromSubscription = "cus_GBGtWriHqoHUxj", }; var service = new SubscriptionScheduleService(); service.Create(options);

While adding these schedules, some customers decide to get a print subscription so The Pacific adds a second phase to the schedule to start the print plan on the first day of the next month. The following use case shows an example of this process.

Upgrading subscriptions

The Pacific offers an option to start off on the print subscription for a month and then automatically add the digital option. Some customers prefer this because they can test out the print publication first and then decide if they want to continue or cancel their subscription.

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBHHxuvBvO26Ea \ -d start_date=now \ -d end_behavior=release \ -d phases[0][items][0][price]=print \ -d phases[0][items][0][quantity]=1 \ -d phases[0][iterations]=1 \ -d phases[1][items][0][price]=print \ -d phases[1][items][0][quantity]=1 \ -d phases[1][items][1][price]=digital \ -d phases[1][items][1][quantity]=1 \ -d phases[1][iterations]=11
# 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::SubscriptionSchedule.create({ customer: 'cus_GBXUtjZo0nHBmW', start_date: 'now', end_behavior: 'release', phases: [ { items: [ {price: 'price_print', quantity: 1}, ], iterations: 1, }, { items: [ {price: 'price_print', quantity: 1}, {price: 'price_digital', quantity: 1}, ], iterations: 11, }, ], })
# 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.SubscriptionSchedule.create( customer='cus_GBXV9Q95NFT80k', start_date='now', end_behavior='release', phases=[ { 'items': [ {'price': 'price_print', 'quantity': 1}, ], 'iterations': 1, }, { 'items': [ {'price': 'price_print', 'quantity': 1}, {'price': 'price_digital', 'quantity': 1}, ], 'iterations': 11, }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_GBXVvM3Lyqlb92', 'start_date' => 'now', 'end_behavior' => 'release', 'phases' => [ [ 'items' => [ [ 'price' => 'price_print', 'quantity' => 1, ], ], 'iterations' => 1, ], [ 'items' => [ [ 'price' => 'price_print', 'quantity' => 1, ], [ 'price' => 'price_digital', 'quantity' => 1, ], ], 'iterations' => 11, ], ], ]);
// 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"; SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_GBXVzJZPdLuVU7") .setStartDate(SubscriptionScheduleCreateParams.StartDate.NOW) .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.RELEASE) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_print") .setQuantity(1L) .build()) .setIterations(1L) .build()) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_print") .setQuantity(1L) .build()) .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_digital") .setQuantity(1L) .build()) .setIterations(11L) .build()) .build(); SubscriptionSchedule schedule = SubscriptionSchedule.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 schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_G8BQyXLV4wIrlu', start_date: 'now', end_behavior: 'release', phases: [ { items: [ {price: 'price_print', quantity: 1}, ], iterations: 1, }, { items: [ {price: 'price_print', quantity: 1}, {price: 'price_digital', quantity: 1}, ], iterations: 11, }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_G8BQyXLV4wIrlu"), StartDateNow: stripe.Bool(true), EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_print"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(1), }, { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_print"), Quantity: stripe.Int64(1), }, { Price: stripe.String("price_digital"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(11), }, }, } schedule, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_GBZpSoDXILjq1a", StartDate = SubscriptionScheduleStartDate.Now, EndBehavior = "release", Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_print", Quantity = 1, }, }, Iterations = 1, }, new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_print", Quantity = 1, }, new SubscriptionSchedulePhaseItemOptions { Price = "price_digital", Quantity = 1, }, }, Iterations = 11, }, }, }; var service = new SubscriptionScheduleService(); service.Create(options);

Downgrading subscriptions

The Pacific also offers an option to start a subscription with both the print and digital publications, and then downgrade to only the print publication for the rest of the subscription. Customers use this option to test out both publications to see how they like them.

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBHHxuvBvO26Ea \ -d start_date=now \ -d end_behavior=release \ -d phases[0][items][0][price]=digital \ -d phases[0][items][0][quantity]=1 \ -d phases[0][items][1][price]=print \ -d phases[0][items][1][quantity]=1 \ -d phases[0][iterations]=1 \ -d phases[1][items][0][price]=print \ -d phases[1][items][0][quantity]=1 \ -d phases[1][iterations]=11
# 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::SubscriptionSchedule.create({ customer: 'cus_GBXUtjZo0nHBmW', start_date: 'now', end_behavior: 'release', phases: [ { items: [ {price: 'price_digital', quantity: 1}, {price: 'price_print', quantity: 1}, ], iterations: 1, }, { items: [ {price: 'price_print', quantity: 1}, ], iterations: 11, }, ], })
# 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.SubscriptionSchedule.create( customer='cus_GBXV9Q95NFT80k', start_date='now', end_behavior='release', phases=[ { 'items': [ {'price': 'price_digital', 'quantity': 1}, {'price': 'price_print', 'quantity': 1}, ], 'iterations': 1, }, { 'items': [ {'price': 'price_print', 'quantity': 1}, ], 'iterations': 11, }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_GBXVvM3Lyqlb92', 'start_date' => 'now', 'end_behavior' => 'release', 'phases' => [ [ 'items' => [ [ 'price' => 'price_digital', 'quantity' => 1, ], [ 'price' => 'price_print', 'quantity' => 1, ], ], 'iterations' => 1, ], [ 'items' => [ [ 'price' => 'price_print', 'quantity' => 1, ], ], 'iterations' => 11, ], ], ]);
// 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"; SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_GBXVzJZPdLuVU7") .setStartDate(SubscriptionScheduleCreateParams.StartDate.NOW) .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.RELEASE) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_digital") .setQuantity(1L) .build()) .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_print") .setQuantity(1L) .build()) .setIterations(1L) .build()) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_digital") .setQuantity(1L) .build()) .setIterations(11L) .build()) .build(); SubscriptionSchedule schedule = SubscriptionSchedule.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 schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_G8BQyXLV4wIrlu', start_date: 'now', end_behavior: 'release', phases: [ { items: [ {price: 'price_digital', quantity: 1}, {price: 'price_print', quantity: 1}, ], iterations: 1, }, { items: [ {price: 'price_print', quantity: 1}, ], iterations: 11, }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_G8BQyXLV4wIrlu"), StartDateNow: stripe.Bool(true), EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_digital"), Quantity: stripe.Int64(1), }, { Price: stripe.String("price_print"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(1), }, { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_print"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(11), }, }, } schedule, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_GBZpSoDXILjq1a", StartDate = SubscriptionScheduleStartDate.Now, EndBehavior = "release", Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_digital", Quantity = 1, }, new SubscriptionSchedulePhaseItemOptions { Price = "price_print", Quantity = 1, }, }, Iterations = 1, }, new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_print", Quantity = 1, }, }, Iterations = 11, }, }, }; var service = new SubscriptionScheduleService(); service.Create(options);

Increasing the quantity

You can also schedule increases to the quantities on a subscription. The schedule below starts with one instance of the digital publication for one month. In the second phase, the quantity is increased to 2 for 11 more months.

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBHHxuvBvO26Ea \ -d start_date=now \ -d end_behavior=release \ -d "phases[][items][][price]='price_digital'" \ -d phases[][items][][quantity]=1 \ -d phases[][iterations]=1 \ -d "phases[][items][][price]='price_digital'" \ -d phases[][items][][quantity]=2 \ -d phases[][iterations]=11
# 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::SubscriptionSchedule.create({ customer: 'cus_GBXUtjZo0nHBmW', start_date: 'now', end_behavior: 'release', phases: [ { items: [ {price: 'price_digital', quantity: 1}, ], iterations: 1, }, { items: [ {price: 'price_digital', quantity: 2}, ], iterations: 11, }, ], })
# 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.SubscriptionSchedule.create( customer='cus_GBXV9Q95NFT80k', start_date='now', end_behavior='release', phases=[ { 'items': [ {'price': 'price_digital', 'quantity': 1}, ], 'iterations': 1, }, { 'items': [ {'price': 'price_digital', 'quantity': 2}, ], 'iterations': 11, }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_GBXVvM3Lyqlb92', 'start_date' => 'now', 'end_behavior' => 'release', 'phases' => [ [ 'items' => [ [ 'price' => 'price_digital', 'quantity' => 1, ], ], 'iterations' => 1, ], [ 'items' => [ [ 'price' => 'price_digital', 'quantity' => 2, ], ], 'iterations' => 11, ], ], ]);
// 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"; SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_GBXVzJZPdLuVU7") .setStartDate(SubscriptionScheduleCreateParams.StartDate.NOW) .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.RELEASE) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_digital") .setQuantity(1L) .build()) .setIterations(1L) .build()) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_digital") .setQuantity(2L) .build()) .setIterations(11L) .build()) .build(); SubscriptionSchedule schedule = SubscriptionSchedule.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 schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_G8BQyXLV4wIrlu', start_date: 'now', end_behavior: 'release', phases: [ { items: [{price: 'price_digital', quantity: 1}], iterations: 1 }, { items: [{price: 'price_digital', quantity: 2}], iterations: 11, }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_G8BQyXLV4wIrlu"), StartDateNow: stripe.Bool(true), EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_digital"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(1), }, { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_digital"), Quantity: stripe.Int64(2), }, }, Iterations: stripe.Int64(11), }, }, } schedule, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_GBZpSoDXILjq1a", StartDate = SubscriptionScheduleStartDate.Now, EndBehavior = "release", Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_digital", Quantity = 1, }, }, Iterations = 1, }, new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_digital", Quantity = 2, }, }, Iterations = 11, }, }, }; var service = new SubscriptionScheduleService(); service.Create(options);

Using coupons

Sometimes The Pacific runs subscription specials. The schedule below starts the customer on the print publication at 50% off for six months. The schedule removes the coupon from the subscription in the second phase, which entails the remaining six months.

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBHHxuvBvO26Ea \ -d start_date=now \ -d end_behavior=release \ -d phases[0][items][0][price]=price_print \ -d phases[0][items][0][quantity]=1 \ -d phases[0][iterations]=6 \ -d phases[0][coupon]=co_50_percent_off \ -d phases[1][items][0][price]=price_print \ -d phases[1][items][0][quantity]=1 \ -d phases[1][iterations]=6
# 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::SubscriptionSchedule.create({ customer: 'cus_GBXUtjZo0nHBmW', start_date: 'now', end_behavior: 'release', phases: [ { items: [ {price: 'price_print', quantity: 1}, ], iterations: 6, coupon: 'co_50_percent_off', }, { items: [ {price: 'price_print', quantity: 1}, ], iterations: 6, }, ], })
# 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.SubscriptionSchedule.create( customer='cus_GBXV9Q95NFT80k', start_date='now', end_behavior='release', phases=[ { 'items': [ {'price': 'price_print', 'quantity': 1}, ], 'iterations': 6, 'coupon': 'co_50_percent_off', }, { 'items': [ {'price': 'price_print', 'quantity': 1}, ], 'iterations': 6, }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_GBXVvM3Lyqlb92', 'start_date' => 'now', 'end_behavior' => 'release', 'phases' => [ [ 'items' => [ [ 'price' => 'price_print', 'quantity' => 1, ], ], 'iterations' => 6, 'coupon' => 'co_50_percent_off', ], [ 'items' => [ [ 'price' => 'price_print', 'quantity' => 1, ], ], 'iterations' => 6, ] ], ]);
// 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"; SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_GBXVzJZPdLuVU7") .setStartDate(SubscriptionScheduleCreateParams.StartDate.NOW) .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.RELEASE) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_print") .setQuantity(1L) .build()) .setIterations(6L) .setCoupon("co_50_percent_off") .build()) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_print") .setQuantity(2L) .build()) .setIterations(6L) .build()) .build(); SubscriptionSchedule schedule = SubscriptionSchedule.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 schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_G8BQyXLV4wIrlu', start_date: 'now', end_behavior: 'release', phases: [ { items: [{price: 'price_print', quantity: 1}], iterations: 6, coupon: 'co_50_percent_off', }, { items: [{price: 'price_print', quantity: 1}], iterations: 6, }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_G8BQyXLV4wIrlu"), StartDateNow: stripe.Bool(true), EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_print"), Quantity: stripe.Int64(1), }, Coupon: stripe.String("co_50_percent_off"), }, Iterations: stripe.Int64(6), }, { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_print"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(6), }, }, } schedule, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_GBZpSoDXILjq1a", StartDate = SubscriptionScheduleStartDate.Now, EndBehavior = "release", Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_print", Quantity = 1, }, }, Iterations = 6, Coupon = "co_50_percent_off", }, new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_print", Quantity = 1, }, }, Iterations = 6, }, }, }; var service = new SubscriptionScheduleService(); service.Create(options);

Changing tax rates

The Pacific operates in several jurisdictions, and some of them have unique tax rates for subscription based businesses. One of these jurisdictions requires two tax rates: one for the first month when a customer initially subscribes, and one for recurring billings.

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBHHxuvBvO26Ea \ -d start_date=now \ -d end_behavior=release \ -d phases[0][items][0][price]=price_digital \ -d phases[0][items][0][quantity]=1 \ -d phases[0][items][0][tax_rates][0]=txr_2J8lmBBGHJYyuUJqF6QJtaAA \ -d phases[0][iterations]=1 \ -d phases[1][items][0][price]=price_digital \ -d phases[1][items][0][quantity]=1 \ -d phases[1][items][0][tax_rates][0]=txr_1F6kmAAJVYItwOKqV9IWebBB \ -d phases[1][iterations]=11
# 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::SubscriptionSchedule.create({ customer: 'cus_GBXUtjZo0nHBmW', start_date: 'now', end_behavior: 'release', phases: [ { items: [ {price: 'price_digital', quantity: 1, tax_rates: ['txr_2J8lmBBGHJYyuUJqF6QJtaAA']}, ], iterations: 1, }, { items: [ {price: 'price_digital', quantity: 1, tax_rates: ['txr_2J8lmBBGHJYyuUJqF6QJtbBB']}, ], iterations: 11, }, ], })
# 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.SubscriptionSchedule.create( customer='cus_GBXV9Q95NFT80k', start_date='now', end_behavior='release', phases=[ { 'items': [ {'price': 'price_digital', 'quantity': 1, 'tax_rates': ['txr_2J8lmBBGHJYyuUJqF6QJtaAA']}, ], 'iterations': 1, }, { 'items': [ {'price': 'price_digital', 'quantity': 1, 'tax_rates': ['txr_2J8lmBBGHJYyuUJqF6QJtbBB']}, ], 'iterations': 11, }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_GBXVvM3Lyqlb92', 'start_date' => 'now', 'end_behavior' => 'release', 'phases' => [ [ 'items' => [ [ 'price' => 'price_digital', 'quantity' => 1, 'tax_rates' => [ 'txr_2J8lmBBGHJYyuUJqF6QJtaAA', ], ], ], 'iterations' => 1, ], [ 'items' => [ [ 'price' => 'price_digital', 'quantity' => 1, 'tax_rates' => [ 'txr_2J8lmBBGHJYyuUJqF6QJtbBB', ], ], ], 'iterations' => 11, ], ], ]);
// 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"; SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_GBXVzJZPdLuVU7") .setStartDate(SubscriptionScheduleCreateParams.StartDate.NOW) .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.RELEASE) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_digital") .setQuantity(1L) .addTaxRate("txr_2J8lmBBGHJYyuUJqF6QJtaAA") .build()) .setIterations(1L) .build()) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_digital") .setQuantity(1L) .addTaxRate("txr_2J8lmBBGHJYyuUJqF6QJtbBB") .build()) .setIterations(11L) .build()) .build(); SubscriptionSchedule schedule = SubscriptionSchedule.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 schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_G8BQyXLV4wIrlu', start_date: 'now', end_behavior: 'release', phases: [ { items: [{price: 'price_digital', quantity: 1, tax_rates: ['txr_2J8lmBBGHJYyuUJqF6QJtaAA']}], iterations: 1, }, { items: [{price: 'price_digital', quantity: 1, tax_rates: ['txr_1F6kmAAJVYItwOKqV9IWebBB']}], iterations: 11, }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_G8BQyXLV4wIrlu"), StartDateNow: stripe.Bool(true), EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_digital"), Quantity: stripe.Int64(1), TaxRates: []*string{ stripe.String("txr_2J8lmBBGHJYyuUJqF6QJtaAA"), }, }, }, Iterations: stripe.Int64(1), }, { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_digital"), Quantity: stripe.Int64(1), TaxRates: []*string{ stripe.String("txr_1F6kmAAJVYItwOKqV9IWebBB"), }, }, }, Iterations: stripe.Int64(11), }, }, } schedule, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_GBZpSoDXILjq1a", StartDate = SubscriptionScheduleStartDate.Now, EndBehavior = "release", Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_digital", Quantity = 1, TaxRates = new List<string> { "txr_2J8lmBBGHJYyuUJqF6QJtaAA", }, }, }, Iterations = 1, }, new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_digital", Quantity = 1, TaxRates = new List<string> { "txr_2J8lmBBGHJYyuUJqF6QJtbBB", }, }, }, Iterations = 11, }, }, }; var service = new SubscriptionScheduleService(); service.Create(options);

Releasing a subscription from a schedule

You can release a subscription from a schedule as long as the status of the schedule is not_started or active. Releasing a subscription leaves it in place but removes the schedule and any remaining phases.

curl https://api.stripe.com/v1/subscription_schedules/sub_sched_1FdsKnBF6ERF9jhEWilacWsB/release \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
# 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::SubscriptionSchedule.release('sub_sched_1FdsKnBF6ERF9jhEWilacWsB')
# 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.SubscriptionSchedule.release('sub_sched_1FdsKnBF6ERF9jhEWilacWsB')
// 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'); $schedule = \Stripe\SubscriptionSchedule::retrieve('sub_sched_1FdsKnBF6ERF9jhEWilacWsB'); $schedule->release();
// 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"; SubscriptionSchedule schedule = SubscriptionSchedule.retrieve("sub_sched_1FdsKnBF6ERF9jhEWilacWsB"); schedule.release();
// 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 schedule = await stripe.subscriptionSchedules.release('sub_sched_1FdsKnBF6ERF9jhEWilacWsB');
// 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" schedule, _ := subschedule.Release("sub_sched_1FdsKnBF6ERF9jhEWilacWsB", nil)
// 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 service = new SubscriptionScheduleService(); var schedule = service.Release("sub_sched_1FdsKnBF6ERF9jhEWilacWsB");

Resetting the billing cycle anchor

The Pacific bills their long-time print customers on whichever day of the month they originally subscribed. This day is their billing cycle anchor.

If these customers transition to the digital edition, The Pacific schedules their transition date for the 1st day of the following month. They also reset the billing cycle anchor to that same date.

You can verify that the billing cycle anchor gets reset by creating a subscription using the sample code below. Look at the subscription on the Dashboard, and notice that the Upcoming Invoice is scheduled to bill the customer as soon as the digital subscription starts on the 1st.

To see what happens if you don’t reset the anchor, run the sample code again, but remove the line that sets the billing cycle anchor to phase_start. Without that line, the Upcoming Invoice on the Dashboard waits to bill the customer until a full month from today, despite the transition that occurs on the 1st.

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBHHxuvBvO26Ea \ -d start_date=now \ -d phases[0][items][0][price]=print \ -d phases[0][items][0][quantity]=1 \ -d phases[0][end_date]=1604188800 \ -d phases[1][items][0][price]=digital \ -d phases[1][items][0][quantity]=1 \ -d phases[1][iterations]=11 \ -d phases[1][billing_cycle_anchor]=phase_start
# 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::SubscriptionSchedule.create({ customer: 'cus_GBXUtjZo0nHBmW', start_date: 'now', phases: [ { items: [ {price: 'price_print', quantity: 1}, ], end_date: '1604188800', }, { items: [ {price: 'price_digital', quantity: 1}, ], iterations: 11, billing_cycle_anchor: 'phase_start', }, ], })
# 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.SubscriptionSchedule.create( customer='cus_GBXV9Q95NFT80k', start_date='now', phases=[ { 'items': [ {'price': 'price_print', 'quantity': 1}, ], 'end_date': '1604188800', }, { 'items': [ {'price': 'price_digital', 'quantity': 1}, ], 'iterations': 11, 'billing_cycle_anchor': 'phase_start', }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_GBXVvM3Lyqlb92', 'start_date' => 'now', 'phases' => [ [ 'items' => [ [ 'price' => 'price_print', 'quantity' => 1, ], ], 'end_date' => '1604188800', ], [ 'items' => [ [ 'price' => 'price_digital', 'quantity' => 1, ], ], 'iterations' => 11, 'billing_cycle_anchor' => 'phase_start', ], ], ]);
// 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"; SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_GBXVzJZPdLuVU7") .setStartDate(SubscriptionScheduleCreateParams.StartDate.NOW) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_print") .setQuantity(1L) .build()) .setEndDate(1604188800L) .build()) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPrice("price_digital") .setQuantity(1L) .build()) .setIterations(11L) .setBillingCycleAnchor("phase_start") .build()) .build(); SubscriptionSchedule schedule = SubscriptionSchedule.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 schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_G8BQyXLV4wIrlu', start_date: 'now', phases: [ { items: [ {price: 'price_print', quantity: 1}, ], end_date: new Date('2020-11-01').getTime() / 1000, }, { items: [ {price: 'price_digital', quantity: 1}, ], iterations: 11, billing_cycle_anchor: 'phase_start', }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_G8BQyXLV4wIrlu"), StartDateNow: stripe.Bool(true), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_print"), Quantity: stripe.Int64(1), }, }, EndDate: stripe.Int64("1604188800"), }, { Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_digital"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(11), BillingCycleAnchor: stripe.String("phase_start"), }, }, } schedule, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_GBZpSoDXILjq1a", StartDate = SubscriptionScheduleStartDate.Now, Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_print", Quantity = 1, }, }, EndDate = DateTime(2020, 11, 1, 0, 0, 0, DateTimeKind.Utc), }, new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_digital", Quantity = 1, }, }, Iterations = 11, BillingCycleAnchor = "phase_start", }, }, }; var service = new SubscriptionScheduleService(); service.Create(options);

Installment plans

Installment plans allow customers to make partial payments for a set amount of time until the total amount is paid. For example, when The Pacific buys new printing presses, they sell the used ones to other publications. Smaller publications rarely have enough funds to pay for a printing press upfront, so they pay using an installment plan instead.

For most presses, The Pacific charges 1,000 USD per month so a reusable price is created:

curl https://api.stripe.com/v1/prices \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d unit_amount=100000 \ -d currency=usd \ -d product=prod_Hh99apo1OViyGW \ -d recurring[interval]=month
# 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::Price.create({ unit_amount: 100000, currency: 'usd', recurring: { interval: 'month' }, product: 'prod_Hh99apo1OViyGW', })
# 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.Price.create( unit_amount=100000, currency='usd', recurring={ 'interval': 'month' }, product='prod_Hh99apo1OViyGW', )
// 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\Price::create([ 'unit_amount' => 100000, 'currency' => 'usd', 'recurring' => [ 'interval' => 'month' ], 'product' => 'prod_Hh99apo1OViyGW', ]);
// 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"; PriceCreateParams params = PriceCreateParams.builder() .setProduct("prod_Hh99apo1OViyGW") .setUnitAmount(100000L) .setCurrency("usd") .setRecurring( PriceCreateParams.Recurring.builder() .setInterval(PriceCreateParams.Recurring.Interval.MONTH) .build()) .build(); Price price = Price.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 price = await stripe.prices.create({ unit_amount: 100000, currency: 'usd', product: 'prod_Hh99apo1OViyGW', recurring: { interval: 'month' }, });
// 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.PriceParams{ UnitAmount: stripe.Int64(100000), Currency: stripe.String(string(stripe.CurrencyUSD)), Product: stripe.String("prod_Hh99apo1OViyGW"), Recurring: &stripe.PriceRecurringParams{ Interval: stripe.String("month"), }, } p, _ := price.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 options = new PriceCreateOptions { UnitAmount = 100000, Currency = "usd", Recurring = new PriceRecurringOptions { Interval = "month", }, Product = "prod_Hh99apo1OViyGW", }; var service = new PriceService(); service.Create(options);

Depending on the make, model, and age of the printing press, The Pacific charges different amounts. This example charges 1,000 USD each month for six months, for a total of 6,000 USD.

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBXUtjZo0nHBmW \ -d start_date=now \ -d end_behavior=cancel \ -d phases[0][items][0][price]=price_1HJcbcHajoqMmUx0ihk9hSEG \ -d phases[0][items][0][quantity]=1 \ -d phases[0][iterations]=6
# 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::SubscriptionSchedule.create({ customer: 'cus_HtQ2OCoIDxTRWn', start_date: 'now', end_behavior: 'cancel', phases: [ { items: [ { price: 'price_1HJcbcHajoqMmUx0ihk9hSEG', quantity: 1, }, ], iterations: 6, }, ], })
# 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.SubscriptionSchedule.create( customer='cus_HtQ3Oi5oVyVCEK', start_date='now', end_behavior='cancel', phases=[ { 'items': [ { 'price': 'price_1HJcbcHajoqMmUx0ihk9hSEG', 'quantity': 1, }, ], 'iterations': 6, }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_HtQ4CBEUetY2pw', 'start_date' => 'now', 'end_behavior' => 'cancel', 'phases' => [ [ 'items' => [ [ 'price' => 'price_1HJcbcHajoqMmUx0ihk9hSEG', 'quantity' => 1, ], ], 'iterations' => 6, ], ], ]);
// 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"; SubscriptionScheduleCreateParams subscriptionScheduleCreateParams = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_HucQNC7mBGB2ys") .setStartDate(SubscriptionScheduleCreateParams.StartDate.NOW) .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.CANCEL) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addPlan( SubscriptionScheduleCreateParams.Phase.Plan.builder() .setPrice("price_1HL7gOHajoqMmUx0mCcX60Pp") .setQuantity(1L) .build()) .setIterations(6L) .build()) .build(); SubscriptionSchedule subscriptionSchedule = SubscriptionSchedule.create(subscriptionScheduleCreateParams);
// 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 schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_Hh99DTDJK2jVSo', start_date: 'now', end_behavior: 'cancel', phases: [ { items: [ { price: 'price_1HJcbcHajoqMmUx0ihk9hSEG', quantity: 1, }, ], iterations: 6, }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_HtPHDTG8v9Vl9q"), EndBehavior: stripe.String("cancel"), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { ProrationBehavior: stripe.String("none"), Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { Price: stripe.String("price_1HJcbcHajoqMmUx0ihk9hSEG"), Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(6), }, }, StartDate: stripe.Int64(int64(time.Now().Unix())), } ss, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_HtQ7L28ORGCkvF", StartDate = Stripe.SubscriptionScheduleStartDate.Now, EndBehavior = "cancel", Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { Price = "price_1HJcbcHajoqMmUx0ihk9hSEG", Quantity = 1, }, }, Iterations = 6, }, }, }; var service = new SubscriptionScheduleService(); var schedule = service.Create(options);

Note that the number of iterations is multiplied by the price’s interval—6 monthly payments in this example—to determine the number of times the customer is charged. end_behavior determines what happens to the subscription after the last iteration is complete. In an installment plan, the subscription isn’t needed anymore so end_behavior is set to cancel.

In rare cases, The Pacific charges less than the usual 1,000 USD per month. In these scenarios, they use price_data to create a single-use price. This example creates a 500 USD price, and charges monthly for six months:

curl https://api.stripe.com/v1/subscription_schedules \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_GBXUtjZo0nHBmW \ -d start_date=now \ -d end_behavior=cancel \ -d phases[0][items][0][price_data][currency]=usd \ -d phases[0][items][0][price_data][product]=prod_Hh99apo1OViyGW \ -d phases[0][items][0][price_data][unit_amount]=50000 \ -d phases[0][items][0][price_data][recurring][interval]=month \ -d phases[0][items][0][quantity]=1 \ -d phases[0][iterations]=6
# 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::SubscriptionSchedule.create({ customer: 'cus_HtQ2OCoIDxTRWn', start_date: 'now', end_behavior: 'cancel', phases: [ { items: [ { price_data: { currency: 'usd', product: 'prod_Hh99apo1OViyGW', recurring: { interval: 'month', }, unit_amount: 50000, }, quantity: 1, }, ], iterations: 6, }, ], })
# 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.SubscriptionSchedule.create( customer='cus_HtPHDTG8v9Vl9q', start_date='now', end_behavior='cancel', phases=[ { 'items': [ { 'price_data': { 'currency': 'usd', 'product': 'prod_Hh99apo1OViyGW', 'recurring': { 'interval': 'month' }, 'unit_amount': 50000 }, 'quantity': 1, }, ], 'iterations': 6, }, ], )
// 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\SubscriptionSchedule::create([ 'customer' => 'cus_HtVPAbDvRdUBa6', 'start_date' => 'now', 'end_behavior' => 'cancel', 'phases' => [ [ 'items' => [ [ 'price_data' => [ 'currency' => 'usd', 'product' => 'prod_Hh99apo1OViyGW', 'recurring' => [ 'interval' => 'month', ], 'unit_amount' => 50000 ], 'quantity' => 1, ], ], 'iterations' => 6, ], ], ]);
// 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"; SubscriptionScheduleCreateParams subscriptionScheduleCreateParams = SubscriptionScheduleCreateParams.builder() .setCustomer("cus_HtQ3Oi5oVyVCEK") .setStartDate(SubscriptionScheduleCreateParams.StartDate.NOW) .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.CANCEL) .addPhase( SubscriptionScheduleCreateParams.Phase.builder() .addItem( SubscriptionScheduleCreateParams.Phase.Item.builder() .setPriceData( SubscriptionScheduleCreateParams.Phase.Plan.PriceData.builder() .setProduct("prod_HkQQxeCYRtMsgh") .setCurrency("usd") .setUnitAmount(50000L) .setRecurring( SubscriptionScheduleCreateParams.Phase.Plan.PriceData.Recurring.builder() .setInterval(SubscriptionScheduleCreateParams.Phase.Plan.PriceData.Recurring.Interval.MONTH) .build()) .build()) .setQuantity(1L) .build()) .setIterations(6L) .build()) .build(); SubscriptionSchedule subscriptionSchedule = SubscriptionSchedule.create(subscriptionScheduleCreateParams);
// 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 schedule = await stripe.subscriptionSchedules.create({ customer: 'cus_Hh9CXszVB1PyIf', start_date: 'now', end_behavior: 'cancel', phases: [ { items: [ { price_data: { currency: 'usd', product: 'prod_Hh99apo1OViyGW', recurring: { interval: 'month', }, unit_amount: 50000, }, quantity: 1, }, ], iterations: 6, }, ], });
// 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.SubscriptionScheduleParams{ Customer: stripe.String("cus_HtPHDTG8v9Vl9q"), EndBehavior: stripe.String("cancel"), Phases: []*stripe.SubscriptionSchedulePhaseParams{ { ProrationBehavior: stripe.String("none"), Items: []*stripe.SubscriptionSchedulePhaseItemParams{ { PriceData: &stripe.SubscriptionItemPriceDataParams{ Currency: stripe.String(string(stripe.CurrencyUSD)), UnitAmount: stripe.Int64(50000), Product: stripe.String("prod_Hh99apo1OViyGW"), Recurring: &stripe.SubscriptionItemPriceDataRecurringParams{ Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), }, }, Quantity: stripe.Int64(1), }, }, Iterations: stripe.Int64(6), }, }, StartDate: stripe.Int64(int64(time.Now().Unix())), } ss, _ := subschedule.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 options = new SubscriptionScheduleCreateOptions { Customer = "cus_HtPHDTG8v9Vl9q", StartDate = SubscriptionScheduleStartDate.Now, EndBehavior = "cancel", Phases = new List<SubscriptionSchedulePhaseOptions> { new SubscriptionSchedulePhaseOptions { Items = new List<SubscriptionSchedulePhaseItemOptions> { new SubscriptionSchedulePhaseItemOptions { PriceData = new SubscriptionItemPriceDataOptions { UnitAmount = 50000, Currency = "USD", Product = "prod_Hh99apo1OViyGW", Recurring = new SubscriptionItemPriceDataRecurringOptions { Interval = "month", }, }, Quantity = 1, }, }, Iterations = 6, }, }, }; var service = new SubscriptionScheduleService(); var schedule = service.Create(options);
Was this page helpful?
Questions? Contact us.
Developer tutorials on YouTube.