Forum Academy Marketplace Showcase Pricing Features

Stripe | Billing Cycle | Proration

Hey,

So I am using stripe API to charge the user. When creating a billing portal session I am trying to pass the billing_cycle_anchor=now as a parameter so when a user updates a subscription he should be charged immediately/invoice.

https://stripe.com/docs/api/subscriptions/create#create_subscription-billing_thresholds-reset_billing_cycle_anchor

But it is not working. Also, I disabled the proration.

I tested this use case, and it works from the stripe dashboard but not the API.

Any solution?

It says it needs to be a future time. The billing cycle anchor should be Current date time +months (1):formatted as UNIX (i.e the date of the next invoice)

@georgecollier Thank you for your response. I am unable to initialize the call. Please check the following screenshots


2

Well that’s because you’re calling the billing portal session endpoint… Stripe API reference – Create a portal session – curl - that doesn’t support billing_cycle_anchor.

You can set the billing cycle anchor / proration behaviour in the Stripe dashboard then redirect customers to a portal. Alternatively, you can use the update a subscription API call detailed here: Stripe API reference – Update a subscription – curl and the billing_cycle_anchor parameter like you’ve done correctly as a parameter in your portal session API call.

Worked!

Thanks man

1 Like