#zlatko-portal-downgrade
1 messages ยท Page 1 of 1 (latest)
Could you help me out and let me know which event I can listen to and which API should I call to return the credit. I'm going through the documentation, but can't find the correct event/API
I would listen for invoice.paid I think and see ending_balance and react based on that
Do you know what is the best way to return the money(which API)?
there isn't really a good way sadly
you basically have to find recent charge(s) for them and refund those until it adds up to the credit
So if I understand correctly e.g. Customer buys a plan for 70$ and then immediately downgrades to 30$ plan. This means there would be an invoice.paid for the initial plan and a charge. Then there would be a second invoice for the second plan and a charge.
I then need to listen to invoice.paid and if the ending_balance is positive. I need to get the most recent charge which is 30$ and call the refund API. After this call is made they still have a balance of 10$. So I need to get the first charge(which was 70$) and refund 10$?
I need to get the most recent charge which is 30$
no it's $70
They paid $70, then they downgraded to a $30 Price, so they paid 0 and got $40 credit
ah true, because 30$ was not charged since they already paid 70$
yes
ok, so in theory I could get the last charge and refund that one
Quite complicated to return money ๐
then I also need to handle the failed refund events etc. right?
Do you maybe know if it's possible to setup the Customer portal in a way that on upgrades the Customer gets charged right away, but on the downgrade it's at the end of the billing period
I mean failed refunds are not really likely in general and that's no different from any refund flow
and the Customer portal configuration? Are you maybe aware if that is possible to setup or it's not supported at this time?
I believe all of this is possible to do for subscriptions within the customer billing portal, but let me check. I'll circle back in a few minutes with more context
๐ thank you
Based on what I checked you can't control if you make an immediate payment or at the end of the billing cycle if it's an upgrade or a downgrade.
Whatever you select applies to all scenarios
My current setup is Prorate subscription updates and Invoice Immediately
Yeah, I think you're right. After looking at it a bit more, you would need to be able to specify when the next subscription starts (in the case of downgrading), and it doesn't look like you can do that with the Customer Portal
ok, I thought so. It would be amazing if you could add this as a feature in the Customer portal. I imagine many businesses have this use-case
thank you very much, to both of you for your help. I think I have enough information for now to continue my work ๐
I submitted the feedback to the product team on your behalf, as that makes perfect sense to me. I've had similar requests in the past from folks that wanted more out of the customer portal, so I can definitely see the demand