#andrewandyandy_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1215397410575228960
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Creating invoices with up front payment for the first invoice finalize immediately, that is expected
What are you trying to do? What's not working because of this?
We have a partner, PartnerStack that listens to invoice.payment_succeeded and they're looking at the invoice.metadata to know what type of product it is
I have code that updates the invoice when invoice.created event trigger but since it finalized instantly invoice.payment_succeeded gets trigger before my code finish updating the invoice
Are these $0 invoice or are they being paid by a payment method you already have on hand?
(otherwise i don't understand how the payment happens right away)
they being paid by a payment method already on hand
Gotcha
this is instant?
More or less, yes
So, a couple options
1/ You can put metadata on the subscription and the generated invoice will get a snapshot of that automatically, but its under subscription_details:
https://docs.stripe.com/api/invoices/object#invoice_object-subscription_details-metadata
This is likely impractical because you don't control the other integration to change where they look
2/ As a workaround, you can add a short trial period to the subscription using trial_end={a few minutes from now} this will create an initial free trial period then renew with the paid invoice and the async finalization you're looking for.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.