#gecko-Checkout-URL

1 messages · Page 1 of 1 (latest)

leaden locust
#

Hi there! Yes you want to use Webhooks! There are times where your customer may complete payment but not make it to your redirect URL (imagine they are on a train and enter a tunnel right as they hit "pay"), so you don't want to rely on the redirect for fulfillment/transaction data.

warped monolith
#

Ok so I could get a success URL returned, and the payment doesn’t actually succeed?

leaden locust
#

No, but you could have a successful payment and the success URL is never hit. That is why you want to rely on webhooks

warped monolith
#

ok

#

so....here's my next question

#

right now, I have an integration with checkout in my page. i create the session, and I have a bunch of customer info inside my page. this is all transaction-specific, which I can't send through the checkout session.

#

I will then get a webhook at some later time, which shows a successful payment.

#

but I can't link the two halves together....or rather, how is this done? is there a transaction ID from the session creation, that I can harvest, so I can match it up with the webhook later?

#

if not, how to do this???

leaden locust
#

That walks you through how to use webhooks with Stripe Checkout!

warped monolith
#

so that's all the webhook side for processing the transaction....which I can do, yes....but it's not my question.

leaden locust
#

Those webhooks will have all the data you want though, no?

warped monolith
#

let me try it differently. suzie goes to my site, and logs in as suzie. she orders a t-shirt. I create a checkout session. it redirects to stripe's site, and she fills out her personal info, makes payment etc.

leaden locust
#

Sorry, to be clear, you would fetch the PaymentIntent after to access your metadata

warped monolith
#

then I get a webhook, that shows a customer email, but I don't know if it's suzie or someone completely new, not in my DB yet

#

but I knew it was suzie, before redirecting her to stripe checkout.

leaden locust
#

Ah okay I see

#

Thanks for clarifying

warped monolith
#

the webhook doesn't tell me that this transaction completion is for suzie or someone else

leaden locust
#

So most people handle this by authenticating their customer ahead of the Checkout Session

#

So you would associate suzie with a Customer ID

warped monolith
#

i have a customer id

leaden locust
#

And authenticate them via a login

warped monolith
#

but....that ID doesn't go to stripe, and back through to the webhook

#

so you're saying I have to rely on email as the common thread between the front end and back end of the transaction? no other way?

leaden locust
#

No, you would set metadata to link them.

warped monolith
#

how

leaden locust
#

Definitely don't just rely on the email, as that can be duplicated

#

You can set metadata on any object you want -- in this case it sounds like you want to set metadata on the Customer object itself

#

So associate Suzie

warped monolith
#

how to create metadata that flows through?

#

I had asked about this originally many weeks ago was told I couldn't send data across stripe this way, because it could be compromised.

leaden locust
#

Yeah so these metadata attributes would not all flow through to the webhook. However, you would set them and then retrieve the relevant objects. Like the customer ID will show up associated with the Checkout Session and the PaymentIntent.

warped monolith
#

explain how this works please, or show me a reference?

leaden locust
#

Suzie logs in to your site and has cus_123 and you set metadata on your end as you wish. She wants to make a payment so you pass cus_123 to the Checkout Session creation. On this Session Creation you can also add metadata about the specific order. Payment succeeds. You get a webhook with the Session ID, the PaymentIntent ID, the Customer ID. You can then retrieve any of these objects to get further info or see the associated metadata.

warped monolith
#

fantastic....so ID's can flow through the payment process to the webhook

#

🤦🏻‍♂️

#

what/how do I attach this info, to a session creation?

leaden locust
#

Yes, sorry I didn't make that clear earlier!

warped monolith
#

this "customer", in the docs, I assume refers to the customer details that Stripe stores, not my business's customer ID...correct? (the way this part of the docs reads, it looks up the ID and if it finds it, then it's pre-populates payment info)

#

ahh....meta-data key-value pairs....this is the spot?

leaden locust
#

Yes

#

The Customer ID above is Stripe's customer ID

#

You want to use metadata to associate this customer to your own business's customer ID

#

So that you can track

warped monolith
#

ok so I see it's a key-value pair...is it the same style as line_items, and is an array of key/value objects? (meaning I can send an arbitrary number of array elements inside the array?) the documentation doesn't specify meta-data format in the description and isn't in the example code to the right either.

azure swallow