#Vishakvkt

1 messages · Page 1 of 1 (latest)

buoyant ospreyBOT
honest crystal
#

Hi 👋 can you elaborate on the full desired behavior you're looking for is?

trim rock
#

Sure. Here is an example:
On the 14th of April 2023, say a customer purchases a subscription which costs $100.
This subscription needs to be renewed on the 31st of December 2023.
Irrespective of what date of the year the customer purchases the subscription, their renewal date will always be 31st December 2023 and the cost will be $100.

In stripe, I have created a price with a yearly renewal of $100.
As it stands, If I set the billing_cycle_anchor to the 31st of Dec 2023, the subscription generates an invoice with a prorata payment of ~$72. We don't want that. It should be $100

honest crystal
#

Gotcha, I think you'll want to use a Subscription Schedule to accomplish that. They allow you to schedule future changes to your Subscriptions.

So what you can do is create your subscription without using the billing cycle anchor parameter - this will generate and process a full price Invoice
Once the Subscription is created you can create a Subscription Schedule from it.
You can then update the Subscription Schedule, and add a new phase to it - that new phase can be used to change the billing cycle anchor when you want (in this case Dec).

trim rock
#

Amazing thanks. Will have a proper read through and get back to you

trim rock
#

I have briefly tested both options. But it looks like I am running into some kind of race condition on stripe's end/some misconfiguration on my side
The current setup works as follows:

  • Customer adds the subscription product to their cart
  • On the server, create the stripe customer
  • Use stripe.Subscriptions.create to create a new subscription
  • Grab the subscription id from the previous response to create a SubscriptionSchedule. This create schedule fails with an invalid subscription id
  • If I attempt to attach the subscription schedule to the customer, i get an invalid customer id error
honest crystal
#

Can you share the IDs of requests where you encountered those errors?

trim rock
honest crystal
#

The request to create the Subscription Schedule came from a different account that the one that created the Subscription, so that error is expected as you cannot interact with objects that don't belong to the account making the request.

buoyant ospreyBOT
trim rock
#

Nice. That was my bad! I can make the api calls now. But looks like I can only create a schedule from the subscription after the customer has paid and the subscription is active