#abrams_tank.checkout-webhook

1 messages · Page 1 of 1 (latest)

blazing iris
#

Hey! How are you passing the 'custom data'?

tough trellis
#

Hi. I am trying to pass the Order ID and get it back from Stripe when the customer completes the purchase successfully. I tried the metadata parameter is the Session object (the root metadata parameter). But I didn't get the Order ID back when I was listening to payment_intent.succeeded. I also tried the client_reference_id of the Session object. I didn't get the Order ID back either when I was listening to payment_intent.succeeded.

#

So it seems that metadata and client_reference_id are not passed back whenI am listening to payment_intent.succeeded.

#

But payment_intent.succeeded is the event I should listen to in the webhook, right? It's the event that signifies when the customer completes the purchase successfully and has paid for the purchase, right?

blazing iris
#

Yep, you're passing metadata when creating the Checkout Session object so those fields exist on that object (not the Payment Intent)

#

You have 2 options:

  • Listen for the checkout.session.completed event.
  • Store the metadata on the Payment Intent when you create the Checkout Session (via payment_intent_data).
tough trellis
blazing iris
tough trellis
#

Ok, about the checkout.session.completed event, does this also signify that the customer has successfully paid for the purchase at Stripe's website? Would there be cases where the customer has not successfully paid for the purchase yet, but checkout.session.completed is still triggered?

blazing iris
#

Nope, that denotes a payment was successful (and payment_intent.succeeded will also be sent simultaneously)

tough trellis
#

Ok, so both checkout.session.completed and payment_intent.succeeded signify that the customer has successfully completed the purchase and paid for the product. If the customer has not successfully paid for the product, neither checkout.session.completed or payment_intent.succeeded will be sent (I ask this because there are cases in PayPal where the customer completes the checkout but the payment is not successful immediately and PayPal will contact my webserver several days later when the payment is successful, such as e-checks, etc).

blazing iris
#

Yep, delayed payment methods like that would still trigger checkout.session.completed event

tough trellis
#

Ok, it seems like payment_intent.succeeded is the event I want to listen to. I only want to receive a notification from Stripe when the product has been successfully paid for. If the payment is delayed, checkout.session.completed is not very useful for me.

blazing iris
#

Got it!

#

In that case use the payment_intent_data.metadata parameter when creating the Checkout Session

#

And it'll be there in your payment_intent.succeeded event payload

tough trellis
#

Hi. I just tried to create a payment_intent_data on the fly when creating a Session object with a CURL call in .Net 4.0. So everything works for me if I don't include the new payment_intent_data segment when creating the Session object. But when I try to create the Session object and also create the payment_intent_data on the fly, I get "The remote server returned an error: (400) Bad Request." Unfortunately, the Stripe API always gives me the vague "(400) Bad Request" message and doesn't tell me exactly where the problem is.

blazing iris
#

Can you share the request ID?

tough trellis
#

I tried adding the following 3 different strings when I create the Session object:

#
  1. &payment_intent_data[][metadata][0]=123456
#
  1. &payment_intent_data[0][metadata][0]=123456
#
  1. &payment_intent_data[][metadata][]=123456
#

All 3 failed.

#

How do I share the request ID with you?

short perch
#

Unfortunately, the Stripe API always gives me the vague "(400) Bad Request" message and doesn't tell me exactly where the problem is.
there are full logs at https://dashboard.stripe.com/test/logs that would help

short perch
#

but yeah all your examples are wrong, it would be &payment_intent_data[][metadata][key]=value

tough trellis
#

It still didn't work

#

I don't replace [key] with 0, right? I just left it as [key]

#

i can send you the request ID

short perch
#

I never use curl, I'd use our official library for .NET, so maybe I got it wrong

#

why aren't you using the library again?

#

but sure, send the ID please!

tough trellis
#

But anyways, let me send you the ID. I almost have everything working with CURL, this is the last step

short perch
#

are you sure you want to run a server accepting payments and collecting data from customers on a deprecated stack like that?

tough trellis
#

@short perch It works fine for PayPal. Everything is working smooth at the moment. I may upgrade later, but not now.

tough trellis
short perch
#

ah you have an extra array

#

it's just &payment_intent_data[metadata][key]=value