Reputation: 258
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!
Upvotes: 1
Views: 1302
Reputation: 6495
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
withbilling_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.
Upvotes: 0