Add trial_period_days argument when creating subscription

With tests.

https://stripe.com/docs/api#create_subscription-trial_period_days
This commit is contained in:
CodeAnimal
2018-02-28 10:00:33 +00:00
parent 82bfcaea76
commit aaac896891
2 changed files with 6 additions and 1 deletions

View File

@@ -4373,6 +4373,11 @@ declare namespace Stripe {
*/
trial_end?: number | "now";
/**
* Integer representing the number of trial period days before the customer is charged for the first time.
*/
trial_period_days?: number;
/**
* List of subscription items, each with an attached plan.
*/

View File

@@ -251,7 +251,7 @@ stripe.customers.create({
customer.cards.list().then(function (cards) {});
customer.cards.del("card_17xMvXBoqMA9o2xkq6W5gamx").then(function (confirmation) {});
customer.subscriptions.create({ items: [{ plan: "gold" }] }).then(function (subscription) { });
customer.subscriptions.create({ items: [{ plan: "gold" }], trial_period_days: 7 }).then(function (subscription) { });
customer.subscriptions.create({ items: [{ plan: "gold" }], trial_end: "now", billing_cycle_anchor: 1516881177 }).then(function (subscription) { });
customer.subscriptions.create({ items: [{ plan: "gold" }], trial_end: 1516881177, billing: "send_invoice", days_until_due: 7 }).then(function (subscription) { });
customer.subscriptions.create({ items: [{ plan: "gold" }], billing: "charge_automatically" }).then(function (subscription) { });