#emrys_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1255456423081545739
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
when i create a subscription i give it metadata
so that i can lookup my records when i need to
in subscriptions you don't need to look at PaymentIntents
instead it's recommended to look at the invoices and the invoice items
i tried that too
but invoice.created isn't complete and is missing the metadata
but invoice.paid has the data i need - however the paymentintent success is fired the same time
so my system cant determin that the payment was succesful as the invoice.paid hook hasn't updated the metadata on the payment intent yet
you need to ignore the PaymentIntents that have the invoice property not null
and cannot check my db with the required metadata
and move that logic to invoice.paid
ah.. i see
so paymentintnet.invoice == null means that its a one off payment?
and has no subscription associated
i need to handle the one off payments with payment intents succeeded and subscription payments with invoice.paid
more specifically a one-off payment that wasn't created by a one-off invoice
they cannot be handled by the same one..
correct
that's the better approach
i will try that
let me know if you need any more help
๐