Description

Map sale items to an existing collection transaction in the SimpleLoyalty database.

Parameters

Parameter Type Value Required
operation_name String saleMapping true
variables JSON $JSON_OBJECT true

$JSON_OBJECT Structure

Key Type Description Required
outletId String SimpleLoyalty Outlet ID true
transactionNumber String Transaction number from source system true
items Array List of sale items true

Item Structure

Key Type Description Required
sku String SKU code of the item true
externalId String External item ID from source system true
name String Item name true
description String Item description false
metadata String Additional item metadata as a JSON string false

Example

Sample Request

curl \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OAUTH_TOKEN" \
-d '{
        "operation_name": "saleMapping",
        "variables": {
            "outletId": $OUTLET_ID,
            "transactionNumber": "TRANSACTION123",
            "items": [
                {
                    "sku": "SKU001",
                    "externalId": "ITEM001",
                    "name": "Item Name",
                    "description": "Item Description",
                    "metadata": "{\"key\":\"value\"}"
                }
            ]
        }
    }' \
https://simpleloyalty.com/third_party/v2

Sample Success Response

{
  "data": {
    "saleMapping": {
      "result": "OK",
      "errors": []
    }
  }
}

Sample Error Response

{
  "data": {
    "saleMapping": {
      "result": "ERROR",
      "errors": [
        {"message": "No recorded transaction"}
      ]
    }
  }
}