Skip to content

Coupon Codes

For StopChurn to be able to include coupon codes generated by clients API inside of notifications templates, we have implemented callbacks for this purpose. Every Coupon Code first must be created on the Back Office platform.

Coupon code callbacks

Each brand have Coupon Code Endpoint property and all callbacks are being sent to that endpoint. The payload signature security method is implemented for every callback.

The coupon code “data” is consisted of:

  • userId – ID of the user which will receive the coupon code.
  • couponId – ID of the coupon code defined on the StopChurn Back Office.
  • couponProperties – Properties and values of a Coupon Code. Properties are defined in the Coupon Code section of the Back Office and values are defined in journeys.

Coupon code callback data example

{
  "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"
}

Property eventData contains data of the event which triggered the email action. It’s only being included in the coupon code callbacks if ‘Send event data’ option is enabled while configuring Coupon Codes on the edit journey action screen.

Coupon Code callback responses

The generated coupon code you want to include inside of notification template should be placed inside of “couponCodeValue” field of the callback response.

Valid Coupon Code callback response data examples

{
  "couponCodeValue": "BONUS25PERCENT11234"
}
{
  "dummyProperty1": "dummyValue1",
  "couponCodeValue": "BONUS25PERCENT11234",
  "dummyProperty2": 123
}