Links

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. 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. 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.
1
"metadata":{
2
"cart_id":1,
3
"custom_fields":[
4
{
5
"display_name":"Invoice ID",
6
"variable_name":"Invoice ID",
7
"value":122
8
},
9
{
10
"display_name":"Cart Items",
11
"variable_name":"cart_items",
12
"value":"Coffee"
13
}
14
]
15
}

Cancel Action

To redirect users to a specific URL when they cancel a payment, you can utilize the "cancel_action" attribute within your metadata.
1
"metadata": {
2
"cancel_action": "https://example.com"
3
}