2

I'm implementing Stripe checkout on a website and I want to pass some specific data on checkout.session.complete. Here is what I tried:

'mode' => 'payment', 'payment_intent_data' => [ 'metadata' => [ 'eventId' => $eventId, ], ], 

But I don't receive those datas in my webhook. What am I doing wrong ?

1 Answer 1

4

payment_intent_data gets added to the resulting PaymentIntent object, not the Checkout\Session object. It won't be present in the checkout.session.complete webhook data you're sent.

(The PaymentIntent's ID will be, so if you like, you could request that object's data as part of your webhook processing. You could also collect the payment_intent.created webhook type, but you'd have to correlate it after the fact with the session.)

The easier approach here is probably setting a client_reference_id on the Checkout Session. This ID is passed back via the webhook, and can be any arbitrary string you like - it could be a session or cache key that let you look up the metadata you're looking for.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your help ! I will try to find the PaymentIntent id because I'm already using client_reference_id to send the userId
@ThomasCoumes Sounds good. I haven't run into a character limit on client_reference_id yet - you might consider trying to put JSON in there as an even simpler potential approach.
that's clever ! I will probably do that, thank you !

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.