#gmgarrison_webhook-json
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/1235641976062349404
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
In the PaymentItent object, there's an "object" field with "payment_intent"
In the webhook event, most of the data is inside the "object" array
yes and it has the same shape
see https://docs.stripe.com/webhooks/quickstart it has an end to end example for all languages including how to access the underlying object from the Event's JSON
Checking that out
Well, that's more than I can read at this minute lol
But I'm looking at the stored JSON for the webhook event - it has a specific event ID that is obviously not a part of the PaymentIntent object
Yes the Event is an API resource: https://docs.stripe.com/api/events/object and it has a Retrieve API https://docs.stripe.com/api/events/retrieve with its own id evt_123
Is what you're trying to say that the event's data->object is the same thing as the Payment Intent object?
yes
Okay... so if I'm accessing the event data, I have to go through that event "object" but if I've got the Payment Intent object, I'm already inside of it
I think that makes sense
One follow-up question
sure thing!
If I get a pending payment and store the webhook event JSON, can I use the same Payment Intent ID to check and tell me whether the payment intent succeeds?
I know I'll get another webhook event, but I'm just trying to understand the relationship
Still there?
you too!
I've got one more question (not directly related) ๐
When I use the PaymentIntent API to create a PI, how do I get the ID of the PI I just created?
I'm in PHP and my code looks like this:
PaymentIntent::create([
'amount' => $this->amount * 100,
'currency' => 'usd',
'customer' => $method->user->stripe_id,
'payment_method' => $method->payment_method_id,
'payment_method_types' => ['card', 'us_bank_account'],
'return_url' => route('thankyou'),
'off_session' => true,
'confirm' => true,
'receipt_email' => $method->user->email,
'metadata' => [
'payment_id' => $this->id,
'amount' => $this->amount,
],
]);
you need to store the response of that call (all our calls really) in a variable: $paymentIntent = PaymentIntent::create([ .... ]); and then you can do $paymentIntent->id or $paymentIntent->amount, etc.