Metadata

Add custom data to your request payload

Using metadata allows you to include additional parameters not naturally accepted by an endpoint. The specifics of crafting metadata depend on your language's JSON handling. Common metadata include:

  • Invoice ID
  • Cart ID
  • Cart Items
  • Payment medium (site/app)

There are two approaches to adding parameters to the metadata object:

  1. Key/value pair: This involves passing the parameter as a key-value pair, like cart_id: IU929. Although parameters added this way won't appear on the dashboard, they will be returned with the API response.
  2. Custom Fields: The custom_fields key is designated for an array of custom fields that should be visible on the dashboard when viewing the transaction.

Custom fields consist of three keys: display_name, variable_name, and value. The display name acts as the label for the value when displayed.

Example metadata
{
  "metadata": {
    "cart_id": 398,
    "custom_fields": [
      {
        "display_name": "Invoice ID",
        "variable_name": "Invoice ID",
        "value": 209
      },
      {
        "display_name": "Cart Items",
        "variable_name": "cart_items",
        "value": "3 bananas, 12 mangoes"
      }
    ]
  }
}

Copyright © 2024 Notch Pay