#Custom data in checkout

1 messages · Page 1 of 1 (latest)

quasi quarry
#

Can't find how to pass custom data in a checkout flow. eg. passing my user ID in the checkout flow so that I get it in the webhook payload to process further.
Is that even supported?

tacit hawkBOT
# quasi quarry Can't find how to pass custom data in a checkout flow. eg. passing my user ID in...

To pass custom data in a checkout flow with Dodo Payments and receive it in the webhook payload, you can use the metadata fields. This allows you to include additional information, such as your user ID, which can then be accessed in the webhook payload for further processing.

Here's how you can do it:

  1. Add Metadata to the Payment Link: When creating a payment link, you can include custom metadata fields using the metadata_ prefix. For example, to pass a user ID, you can include it as a query parameter in the payment link like this:

    https://checkout.dodopayments.com/buy/{productid}?quantity=1&redirect_url={your website return_url}&metadata_userId=yourUserId
    
  2. Access Metadata in Webhook: When the payment is completed, the metadata will be included in the webhook payload sent to your server. You can access this metadata to retrieve the user ID or any other custom data you have passed.

  3. Process the Webhook: In your webhook handler, extract the metadata from the payload and use it to process the payment or perform any additional actions required.

By using metadata fields, you can effectively pass and retrieve custom data throughout the checkout and payment process with Dodo Payments.
Disclaimer: I am a bot and I may make mistakes. Always refer to the documentation. Here are some of the relevant links that I found regarding your query. [1] [2] [3]

quasi quarry
#

Great!

deft dune
#

This is super helpful. Ideally this should be in our documents @severe burrow @manic oxide
I spent half a day trying so many things to do this

humble sandal
#

Thanks so much! This is such important information — I suggest adding it to the documentation. I’ve been looking for it for a long time.

severe burrow
deft dune
#

@severe burrow can we add this in the boilerplate code. I think most of your users start from there.
And even the video attached does not cover this