Callbacks, or webhooks, provide you with a convient way of getting notifications of events in the Kwick platfrom. All callbacks are HTTP posts with predefined HTTP headers to specify the event.

🚧

In order to use callbacks, you must specify a callback domain in partner portal.

HTTP headers

HTTP headers informs the receiving system of the content in the callback.

X-Event
The X-Event lets you know what type of event that triggered the callback, events are listed further down on this page.

X-Schema
In case the callback contains a document, digital receipt or delivery note, the X-Schema header will provide you with the XSD file associated with the delivery.

Digital receipt = DigitalReceiptV2.0.0
Delivery note = DeliveryNoteV1.0

X-Data-Signature
If you want to verify that the callback is sent from Kwick, we will pass X-Data-Signature header in every callback. The X-Data-Signature contains the SHA256 signature of the request payload, using your specific callback secret found in the partner portal, https://partners.marcet.se/account. Example in php how to validate the X-Data-Signature:

$callbackData = file_get_contents('php://input');
$dataSignature = explode('=',$_SERVER['HTTP_X_DATA_SIGNATURE']);
$mySignature = hash_hmac( 'SHA256', $callbackData, $secret);

if($dataSignature[0]!=$mySignature)
{
    header("HTTP/1.1 403 Forbidden");
    exit;
}

DigitalReceiptProcessed

When you process a digital receipt in Kwick you can also have the digital receipt sent to a different location. For instance if receipt should be also sent to an endpoint, showing the receipt in merchant own interface. Simply set the X-Callback-Path header when you do a post to the "Process a digital receipt" service.

Please note, a callback domain needs to be specified via partner portal.

Header in posted receipt should incl. the callback path.

Response example:

// host domain = <https://your-domain.io>  
X-Callback-Path: /yDXxwdQe2EfJNNPaR81J  
// response delivered to  
<https://your-domain.io/yDXxwdQe2EfJNNPaR81J>

MemberAttached

If you have activated the loyalty registration product and the enduser has given their consent, Kwick can do a callback whenever a member joins your loyalty program. The callback, a POST request, will be sent to the callback path setup under the loyalty section in the partner portal.

Headers:

X-Event: MemberAttached  
X-Data-Signature: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
Content-Type: application/json

Body:

{
  "id": "c604b0e7-f6c7-4c9e-a556-f4da3bc5635b",
  "data": {
    "ssn": "190101011111",
    "ssn_country": "SE",
    "mobile": "1111111111",
    "firstname": "Test",
    "lastname": "Testsson",
    "email": "[email protected]"
  }
}

MemberDetached

If you have activated the loyalty registration product, Kwick can do a callback whenever a member decides leaves your loyalty program. The callback, a POST request, will be sent to the callback path setup under the loyalty section in the partner portal.

Headers:

X-Event: MemberDetached  
X-Data-Signature: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
Content-Type: application/json

Body:

{
  "id": "c604b0e7-f6c7-4c9e-a556-f4da3bc5635b",
  "data": {
    "ssn": "190101011111",
    "ssn_country": "SE",
    "mobile": "1111111111",
    "firstname": "Test",
    "lastname": "Testsson",
    "email": "[email protected]"
  }
}

MemberTracked

If you have activated the loyalty tracking product and the user has given their consent, Kwick can do a callback whenever a member do a purchase without identifying themselvs at the store. The callback, a POST request, will be sent to the callback path setup under the loyalty section in the partner portal.

Headers:

X-Event: MemberTracked
X-Data-Signature: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json

Body:

{
  "x_reference_id": "ABC123",
  "x_member_id": "DEF456"
}