Skip to content

Callbacks

Every endpoint defined by client and configured on StopChurn should contain full endpoint route. Every callback contains “data” and “signature” field. All callback data is stored inside the “data” field, and the “signature” is being used for the payload signature purpose.

Already integrated clients

We will be sending requests with and without payload signature until all clients implement payload signature on their ends.

Authorization

Each endpoint comes with Authorization Header field as well, which will be directly copied to the Authorization header of callbacks. This enables you to configure different APIs with different authorization keys for different endpoints.

Payload signature

To make every callback more secure and to be sure that noone has altered the request data we are using payload signature. Signature is generated by hashing the “data” object using sha512 algorithm with client secret key (you’ve received this on the integration beginning) as key. To be sure everything is secured you should hash the “data” field each time you receive a request and compare it to the “signature” value.

Callback with payload signature examples

You can check if you’ve implemented payload signature well by using the “data” field from example and 12345 as client secret key. You should generate a value from “signature” field.

{
  "data": {
    "userId": 553,
    "name": "TEST_BONUS",
    "value": 256,
    "uniqueBonusId": "6579a4fb4acf4b8915c4346c_553",
    "eventData": {
      "name": "TEST_EVENT",
      "value": 333
    }
  },
  "signature": "cc18e9b8c7a857864d4745844c06fcc324d51aa71ce556dca65323512a4bd75f929fedf26aba516b105603c87a9f33f8b6cf908ebf4770fca4fc5a2f7998437b"
}
{
  "data": {
    "status": 200,
    "timestamp": 1708611945206
  },
  "signature": "0fb749acc842160125123723ff37b056fea599115bc077af8be1dee354db7aeafc3351ceb084ca30e2640257e0e8c370368a30d3aae2a3c88489039ed23709f7"
}
{
  "data": {
    "status": 400,
    "timestamp": 1708611945206
  },
  "signature": "53e05b09f711a54c15e2b1faa93f6fe19041b0f5fb1923d954ffbae974b2339eb5e7e5a352c45f05a70344a0bc4dcf3eda3b604450d049bec6cf40f2bdcb188f"
}
{
  "data": {
    "stopChurnBrandId": 15,
    "brandIdFromClient": "550e8400-e29b-41d4-a716-446655440000"
  },
  "signature": "13056bc348df3d3f86fbea10e072ad01a25ecf39f5c2c9f3e05050a1f851e0e6ae8ee4a9153980da3922ff1ca0d722c5c42d714bc7f823684a26469314860b36"
}
{
  "data": {
    "userId": "550e8400-e29b-41d4-a716-446655440000",
    "couponId": "testCoupon123",
    "couponProperties": {
      "stringProp": "dummy string",
      "numberProp": 123,
      "dateProp": 1704063600000,
      "numberArrayProp": [10, 20, 30]
    },
    "eventData": {
      "name": "TEST_EVENT",
      "value": "test_value"
    }
  },
  "signature": "141fca0172358297f8f92fc501f7cd789e218af74eff8ae01287c1e56a1aa4e1505c6705ad2e8c94c0688f62d1763677be173dcf7a70572830c3baa09d9a1801"
}