#mikael2811_code

1 messages ¡ Page 1 of 1 (latest)

sand treeBOT
#

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

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

rich hare
#

Hello

hallow stirrup
#

Hi

rich hare
#

What Event are you listening for in your Webhook handler?

hallow stirrup
#

the payment completed one

#

or payment successful, i can't remember the name exactly

rich hare
#

So yeah try that and that is likely what you are looking for

hallow stirrup
#

ok. So if i send that data on the checkout session, and the user payes

#

that data will be send to my webhook, right ? with the other stuff from the json

rich hare
#

Yep

#

Recommend testing it out

hallow stirrup
#

Ok, lemme testing it out

#

$session = $stripe->checkout->sessions->create([
'payment_method_types' => ['card'],
'line_items' => [[
'price_data' => [
'currency' => 'usd',
'product_data' => [
'name' => 'T-shirt',
],
'unit_amount' => 2000,
],
'quantity' => 1,
]],
'mode' => 'payment',
'success_url' => 'https://yourdomain.com/success',
'cancel_url' => 'https://yourdomain.com/cancel',
'payment_intent_data' => [
'metadata' => [
'order_id' => '6735',
'customer_name' => 'John Doe',
],
],
]);

#

something like this, right ?

rich hare
#

Yep

hallow stirrup
#

ok, perfect, i'm gonna try it rn

rich hare
#

Okay yeah you can't set metadata on the Invoice

#

You want to listen for payment_intent.succeeded

hallow stirrup
#

ok, lemme try with this one then

#

so, right now this are the listeners

#

should i remove the invoice ones ?

rich hare
#

Yeah if you aren't going to handle that Event type in your handler code then you should remove it

hallow stirrup
#

Ok, so, now on the payment intent

#

i can see the metadata

#

i think i can find the invoice reference number on the payment_intent.succeeded, i think

#

because i need to create an invoice in our system based on that payment

#

so...

rich hare
#

When you receive the payment_intent.succeeded Event then you can retrieve the PaymentIntent and expand invoice

#

That will give you all the data for both the PaymentIntent and the Invoice

hallow stirrup
#

ok. I think i got it

#

just need to check out if the retrieve method will give me everything i need

#

Last question. Are these persistent ?

#

or they will be deleted from your server in the future ?

rich hare
#

Those links?

hallow stirrup
#

yep

rich hare
#

They are persistent

hallow stirrup
#

that's dope

#

thanks a lot man. You were a life saver