#trueicecold-invoice
1 messages ยท Page 1 of 1 (latest)
Hey ๐
I think I wasn't clear enough, I'd like to actually collect the payment using the API, if possible
you can listen to invoice.created event in the last billing cycle; you can modify the last invoice if you don't want it to send out. e.g. you can probably void it.
what custom logic you want to add?
I would like to run a limited stock purchase, where an invoice paid should go to check if there's stock left, and if there is - actually collect payment. If not - reject it.
problem is, when invoice is paid - it's game over basically...
I check for stock before sending the invoice, but up until the actual payment things might change...
and I'd rather not use stock reservation
are you creating stripe subscriptions or you are sending invoice using invoice API only?
Invoice has a status, you can always create a draft invoice, and only finalize and pay it after you confirm the stock
invoice api, getting the hosted url and letting people pay it
I do check for stock before sending the invoice, but by the time they paid, I might run out already
users can't pay a draft invoice, right? (no hosted url)
scenario is this:
- got 1 stock left
- 2 users request an invoice - I check for stock, which still exists, and send them both an invoice.
- user A pays for it, and then user B pays as well.
- I'm in trouble, since user A exhausted the stock already
I see, then yeah, you are basically double selling your stock since you don't want to reserve the stock when you send out the invoice. Maybe you can consider reserve the stock for limited time by setting the due time on the invoice?
due time on an invoice can't be paid afterwards?
or I need to capture the callback and void it?
Also, it's due_date and not time... so I guess I can't reserve it for 5 minutes or so?
correct
yup, for short due time, i guess you will have to keep track of your own