#trueicecold-invoice

1 messages ยท Page 1 of 1 (latest)

tall arrow
timid quarry
#

Hey ๐Ÿ™‚

#

I think I wasn't clear enough, I'd like to actually collect the payment using the API, if possible

tall arrow
#

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?

timid quarry
#

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

tall arrow
#

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

timid quarry
#

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:

  1. got 1 stock left
  2. 2 users request an invoice - I check for stock, which still exists, and send them both an invoice.
  3. user A pays for it, and then user B pays as well.
  4. I'm in trouble, since user A exhausted the stock already
tall arrow
#

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?

timid quarry
#

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?

tall arrow
#

yup, for short due time, i guess you will have to keep track of your own

timid quarry
#

so manage the timestamp of the invoice generation myself, and track every X seconds to see if I should void it or not...

#

was hoping to avoid all that ๐Ÿ™‚

#

Thanks a lot for the help! ๐Ÿ™‚