Is it possible to pass custom data to stripe checkout?
Edit: metadata
now does exist on the Session object. Although you will probably need to be on a more recent API version to be able to set it.
metadata
doesn't exist on the Session object yet, so you can't use that.
You can use the client_reference_id
field to store some custom data in your Session. Just be aware that the contents has to be unique. Have a look here.
You can pass an array with key metadata
. Stripe will return this field as you've sent when payment is complete.
You just have to pass as this format.
"metadata": {}
Although, I used it for creating user and saving cards. However, I didn't use it at the time of checkout, but it seems you can pretty much pass this with every API.
From Stripe Doc,
Updateable Stripe objects—including Account, Charge, Customer, PaymentIntent, Refund, Subscription, and Transfer—have a metadata parameter. You can use this parameter to attach key-value data to these Stripe objects.
Metadata is useful for storing additional, structured information on an object. As an example, you could store your user's full name and corresponding unique identifier from your system on a Stripe Customer object. Metadata is not used by Stripe—for example, not used to authorize or decline a charge—and won't be seen by your users unless you choose to show it to them.