Created
February 5, 2020 08:42
-
-
Save dagingaa/87811b4ca30d6b3798d42c253746fcdb to your computer and use it in GitHub Desktop.
Backdates a Stripe subscription without triggering proration. Probably the easiest way to undo a mistake if you ended up screwing something up royally and need to reset.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stripe = require("stripe")("api_key"); | |
const CUSTOMER = ""; | |
const PLAN = ""; | |
const quantity = 1; | |
const startTimeInSecondsSinceEpoch = 0; | |
const billingCycleAnchorInSecondsSinceEpoch = 0; | |
async function foo() { | |
const subscription = await stripe.subscriptions.create({ | |
customer: CUSTOMER, | |
items: [{ plan: PLAN, quantity }], | |
backdate_start_date: startTimeInSecondsSinceEpoch, | |
billing_cycle_anchor: billingCycleAnchorInSecondsSinceEpoch, | |
proration_behavior: "none", | |
}); | |
console.log(subscription.id); | |
} | |
foo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment