Working with Multiple Subscriptions
Create multiple subscriptions for a single customer by subscribing them to more than one plan or different variations of the same plan. If you need help after reading this, check out our answers to common questions or chat live with other developers in #stripe on freenode.
Creating a new subscription
Stripe offers the ability to subscribe a single customer object to multiple subscriptions. Each subscription will have a unique ID and its state is handled independently from other subscriptions. To add a new subscription to an existing customer, first retrieve the customer, and then use the create method within the subscriptions sublist:
# Set your secret key: remember to change this to your live secret key in production
# See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
Stripe::Subscription.create(
:customer => "cus_3R1W8PG2DmsmM9",
:plan => "basic_monthly"
)
# Set your secret key: remember to change this to your live secret key in production
# See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
stripe.Subscription.create(
customer="cus_3R1W8PG2DmsmM9",
plan="basic_monthly"
)
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
\Stripe\Subscription::create(array(
"customer" => "cus_3R1W8PG2DmsmM9",
"plan" => "basic_monthly"
));
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2";
Map<String, Object> subscriptionParams = new HashMap<String, Object>();
subscriptionParams.put("customer", "cus_3R1W8PG2DmsmM9");
subscriptionParams.put("plan", "basic_monthly");
Subscription.create(subscriptionParams);
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
var stripe = require("stripe")("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
stripe.subscriptions.create({
customer: "cus_3R1W8PG2DmsmM9",
plan: "basic_monthly"
}, function(err, subscription) {
// asynchronously called
});
A customer can be subscribed to a single plan more than once. The billing cycle for each subscription can be different, and is dependent on when that subscription was created.
Note that the number of trial days a customer has used is tracked on a per-subscription basis. We will deduct the number of trial days previously consumed by a subscription from the plan’s trial_period_days unless a trial_end value is specified.