#cavint9510
1 messages · Page 1 of 1 (latest)
👋 happy to help
hey
if there's a PM attached to it then yes it should
yep, a PM attached to it.but i only received invoice.finalized
i am not received invoice.paid.it's confuse me.
if there's a pending webhook event
then i search paymentIntent , it is status is requires_confirmation
sure,wait moment
sub_1NWEtsCrULKoEJygyC6FwnER
the invoice status is open
i received invoid.finalized
taking a look
ok
yes as I explained, since Stripe didn't receive a HTTP 200 from your webhook upon sending the invoice.finalized event
the invoice will be paid in the next 72hrs
you have multiple endpoints: https://gateway-pre.boolv.tech/api/ace/stripe/webhooks this one didn't work
ok,let me check
And if there is a free trial subscription,whether I also want to confirm invoice.finalized?
yes regardless
Hi! I'm taking over this thread.
Can you try to summarize your question while I catchup?
ok
When I created a subscription. If the subscription is not a trial subscription, I must successfully receive finalized events before I attempt to pay. If it is a trial subscription, direct payment is successful.
Is that right?
How are you creating the Subscription? With Checkout Session, the subscription endpoint directly, something else?
I must successfully receive finalized events before I attempt to pay
Which events are you talking about?
You will get invoice.finalized as soon as the subscription is created, and then when the user submit their payment details, you'll get invoice.paid. If there's a free trial, you will also get invoice.paid immediately when creating the subscription.
But what exactly are you trying to do?
In fact, I want to attach some metadata to the invoice when I create the subscription. So that I can receive the invoice and pay for processing.
I originally intended to bind this part of data when the data was finalized, and then receive the invoice.paid
You can either use invoice.created, invoice.finalized, or invoice.paid depending on exactly what you want to do.
If it's only for the first invoice, you could listen to customer.subscription.created, and check the latest_invoice property of the subscription.
if i received customer.subscription.created,i send 500 status code to stripe.So this subscription won't try to pay?
I need a place to block subsequent payments
That's not how it works.
If you return a 500 status, the subscription is still created normally. It's just that Stripe will try to re-send your the webhook event.
Again, I still don't understand exactly what you are trying to do. Can you give a concrete example of the issue?
At an extreme, the invoice is paid as soon as I create the subscription.
Then I cannot process the event of invoice.paid monitored by me, because it cannot be associated with my local order
At an extreme, the invoice is paid as soon as I create the subscription.
You mean when you use a free trial?
yep
And you don't want the invoice to be paid immediately in this case?
Yes, unless there's a way for me to bind some metadata to the invoice while creating the trial subscription
And you have to add the metadata to the invoice before it's being paid?
yes
Hum... I don't think that's possible. But let me think about a workaround.
Btu first, can you clarify why you need all of this? Why adding metadata after the invoice is paid doesn't work for you?
Or rather, except that way. What do your clients usually do?
When I create a trial subscription, how do I associate it with a local order?
I need the invoice to be linked to my local order so that when the invoice.paid event comes in, I can handle it correctly
The same goes for change subscriptions
When I create a trial subscription, how do I associate it with a local order?
You can add the metadata to the subscription itself. Then when you receive theinvoice.paidevent, check the corresponding subscription which will have the metadata.
So, usually they bind metadata to the subscription?
That's weird. Shouldn't it be on the invoice?
Because creating subscriptions and modifying subscriptions will generate invoices, so many order ids must be bound to the subscription?
I don't know how other people do this. I'm just trying to find a solution that works for your need.
For Subscription with a free trial, you will get invoice.paid immediately, and it won't contain any metadata. So one workaround for this specific case if to store the metadata on the subscription.
For next invoices you can always set the metadata on the invoice when you get the invoice.created or invoice.finalized event.
emm,about update subscription,how can i do?That also trigger invoice.paid immediately.
Same idea: store the metadata on the subscription itself.
Happy to help 🙂