#matih_webhooks
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/1400781873487151114
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- matih_best-practices, 18 hours ago, 16 messages
- matih_webhooks, 1 day ago, 22 messages
- matih_best-practices, 3 days ago, 55 messages
The issues I'm facing is that we rely on checkout.session.create in order to send the end-user to Stripe to finalize their payment.
- checkout.session.create doesn't return
payment_intent(it'snull) - when I complete the payment, a number of webhooks are sent;
charge.succeededandcheckout.session.completed- they both contain the samepayment_intent.id. However, only the former contains the much covetedreceipt_url
However, there's no guarantee that checkout.session.completed will arrive before charge.succeeded is there?
However, there's no guarantee that checkout.session.completed will arrive before charge.succeeded is there?
no, but what you can do is retrieve the PaymentIntent oncheckout.session.completedand see the receipt_url on it
or listen to payment_intent.succeeded as well and get the value from there
Oh, so I'd need to do another API-call?
yes that's correct
But this is exactly what I'm saying isn't working
However, there's no guarantee that checkout.session.completed will arrive before charge.succeeded is there?
I have no idea what the PI is when I create the session
After the payment is completed, a number of webhooks are fired, and I can't be 100% sure in which order they're received
So I would need to know when I create the session, for which PI to look for
we always recommend not using the data object you receive but rather fetch the latest value from the API
then what's the point of the webhook data object if they're not to be relied on?
it's meant to be a snapshot in time
we reimagined our events for v2 where we no longer send the data through the event
but this won't apply to v1 events
if either the charge.succeded or payment_intent.succeeded contained the id of the originating checkout.session, then it would be gucci
we call them thin events https://docs.stripe.com/api/v2/core/events/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
now they're disconnected from each other, which doesn't make sense
you can retrieve the checkout session of a PI
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
if you check event evt_3Rr3nRAZXatHl2PM1vJHvnSf i see no information about the checkout session, or am i mistaken?
when i started this checkout.session (cs_test_b16NTIi4lub1oON4TwgKEexlhTH0lZ2tF4TDCLXoI8aYeUqCGNAl3DbO9K) there is no PI information
in both cases you need to make an API call
i can't rely on the fact that checkout.session.complete will arrive before payment_intent.succeeded, can i?
in the checkout.session.completed you need to retrieve the PI to get the PI information, and in the payment_intent.succeeded you need to list the Checkout Sessions and filter by PI to get the information about the Checkout Session
no, we don't guarantee event order
and in the payment_intent.succeeded you need to list the Checkout Sessions and filter by PI to get the information about the Checkout Session
how do i do this?
This is the webhook message from payment_intent.succeeded
you just do an API call to https://docs.stripe.com/api/checkout/sessions/list#list_checkout_sessions-payment_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and pass the PaymentIntent ID from the event
I'll just do another API call when I receive the session.checkout.completed
as you wish
there will have to be another api call, either way i try to slice this
thank you for your help!
let me know if you need any more help
hello again, you said that i should retrieve the PI and see the receipt_url, but when I read through https://docs.stripe.com/api/payment_intents/object i don't see any reference to it
you can see it on the event https://dashboard.stripe.com/test/events/evt_3Rr3nRAZXatHl2PM1vJHvnSf
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
sorry it's on the charge object
not the PI
ok, so how do i find the charge object from the session.checkout?
so when you retrieve the PaymentIntent you can add expand: ["latest_charge"]
$ stripe events resend evt_3Rr3nRAZXatHl2PM1vJHvnSf --expand ['latest_charge'] --account=acct_1RqBXKAZXatHl2PM
{
"error": {
"message": "This property cannot be expanded ([latest_charge]).",
"type": "invalid_request_error"
}
}
is the CLI broken, or should i attempt this from the python interpreter instead?