Metadata

Enhance your request payload with custom data.

Designing Metadata

With metadata, you can include extra parameters that may not be naturally supported by an endpoint. The process of creating metadata depends on how your programming language handles JSON. Some commonly used metadata includes:

  • Invoice ID

  • Cart ID

  • Cart Items

There are two methods to include parameters in the metadata object:

  1. Key/value pair: To include a parameter using this method, you pass it as a key/value pair. For example, "cart_id: 928324". Parameters passed in this way may not be visible on the dashboard, but they are included in the API response.

  2. Custom Fields: The "custom_fields" key is specifically designated for an array of custom fields that will be displayed on the dashboard when you click on the transaction.

Custom fields consist of three keys: "display_name", "variable_name", and "value". The "display_name" represents the label or name associated with the displayed value.

"metadata":{
  "cart_id":1,
  "custom_fields":[
    {
      "display_name":"Invoice ID",
      "variable_name":"Invoice ID",
      "value":122
    },
    {
      "display_name":"Cart Items",
      "variable_name":"cart_items",
      "value":"Coffee"
    }
  ]
}

Cancel Action

To redirect users to a specific URL when they cancel a payment, you can utilize the "cancel_action" attribute within your metadata.

"metadata": {
  "cancel_action": "https://example.com"
}

Last updated