Commerce
Product Options and Global Options
Build product modifiers and reusable option items for menus and catalogues.
OptionsModifiersGlobal add-ons
Product options and global options
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /product-option-groups | List option groups. |
| POST | /product-option-groups | Create product option group. |
| GET | /global-option-items | List global option items. |
| POST | /global-option-items | Create global option item. |
Use options for modifiers such as milk type, size, sauce, topping or menu choices. Global options can be reused across products.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Option group or item name. |
type | string | Optional | Selection style such as single or multiple. |
required | boolean | Optional | Whether the customer or cashier must choose an option. |
min_select | integer | Optional | Minimum allowed selections. |
max_select | integer | Optional | Maximum allowed selections. |
price_delta | decimal | Optional | Additional price for this option item. |
'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $secretKey,
'Accept: application/json',
'Content-Type: application/json',
'X-NeroPay-Timestamp: ' . $timestamp,
'X-NeroPay-Signature: ' . $signature,
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
],
CURLOPT_POSTFIELDS => $rawBody,
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $response;
{
"success": true,
"data": {
"id": 701,
"name": "Milk Choice",
"type": "single",
"items": [
{
"id": 1,
"name": "Whole milk",
"price_delta": "0.00"
},
{
"id": 2,
"name": "Oat milk",
"price_delta": "0.50"
}
]
}
}
'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $secretKey,
'Accept: application/json',
'Content-Type: application/json',
'X-NeroPay-Timestamp: ' . $timestamp,
'X-NeroPay-Signature: ' . $signature,
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
],
CURLOPT_POSTFIELDS => $rawBody,
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $response;
{
"success": true,
"data": {
"id": 8001,
"name": "Extra shot",
"price_delta": "0.75",
"is_active": 1
}
}
{
"success": false,
"error": {
"code": "validation_failed",
"message": "The name field is required.",
"details": {
"amount": [
"The amount field is required."
]
}
}
}