#matih_webhooks

1 messages ยท Page 1 of 1 (latest)

warm onyxBOT
#

๐Ÿ‘‹ 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.

patent birch
#

๐Ÿ‘‹ happy to help

#

will be with you shortly

orchid spruce
#

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.

  1. checkout.session.create doesn't return payment_intent (it's null)
  2. when I complete the payment, a number of webhooks are sent; charge.succeeded and checkout.session.completed - they both contain the same payment_intent.id. However, only the former contains the much coveted receipt_url

However, there's no guarantee that checkout.session.completed will arrive before charge.succeeded is there?

patent birch
#

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 on checkout.session.completed and see the receipt_url on it

#

or listen to payment_intent.succeeded as well and get the value from there

orchid spruce
#

Oh, so I'd need to do another API-call?

patent birch
orchid spruce
#

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

patent birch
#

we always recommend not using the data object you receive but rather fetch the latest value from the API

orchid spruce
#

then what's the point of the webhook data object if they're not to be relied on?

patent birch
#

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

orchid spruce
#

if either the charge.succeded or payment_intent.succeeded contained the id of the originating checkout.session, then it would be gucci

patent birch
orchid spruce
#

now they're disconnected from each other, which doesn't make sense

patent birch
orchid spruce
#

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

patent birch
#

in both cases you need to make an API call

orchid spruce
#

i can't rely on the fact that checkout.session.complete will arrive before payment_intent.succeeded, can i?

patent birch
#

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

patent birch
orchid spruce
#

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?

patent birch
#

and pass the PaymentIntent ID from the event

orchid spruce
#

I'll just do another API call when I receive the session.checkout.completed

patent birch
#

as you wish

orchid spruce
#

there will have to be another api call, either way i try to slice this

#

thank you for your help!

patent birch
#

let me know if you need any more help

orchid spruce
patent birch
#

sorry it's on the charge object

#

not the PI

orchid spruce
#

ok, so how do i find the charge object from the session.checkout?

patent birch
#

so when you retrieve the PaymentIntent you can add expand: ["latest_charge"]

orchid spruce
#
$ 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?

patent birch
#

no the expand is not on the event resend

#

it's when you retrieve the PI

#

on the API call