Skip to main content

Get Product Categories Meta Field

This endpoint retrieves the dynamic fields required to perform a purchase for a specific product category. It also specifies which fields will appear in the transaction receipt.


Path: POST BASE_URL/products/categories/{categoryId}/fields

Authorization: Bearer <YOUR_BEARER_TOKEN>


Path Parameters

ParameterTypeDescription
categoryIdnumberUnique ID of the category for which to fetch dynamic fields

⚠️ The categoryId can be obtained from the GET /products/categories endpoint.


Description

  • Returns the required input fields for a purchase request (fields).
  • Returns the fields that will appear in the receipt (receiptFields).
  • This ensures your application can dynamically generate purchase forms and process receipts correctly.

Response Structure

{
"fields": [
{
"name": "amount",
"type": "number",
"required": true
},
{
"name": "paymentMethod",
"type": "string",
"required": true
}
],
"receiptFields": [
"voucher.pin",
"voucher.serialNumber",
"voucher.amount",
"voucher.expiryDate",
"voucher.content.redemptionInstructions",
"voucher.content.termsAndConditions",
"details[0].productInstructions",
"details[0].tokens[0].token",
"details[0].tokens[0].serialNumber",
"details[0].productAmount"
]
}

Fields Explained

fields

  • Defines the required input parameters for a purchase transaction.
  • Each object includes:
    • name: Field name to include in the purchase request.
    • type: Data type (string, number, etc.).
    • required: Boolean indicating whether the field is mandatory.

receiptFields

  • Lists the fields that will appear in the purchase receipt response.
  • Can include nested fields using dot notation (e.g., voucher.pin) or array notation (e.g., details[0].tokens[0].token).

⚠️ Always use the fields array to dynamically generate your purchase payloads. Missing required fields will result in errors.


Best Practices

  1. Fetch fields dynamically for each category to handle future changes without code modifications.
  2. Always validate required fields before making a purchase request.
  3. Use receiptFields to extract necessary information from the purchase response.
  4. Maintain proper data types (number, string, etc.) when constructing requests.
  5. Include the Authorization Bearer token in all requests.

Last updated: October 2025