Skip to main content

checkPromotion.php

SM JSON Promotion Check Service

Endpoint: checkPromotion.php

This service checks if a promotion barcode is valid, what is its main discount item, and for which items it applies.

Parameters:

  • user: SM user name for authentication
  • password: SM user password for authentication
  • barcode: promotion barcode to check

Return Values of the JSON Structure:

  • success: true or false
  • status: numeric status, see table below for details
  • data: if success is true, returns if the day is a holiday, with some information. Precisely these values:
    • mainItem: the ItemNr of the main item number, which contains the promotion reduction/discount
    • promotionItems: a list (array) of all the items which are valid for the promotion. If one or more of these items are present in the basket, the promotion will be applied

Status Codes:

  • 0: Execution of the service succeeded
  • 102: Cannot connect to database
  • 103: Authentication failure
  • 104: Barcode not valid
  • 105: Barcode already used
  • 106: Barcode is not in a promotion

Examples:

  • Request: /checkPromotion.php?user=user&password=password&barcode=447978979798
  • Successful response:
Promotion response
{
"success": true,
"status": 0,
"data":
{
"mainItem": "35651",
"promotionItems":
[
"35508",
"35509",
"35510"
]
}
}