Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.
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
You can’t perform that action at this time.