#gmgarrison_webhook-json

1 messages ยท Page 1 of 1 (latest)

glossy flowerBOT
#

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

shy glacier
#

The format is identical for both

#

gmgarrison_webhook-json

late flame
#

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

shy glacier
#

yes and it has the same shape

late flame
#

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

shy glacier
late flame
#

Is what you're trying to say that the event's data->object is the same thing as the Payment Intent object?

shy glacier
#

yes

late flame
#

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

shy glacier
#

sure thing!

late flame
#

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?

shy glacier
#

yep sorry I thought you were just testing

#

so yes you can!

late flame
#

okay, I think I'm in good shape then

#

Thanks for your help and have a great day!

shy glacier
#

you too!

late flame
#

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,
],
]);

shy glacier
#

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.

late flame
#

Okay, super easy

#

Thanks again