Add days_until_due argument when creating/updating subscription

With tests.

https://stripe.com/docs/api#create_subscription-days_until_due
This commit is contained in:
CodeAnimal
2018-02-28 09:54:40 +00:00
parent c300e37b1e
commit 331f58b3b8
2 changed files with 14 additions and 2 deletions
+11
View File
@@ -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.
*/
+3 -2
View File
@@ -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) { });