#Jayy
1 messages ยท Page 1 of 1 (latest)
Hi! Could you please summarise the context?
Hi Vanya.
What i want to achieve is when a customer purchases an addon during their billing cycle, i wanna charge the full amount, calculate how much the prorated amount was, deduct it from the full amount and credit it to the user on his next invoice
I asked yesterday about what method can i use to do that as before here is how i charged the customer:
but that charged him the partial amount. not the full amount
Why would you deduct the prorated amount if the customer purchases an addon?
Wouldn't it increase the total amount?
The main reasoning for the customer as to not go with this approach is what if the customer is purchasing an addon that is $5 at the end of the billing cycle (let's say 5 days before his billing cycle is reached)
that would mean we charge him only 83cents. taking it instantly from his account will mean that stripe will take $0.30 + the fees which then wouldn't be feasible
so they asked if we can charge the full amount. then on credit them the days they haven't used on their billing cycle
so i'm struggling to find a not so complicated way to achieve that
I understand. You might need to add a custom Invoice Item to the upcoming Invoice. You will have to calculate the proration by yourself then.
could you clarify more about the custom invoice point please? i have no issue calculating the prorations ๐
When your billing cycle is coming to end, a draft Invoice will be created (you will get invoice.created event: https://stripe.com/docs/api/events/types#event_types-invoice.created).
And you can add custom Invoice Items to that Invoice while it's in draft state. You can create an Invoice Item with a prorated amount: https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-amount
alright thank you
Happy to help. Please, let me know if you have any other questions.
what api should i use for giving a customer credit on his next invoice?
the credit_notes ?
It depends, credit notes applies to 1 invoice, but you can also use Customer Credit Balance: https://stripe.com/docs/billing/customer/balance
Alright thank you again for your help Vanya ๐ much appreciated!
Happy to help. Please, let me know if you have any other questions.