#Crabby

1 messages · Page 1 of 1 (latest)

mild oak
#

👋 happy to help

lament cape
#

hmm, I think either works really(using an Invoice or using a PaymentIntent directly), and they both have the same problem(creating duplicates) if you don't implement it in such a way to record things in your database to avoid it.

However, if the invoice goes past it's due date, the hosted link will become invalid.
then maybe Invoices are not a good fit, I suppose it really depends how you want to handle the case of the customer not paying and how much time to give them

@north phoenix

north phoenix
#

I see, another thing i thought about was listing for an invoice expiry webhook event and then removing the hosted page link from the database so a new one could take it's place. I was doing some research but couldn't find the specific event that's fired for this. Is there one?

lament cape
#

I think it generates an invoice.payment_failed event since the invoice has not been paid within the due date

#

but really you can just check directly, the user visits your page to ask to pay, you check if now > invoice.due_date and if it is, then you know you need to generate a new invoice and redirect them to that ones's hosted_invoice_url instead of the existing one

#

or just create a new invoice every time, there's no direct problem with having multiple invoices for the same customer that end up unpaid, depends on your requirements/tolerances