简体   繁体   中英

Stripe subscription with fixed renewal date

I want to use Stripe subscriptions to handle a membership fee. The issue is that memberships are annual, and they cost a fixed amount, no matter when you sign up. Ie you're paying for the full period even if they sign up in the middle of the period.

So for example let's say that a membership costs $100, and it runs from Jan 1 to Dec 31. If someone signs up today, they should get an invoice for $100, and then the subscription should be renewed for another $100 on Jan 1.

I've experimented a bit with creating the subscription using the backdate_start_date , billing_cycle_anchor , and proration_behavior fields, but haven't really gotten it to work quite as I would like it to.

Has anyone gotten a scenario like this working? Or any idea of how to best manage this?

The approach here is to charge for the full year using a yearly recurring Price (create this in your Dashboard or via the API), backdate to the beginning of the year, and cycle at the beginning of next year. In my test (in node) this resulted in a full period billed Invoice for 2020 of 100 EUR and an upcoming Invoice that will be billed for the next year on Jan 1 2021. The default is to create prorations, but in this case there are none since the full year is billed.

const subscription = await stripe.subscriptions.create({
  customer: 'cus_xxx',
  backdate_start_date: 1577836800,
  billing_cycle_anchor: 1609459200,
  items: [
    {price: 'price_xxx'},
  ],
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM