#cavint9510

1 messages · Page 1 of 1 (latest)

ebon kiteBOT
sinful tundra
#

👋 happy to help

proud prism
#

hey

sinful tundra
#

if there's a PM attached to it then yes it should

proud prism
#

yep, a PM attached to it.but i only received invoice.finalized

sinful tundra
#

if there's a pending webhook event

proud prism
#

then i search paymentIntent , it is status is requires_confirmation

sinful tundra
#

then it can take up to 72hours

#

would you mind sharing the subscription ID?

proud prism
#

sure,wait moment

#

sub_1NWEtsCrULKoEJygyC6FwnER

#

the invoice status is open

#

i received invoid.finalized

sinful tundra
#

taking a look

proud prism
#

ok

sinful tundra
#

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

proud prism
#

i send to stripe 200

sinful tundra
proud prism
#

ok,let me check

#

And if there is a free trial subscription,whether I also want to confirm invoice.finalized?

sinful tundra
#

yes regardless

proud prism
#

emmm

#

i did a test,when finalized cominng,i throw a exception

#

but paid came

ebon kiteBOT
proud prism
#

when i update subscription,it is immediately paid too

#

emmm

mental vector
#

Hi! I'm taking over this thread.

#

Can you try to summarize your question while I catchup?

proud prism
#

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?

mental vector
#

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?

proud prism
#

payment element+create subscription

#

invoice.finalized and invoice.paid

mental vector
#

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?

proud prism
#

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

mental vector
#

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.

proud prism
#

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

mental vector
#

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?

proud prism
#

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

mental vector
#

At an extreme, the invoice is paid as soon as I create the subscription.
You mean when you use a free trial?

proud prism
#

yep

mental vector
#

And you don't want the invoice to be paid immediately in this case?

proud prism
#

Yes, unless there's a way for me to bind some metadata to the invoice while creating the trial subscription

mental vector
#

And you have to add the metadata to the invoice before it's being paid?

proud prism
#

yes

mental vector
#

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?

proud prism
#

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

mental vector
#

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 the invoice.paid event, check the corresponding subscription which will have the metadata.

proud prism
#

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?

mental vector
#

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.

proud prism
#

emm,about update subscription,how can i do?That also trigger invoice.paid immediately.

mental vector
#

Same idea: store the metadata on the subscription itself.

proud prism
#

fine,i got it

#

thanks bro

mental vector
#

Happy to help 🙂