Generic methods
Common methods API documentation
Base URL: /customer-loyalty-stats
Authentication: P-o-S authentication required
Authentication
Transport and protocol
The API uses HTTPS as a protocol. Messages are represented in the JSON format.
Authentification
Authentification is implemented by a static token. The token must be sent in the header of HTTP requests.
The header in every API request should include:
Field name | Value example | Description |
Authorization | Bearer 8c6b8b64-6815-6084-0a3e-178401251b68 | Token from the merchant’s marketing engine. |
X-Merchant-ID | ABCD | The value is sent by the SWiP employee after the merchant's onboarding. Four-letter codes are used at the moment. The values can be expanded in the future. |
X-Store-ID | Test storeID | The Store ID that the SWiP employee sends after the merchant's onboarding. The value is taken from the merchant's system: either the real identifier of the store or, if it cannot be received from the terminal, the value from the SWiP plugin settings. |
X-Cash-ID | 1231 | Terminal ID in the merchant's system. |
Api-Version | 3 | API version. |
Endpoints
1. Getting of loyalty stats
GET /customer-loyalty-stats
Gets available customer’s loyalty stat by phone/pass id
Request Parameters
Parameter | Type | Required | Description |
|---|---|---|---|
| string | No | Customer phone number |
| string | No | Customer pass id |
Response
Status: 200 OK
{
"points": "integer"
}Example
POST /customer-loyalty-stats?phone=79167795322
Authorization: Bearer <token>
Content-Type: application/json
Success Response:
{
"points": 11806
}Error Responses
Common Error Codes
Status Code | Description |
|---|---|
| Invalid request parameters or customer blocked |
| Missing or invalid authentication |
| Insufficient permissions |
| Business logic validation failed |
| Server error |
Error Response Format
{
"@type": "string",
"code": "number",
"timestamp": "string",
"fieldErrors": ["integer"]
}
Error Scenarios
Example Error Response
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"@type": "ApiError",
"code": 9,
"description": "Customer[7916779532232] not found",
"fieldErrors": null
}
Business Flow
Getting available points
authentication customer by his phone/pass id
getting his loyalty stats
returning points balance