#discorrduser_best-practices

1 messages ¡ Page 1 of 1 (latest)

oblique runeBOT
#

👋 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/1222978177207631984

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

south steppeBOT
copper wraith
#

The invoice.paid event would be sent when payment is actually successful so if that's when you're getting it that's when you know whether the payment is successful or not.

#

How are you creating your subscriptions? Is it through checkout? schedules? something else?

untold anchor
#

It's checkout

#

And I see the other platforms handles this in around 20 seconds.

#

Like OpenAI, and many more services does this really almost instantly

copper wraith
#

Do you have an example checkouut session I can take a look at?

untold anchor
#

Do you want a screenshot?

#

or code?

#

It's stripe checkout page

#

Something like this

copper wraith
#

The Checiout Session ID - like cs_test_123

untold anchor
#

where should I get that? Sorry, I'm still not getting you

oblique runeBOT
copper wraith
#

Really I'm just trying to look at an Invoice or Subscription where you're seeing the 1 hour delay in getting the invoice.paid because I wouldn't expect that to happen

#

You should be able to find an invoice/sub ID in the dashboard

untold anchor
#

Hmm. So I meant actually, that event is triggered almost instantly

copper wraith
#

If you don't want to rely on invoice.paid you could instead use checkout.session.completed to know that the checokut session was paid for

untold anchor
#

But the status is updated to "paid" after "draft" in around 1 hours later

copper wraith
#

Is this for the invoice right after the checkoutu session is paid for? Or is this for a renewal invoice?

untold anchor
#

Above is for the subscription, the renewal invoices

#

So this was the story I was struggling.

#

I used "customer.subscription.updated" to know if the customer made updates on their subscription (renewal or new subscription)

#

And checked the latest_invoice paid stautus to know if they made actual payment

#

But in most cases of renewal, it was 1 hour later after "subscription.updated" event triggered

copper wraith
#

Ah, if you're talking about the renewal invoices then this is expected - when a renewal happens we first create the invoice in draft, wait an hour, and then automatically finalize it and attempt payment.

untold anchor
#

Yes. But now, I'm talking about new payment

#

"invoice.paid" event is instant enough?

sinful edge
#

What do you mean by "new payment" here?

#

(stepping in for karbi who needs to step away)

untold anchor
#

New payment means, the fresh new payment on our platform.

#

It's not subscription update or something.

#

It's just putting card numbers and CVV on this page

#

this.

#

What event should I listen or what's the approach to know if the payment of this user actually successful

sinful edge
#

The same event, invoice.paid , should also work, there is no 1hr draft delay for the first invoice of a new subscription

untold anchor
#

okay. good

sinful edge
#

You could also use checkout.session.completed and then check the subscription's latest invoice

#

either way works

untold anchor
#

Thanks

#

Thank you for your clarifying @sinful edge , @copper wraith
Have a good day.