#harsha
1 messages ยท Page 1 of 1 (latest)
You may set proration_behavior parameter to create_proration or always_invoice for collecting pro-rated amount: https://stripe.com/docs/api/subscriptions/update#update_subscription-proration_behavior
You may refer to the details here: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment
@minor holly Thanks for the reply. Is there a possibility if proration_behavior is set to create_proration then can we invoke payment immediately?
For me, I have a different logic for pro rata and I want to charge immediately on subscription update.
If you wish to invoke payment immediately, you can set it to always_invoice [0]
Always invoice immediately for prorations.
Reference from: https://stripe.com/docs/api/subscriptions/update#update_subscription-proration_behavior
@minor holly I went through the docs but still confused. I cant see how to set pro rata amount.
Pro-rated amount is calculated by Stripe and you can't set it on your own with proration_behavior parameter. Do you mean you'd like to calculate the pro-rated amount on your own instead of using the one calculated by Stripe?
yes. Is there any alternative that you could suggest?
In this case, you will:
- Set the
proration_behaviortononeto disable proration calculated by Stripe - Calculate your own prorated amount and add it to line items with
add_invoice_itemsparameter: https://stripe.com/docs/api/subscriptions/update#update_subscription-add_invoice_items
@minor holly Just to confirm as mentioned in second step add_invoice_items.price_data.unit_amount will be the final amount that will be charged for current payment and for next recurring payment charges will be based on add_invoice_items.price amount.
add_invoice_times is for one-time payment on pro-rated amount.
For updating subscription to new price plan which next recurring payment charges will be based, it should be set on items.data: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#changing
@minor holly For pro-rata changes in items.data will be only for current payment and will not be applicable in future payment ( will be done on higher plan price amount)right?
Hi! What do you mean by "will be only for current payment and will not be applicable in future payment"?
If you add invoice items, they will be automatically added the next invoice for that subscription.
Let says my current plan A ($100) needs to be updated to plan B ($200) both are yearly recurring subscriptions. I want to update plan B after six months of purchase.
According to stripe pro-rata charges (six months) for used will be ($50) but I want to charge $70) with some different logic. So that the customer charge will be charged $170 (instead of $100 which stripe does) immediately upon the update. When I say current_payment ($170) I meant immediate payment on update. and future_payment ($200) is like the next recurring payment.
@distant ember For my use case if I set items as below
items.price to higher plan id let's say plan B ($200)
items.price_data.unit_amount will be set ($170)
Will that work for my use case?
Hum... one way to achieve what you want would be to:
- Update the subscription with the new price ($200) and set the
proration_behaviortonone. This way the subscription is upgraded, but there will be no payments. - Manually create a new invoice with the prorated amount that you compute on your end, and pay it immediately
But there might be a better way, let me think about this for a moment.
payment has to be off_session
Yes when you create the invoice you can set it to charge_automatically, and it will use the default payment method of the customer.
Ok. Please let me if there is better solution.
๐ taking over for my colleague. Let me catch up.
I think you're best way of achieving this is to use Stripe's normal pro-rata (50$ + 100$) and use the add_invoice_items https://stripe.com/docs/api/subscriptions/update#update_subscription-add_invoice_items for the extra 20$
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
@frigid socket With this approach, it may not work for me. As extra can be negative (for example instead of $70 in some cases it can be $30 ).
if it's negative, then you can add a discount on the invoice with the amount
e.g. discount $20
if the coupon you apply is created to be used once then yes
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Instead of coupons, will the below solution work for my use case?
items.price to higher plan id let's say plan B ($200)
items.price_data.unit_amount will be set ($170)
If set items this https://stripe.com/docs/api/subscriptions/update#update_subscription-items?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok got it
The only issue here is that I have to create many different coupons on updation.
yes I agree, the only other solution would be to create a subscription Schedule
with 2 phases
first with the $170 price (with 1 iteration) and the next phase with the $200 price
Can you send a reference to schedule with phases?
thanks
this section in particular https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing