From 331f58b3b8a2a2f2e997617fbb1ac261d0a77292 Mon Sep 17 00:00:00 2001 From: CodeAnimal Date: Wed, 28 Feb 2018 09:50:46 +0000 Subject: [PATCH] Add `days_until_due` argument when creating/updating subscription With tests. https://stripe.com/docs/api#create_subscription-days_until_due --- types/stripe/index.d.ts | 11 +++++++++++ types/stripe/stripe-tests.ts | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 12f2b4abea..f35dcbd979 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -4384,6 +4384,12 @@ declare namespace Stripe { * instructions. Defaults to "charge_automatically". */ billing?: SubscriptionBilling; + + /** + * Number of days a customer has to pay invoices generated by this subscription. + * Only valid for subscriptions where billing=send_invoice. + */ + days_until_due?: number; } interface ISubscriptionCreationOptions extends ISubscriptionCustCreationOptions { @@ -4456,6 +4462,11 @@ declare namespace Stripe { */ billing?: SubscriptionBilling; + /** + * Number of days a customer has to pay invoices generated by this subscription. Only valid for subscriptions where billing=send_invoice. + */ + days_until_due?: number; + /** * List of subscription items, each with an attached plan. */ diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index b887ae6228..47c58b0f7c 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -253,12 +253,13 @@ stripe.customers.create({ customer.subscriptions.create({ items: [{ plan: "gold" }] }).then(function (subscription) { }); customer.subscriptions.create({ items: [{ plan: "gold" }], trial_end: "now" }).then(function (subscription) { }); - customer.subscriptions.create({ items: [{ plan: "gold" }], trial_end: 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) { }); customer.subscriptions.retrieve("sub_8Eluur5KoIKxuy").then(function (subscription) { customer.subscriptions.update("sub_8Eluur5KoIKxuy", { items: [{ id: subscription.items.data[0].id, plan: "silver" }] }).then(function (subscription) { }); }); customer.subscriptions.update("sub_8Eluur5KoIKxuy", { trial_end: "now" }); - customer.subscriptions.update("sub_8Eluur5KoIKxuy", { trial_end: 1516881177 }); + customer.subscriptions.update("sub_8Eluur5KoIKxuy", { trial_end: 1516881177, billing: "send_invoice", days_until_due: 7 }); customer.subscriptions.list().then(function (subscriptions) { }); customer.subscriptions.del("sub_8Eluur5KoIKxuy").then(function (subscription) { }); customer.subscriptions.deleteDiscount("sub_8Eluur5KoIKxuy").then(function (confirmation) { });