0
votes

What I am trying to do is to add a new Subscription Item to an existing Stripe Customer

The Stripe customer already has a subscription with a billing period, and I would just like to add this new subscription (which is a different product) but I would like this amount to show on the next bill for the customer as a prorated amount. So that the subscriptions can have the same billing period. Meaning we can send the customer one invoice, and not charging the card on file more than one time per month.

So if the customer wanted to add an additional user at 10 dollars per month. and they signed up halfway through the month the customer would get billed 5 dollars for time used from the last billing period plus the regular 10 dollars for the subscription.

I have this code

if (item.Plan.ProductId == "productId") {
  var subscriptionItemOptions = new SubscriptionItemUpdateOptions {
    
    Price = "priceId",

      Quantity = vm.NumberOfUsersToChange,
  };

  var subscriptionItemService = new SubscriptionItemService();

  subscriptionItemService.Update(item.Id, subscriptionItemOptions);

}

What this does is on the next invoice it will subtract the amount of time not used.

I want the exact opposite to happen. So It would get the prorated amount and add to the next invoice.

Any help is greatly appreciated thanks!

1
I think you need to [specify proration_behavior] and set it to create_prorations and you may also need to specify proration_date when adding the Subscription Item, but I'm not 100% sure as the example you gave is ambiguous. If that doesn't work can you edit your question with a more detailed example that doesn't have the change happen exactly halfway through a period? - Justin Michael
Sorry for the delayed response but I have tried to proration behavior and it works, but the only problem is that it charges the card right away. I would like this subscription to be added to the customers upcoming invoice. Do I have to add this as InvoiceItemCreateOptions, and if I do this will this go to every invoice or do I have to create a subscription and somehow not bill this subscription right away so I can attach that subscription to the Invoice Item? - Eric
Our users can have two subscriptions which look at two products in stripe. So the first subscription is a base price. The other subscription is additional users they would like to add. So if they sign up with us and don't add additional users then the subscription does not exist for that customer. But inside the application, I want to give them the ability to actually add a user. Which I would like to capture the proration amount from when they added the user, and add that to their next invoice. So there next invoice would have base price, plus additional user cost, plus proration user AMT - Eric
I have also been pondering the idea of adding the subscription for the additional users and just setting the quantity to 0 for the price so they are not billed, but then I can manipulate the quantity for that subscription without trying to add an additional subscription for that customer - Eric
Why do you have two Subscriptions instead of just one that contains everything (the base price + the users)? It sounds like that would be easiest. You may also be interested in reading when Stripe Subscriptions will and will not attempt immediate payment - Justin Michael

1 Answers

0
votes

For the separate Subscription for the additional users you can backdate them, which I think will provide the behavior you're after.

Specifically, you can combine backdating and setting a billing cycle anchor to do what you're describing:

You can combine backdate_start_date with billing_cycle_anchor to backdate a subscription and set the billing cycle anchor to a date in the future. This creates a prorated item on the next invoice for the time between the backdated start date and the billing cycle anchor.