#nachofranco14
1 messages · Page 1 of 1 (latest)
Hello, can you tell me more about what you are trying to do here? Like schedule a refund or something different?
exactly, that's what I want to do
let's say, I have a subscription running that part of the amount of the last month was wrongly charged by mistake, I want to refund the customer but not now, as part of the next invoice/deduction
Gotcha. Unfortunately we don't have a way to do that directly, our refunds happen as soon as you make the API call.
One thing that may help is that you can give the user customer credit, that will deduct from the next invoice amount, if it goes over that amount it will give the customer a balance that could be your signal to refund some of a previous payment https://stripe.com/docs/billing/customer/balance
That being said, that wouldn't connect the credit to any specific previous payment so you would want to record in some way what payment to refund
Otherwise you could just record what payment to refund and what amount and just check that when you get the next webhook event about the user's next invoice being created
hmm I see
could you explain a bit more how to make it work with the webhook? I'm currently making some updates in the invoice.created, so maybe I could add it there
That could be pretty simple actually, you would just need the ID of the payment intent that you want to refund and the amount stored somewhere. Then the invoice.created event would be a signal that it is the next billing cycle and you could make the refund call on that payment intent for that amount
I see
but there's no way to show it as part of the same invoice, e.g. having it described as another invoice line, right?
Unfortunately I am not thinking of an easy way to do that. I don't think you can have negative invoice items, customer credit would show up but wouldn't have a custom name and would immediately apply to the invoice's amount which I am guessing would not be desired if you are trying to just send funds back to the user.