NeroPay Docs
API & Integrations

Product Options and Global Options

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

MethodEndpointPurpose
GET/product-option-groupsList option groups.
POST/product-option-groupsCreate product option group.
GET/global-option-itemsList global option items.
POST/global-option-itemsCreate global option item.

Use options for modifiers such as milk type, size, sauce, topping or menu choices. Global options can be reused across products.

ParameterTypeRequiredDescription
namestringYesOption group or item name.
typestringOptionalSelection style such as single or multiple.
requiredbooleanOptionalWhether the customer or cashier must choose an option.
min_selectintegerOptionalMinimum allowed selections.
max_selectintegerOptionalMaximum allowed selections.
price_deltadecimalOptionalAdditional 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."
      ]
    }
  }
}