#jamesedwards-change-price

1 messages ยท Page 1 of 1 (latest)

vale pivot
#

hey there! your goal is to refund the customer?

raven hedge
#

the customer should not have a credit balance after cancelling their subscription

I can provide a test customer to view if that is something that you can also see

#

after refunding the credit balance does not change to reflect

vale pivot
#

but if you want to refund, that is a bit different

raven hedge
#

yes but then the customer is billed for time they did not use

#

i want the money to return to their card, rather than being applied as a customer credit balance

the issue isn't the cancellation... the invoice generated as a result of the downgrade from plan 2 to plan 1 generates a customer credit balance

#

this credit balance is then unaffected by the cancellation and if I select to refund the charges the credit balance remains.

#

customers can cancel their plan, and I would rather not have to manually refund the charges less the accrued credit balance within the dashboard

#

regardless of whether a refund should alter the credit balance (which is should and doesn't) - is there a way to prevent the credit balance from being applied to the customer account and always return it to their card?

vale pivot
#

so you can either use prorate=false to avoid that balance, and issue the refund for any amount you like

#

or you can allow the credit as a convenient calculation, then refund the charge on the lat paid invoice

raven hedge
#

can this be done through the api

vale pivot
#

in either case you'll need to create a refund for the charge of the last paid invoice (or more than 1 invoice)

#

yes, but multiple requests

#

its a single request you can make

#

is the credited amount the amount you want to refund?

#

or do you want to refund the full charge of that invoice?

raven hedge
#

upon cancellation yes the credit balance should no longer exist

#

the customer money is stuck in stripe otherwise

#

so if set prorate=false and then i have to listen for subscription cancellation events, but if they do not cancel I also have to listen for subscription update events

vale pivot
raven hedge
#

multiple invoice would need to be refunded in the sample scenario i describe earlier

vale pivot
raven hedge
#

changing the plan without cancellation also results in credit balance applied to the account

#

i understand that if i do not prorate this will not occur, but then i am asking on how to give the customer money back as a prorated amount for the unused time

#

basically i never want a credit balance to exists

#

can i give you a customer id to show this scenario?

vale pivot
#

sure - lets take a look at an example

raven hedge
#

thanks

#

here is a customer where no refund has been applied yet cus_KEVumNCgE96coT

#

they have a credit balance and as the remaining invoices finalize they will be added to the credit balance

#

here is a different customer where the same steps have been applied and a refund of one charge has been carried out cus_KELHA6lHoQmcJy

#

the credit balance for customer cus_KELHA6lHoQmcJy did not change as a result of the refund

vale pivot
#

yes, thats expected, the credit is entirely separate

raven hedge
#

so there are multiple things in these scenarios, but if no credit balance is ever applied they would be resolved

vale pivot
raven hedge
#

i want the customer to get their money back

#

by never having a credit balance applied

vale pivot
#

yes, thats what the refund is for. i'm trying to explain these are separate.

#

they paid you for some period on an invoice, then downgraded, with default behaviour this is prorated and they get a credit balance for future invoices

raven hedge
#

does it seem like them being separate can lead to confusion? say i refund the charges but never adjust the customer credit balance

vale pivot
#

presumaly the downgrade invoice was for $0 after the credit was applied

raven hedge
#

the customer would get free money

vale pivot
#

well if you refund to cover the amount "you owe them" from the balance, then yes you should adjust the balance accordingly

raven hedge
#

however the main issue is that the customer money is stuck in credit balance and i have to go into dashboard to refund - is there a way to prevent credit balance from occurring during subscription cancel while also giving the refund of the prorated amount through the api?

vale pivot
#

this works fine without the cancelation, because that balance just reduces future invoice amounts

raven hedge
vale pivot
#

its only messy because of the cancellation, which is a scenario you need to handle carefully according to your policies

raven hedge
#

right so through the api, how can i handle this scenario i am outlining

"is there a way to prevent credit balance from occurring during subscription cancel while also giving the refund of the prorated amount through the api?"

vale pivot
#

maybe! but some other business might prefer it the other way, never refunding

#

the issue is that the credit is coming form the downgrade, not the cancellation

#

so you cant, really

#

right? in your flow the credit i expect to appear after the downgrade, before the cancellation

raven hedge
#

yes

#

regardless of cancellation the amount of unused time at point of downgrade is applied as a credit balance

#

i was hoping there was a parameter i missed to issue that automatically as refund back to the customer card

#

(also i have been talking to support and you are the first person to understand the scenario to this extent. I really appreciate your help so far!)

#

also just to clarify, when the "downgrade" occurs i have tried both the update api and also using the delete and create api - neither of which prevent the credit balance from being applied

vale pivot
#

heh, quite welcome, and appreciate your patience here while i mentally juggle multiple complex questions ๐Ÿ™‚

raven hedge
#

yes i understand there are thousands asking for help, i do hope that in time an approach to handle this can be determined

vale pivot
#

you can disable prorations during the downgrade to avoid the credit being applied, but normally you wouldnt want this (for a continuing customer who did in fact pay you)

#

so this why you need to manage those refunds explicitly - its a very sensitive thing for a business to release funds back to a customer

raven hedge
#

so what do you suggest?

vale pivot
#

you'll need to create refunds for any invoice charges as appropriate for your agreement and policy with the customer

#

and then clear the balance if you've refunded money, that makes sense

raven hedge
#

i see

#

do most people not use proration?

#

im just imaging this scenario but spread out over more time

#

in which case it might be difficult to determine the amount to refund

#

and unfortunately requires logging into the dashboard, which i think would mean watching the subscription cancelled event and having that notify me in some way to do this manual process

Unless this can be handled trhough the api?

vale pivot
#

what part requires logging in? all of this can be done via API

raven hedge
#

ok that is good

#

how would it be checked with the api that all customer invoices are paid after they cancel their subscription?

at the point which all invoices are paid (and the subscription is cancelled) does it make sense to check with api for a customer credit balance, and if one exists to use the refund api to refund exactly that amount? (i see the refund api must relate to a charge so i am confused by this)

#

or would it need to be on each invoice finalized event that occurs with the subscription cancelled

vale pivot
#

ah yea this is a bit of a pointy edge case -- you need to check the invoice status explicitly if you suspect they might be unpaid

raven hedge
#

im not sure what you mean by that but it is quite pointy yes

vale pivot
#

its helpful to separate the invoice payments form the subscription status -- the subscription continues even if invoices are unpaid, unless you configure settings to behave otherwise

#

so if you arents cancelling after payment failures say, you might have unpaid invoices, including those downgraded credit ones

raven hedge
#

yeah how do i link the downgrade credit invoice to the charge id for the refund

vale pivot
#

its actually better to check this at the time of downgrade: look at the latest invoice on the subscription and if its not paid, disable proration for the downgrade

raven hedge
#

so the customer.subscription.updated event?

#

i do want to prorate the amount

#

im not really following the exmple you are providing

vale pivot
#

if thats not paid, you most likely want to disable prorations for the downgrade

raven hedge
#

the latest invoice would be paid if they are downgrading with an active subscription

vale pivot
#

ok so assuming all paid up and the scenario we started with, then you just want to go get those charges and refund them

raven hedge
#

right but if they waited some time i need to find out the prorated amount

vale pivot
raven hedge
#

and that wont be applied to the customer balance until the negative invoice is finalized

(not negative but the invoice generating the credit balance)

vale pivot
#

they'll be mot recent first, so if you want to refund charges going back 2 invoices, you could make that request with limit=2 then refund the charge/payment intent for each

raven hedge
#

how would i determine the amount to refund

vale pivot
#

not sure what you mean by that the invoices finalized, theyd all be finalized already

raven hedge
#

the invoices that result in a credit balance being applied take atleast one hour to be paid

vale pivot
#

you would decide the amount based on the timstamps etc - thats really up to you

raven hedge
#

im sorry if im using the wrong term

#

so you are saying i have to calculate the proration?

vale pivot
#

ok sure, if this all happens in close succession there may be weird states, so you may want to said until those pay before handling any of this

#

its a tricky edge cases, and you'll need ot test extensively if this is a common flow for you

raven hedge
#

yeah the customer.subsription.updated event will occur before the credit balance is applied as a result of the invoice moving to paid which holds the credit balance

vale pivot
#

proration for credits no, but choosing the refund amount yes

raven hedge
#

is there an invoice.paid event?

#

i guess payment succeeded would work

#

would it make sense to listen for that event and if the invoice amount is zero and there is a customer credit balance to then generate a refund of the latest charge for the credit balance?

vale pivot
#

invoice.paid yes, that one is usually better

raven hedge
#

ok

#

i think that might work for me

#

does the customer balance update at the same time as invoice.paid

vale pivot
#

i think so - the amount due would be reduce by any available balance, then payment taken for whats left

#

during the downgrade im not certain, so i'd suggest testing

raven hedge
#

in a scenario where the invoice generates teh credit baalnce

#

im not observing the customer credit balanece update immediately

#

on subscription change, only after invoice is paid

vale pivot
#

editted above, i am not sure on that part

raven hedge
#

ok np

#

i feel like this might be common scenario for anyone with multiple subscription plans - can you point me to any other resources where i might find out how others resolved this?

vale pivot
raven hedge
#

amazing

#

thank you

vale pivot
#

np!

raven hedge
#

can the refund amount be greater than the invoice amount?

vale pivot
#

no, you can only refund up to the amount of a given charge

raven hedge
#

ah ok

#

many points

#

i will look more into this example you provided since it is very close to what i am hoping to do

#

thanks again and have a great day!

vale pivot
#

you too! you're welcome ๐Ÿ™‚