0

I'm using a client_reference_id URL parameter to pass my own session of the checkout to Stripe. I was hoping, Stripe can then pass that parameter value on to my success page, again as an URL parameter, however that doesn't seem to be possible. Only the Stripe Checkout Session ID seems to be possible by adding {CHECKOUT_SESSION_ID} to the confirmation URL.

I understand from the documentation, I will have to get the client_reference_id from the webhook json document that Stripe submits, which I can identify by the checkout_session_id, correct?

Or did I miss anything? Or is there even another way to keep this simple?

1
  • client_reference_id will not be returned as part of the query parameter in the URL your success page. The only way is to get through checkout.session.completed event.
    – yuting
    Commented Apr 29, 2024 at 0:34

1 Answer 1

1

What you want to do is possible with utm codes:
https://docs.stripe.com/payment-links/url-parameters

If you redirect your customer to a link like this:
https://buy.stripe.com/xxx?utm_campaign=123&client_reference_id=123
Then this will be your confirmation page (provided your payment link redirects to one):
example.com/confirmation?utm_campaign=123

The client_reference_id, however, is as you understood - it doesn't get injected to the confirmation query params - unless you hard-code it in the confirmation redirect, but that's not very helpful. You would get it from the checkout.session.completed event payload.

Not the answer you're looking for? Browse other questions tagged or ask your own question.