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
| Parameter | Type | Description |
|---|---|---|
categoryId | number | Unique ID of the category for which to fetch dynamic fields |
⚠️ The
categoryIdcan be obtained from theGET /products/categoriesendpoint.
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
fieldsarray to dynamically generate your purchase payloads. Missing required fields will result in errors.
Best Practices
- Fetch fields dynamically for each category to handle future changes without code modifications.
- Always validate required fields before making a purchase request.
- Use
receiptFieldsto extract necessary information from the purchase response. - Maintain proper data types (
number,string, etc.) when constructing requests. - Include the Authorization Bearer token in all requests.
Last updated: October 2025