Skip to content
Promotions

Create Promotionexperimental

POST/api/loyalty-programs/{loyaltyProgramId}/promotions

This endpoint allows you to create a Promotion.

Path parameters

Request body

  • conditionsoptional array of objects
    The list of Conditions that need to be met when incrementing/completing the Promotion.
    • fieldoptional string
      The field to look at in the Event object. Required unless type is set, in which case it is not allowed.
    • operatoroptional enum
      The operator to use when looking at the value of the field.
      • equals
        The event field must equal value.
      • greater-than
        The event field must be numerically greater than value.
      • in
        The event field must match one of the strings in value.
      • less-than
        The event field must be numerically less than value.
      • not
        The event field must not equal value.
    • typeoptional enum
      The type of condition.
      • accountId
        Only events from the given Accounts count.
      • merchantAccountId
        Only events at Merchants owned by the given Accounts count.
      • merchantId
        Only events at the given Merchants count.
      • participation-limit
        Caps how much each account can contribute towards a shared goal.
    • valueoptional string
      The value that the field must satisfy depending on the operator. Must be an array of strings when using the in operator.
  • descriptionoptional string
    Displayable description for the Promotion.
  • endsAtoptional timestamp
    The timestamp of when the Promotion ends.
  • eventTyperequired string
    The type of Event that will trigger increments and completions of the Promotion.
  • mediaUploadIdoptional string
    The ID of the Media Upload image of the Promotion.
  • namerequired string
    The display name of the Promotion.
  • paramsrequired object
    Type-specific parameters for the Promotion.
  • repeatableoptional boolean
    Flag indicating that the promotion will reward itself upon completion. This will mean that members can complete the promotion an unlimited number of times.
  • startsAtoptional timestamp
    The timestamp of when the Promotion starts.
  • summaryoptional string
    The display summary for the Promotion.
  • typerequired enum
    The type of Promotion.
    • challenge
      Rewards the account once, after the challenge target is met.
    • draw
      Collects entrants and selects winner(s) once the entrant count is within the configured bounds.

Responses

Request
curl -X POST https://service.centrapay.com/api/loyalty-programs/WRhAxxWpTKb5U7pXyxQjjY/promotions \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '{
"conditions": [
{
"field": "amount",
"operator": "greater-than",
"value": "99"
},
{
"operator": "equals",
"type": "merchantId",
"value": "5ee0c486308f590260d9a07f"
}
],
"description": "The amount of the payment must be greater than $1.",
"endsAt": "2024-02-16T00:47:54.131Z",
"eventType": "payment",
"mediaUploadId": "26yUWG6wFgmva8UaDiCTWq",
"name": "Spend a Buck",
"params": {
"rewards": {
"and": [
{
"amount": "500",
"assetType": "centrapay.nzd.main"
}
]
},
"target": {
"amount": "1",
"type": "count"
}
},
"repeatable": true,
"startsAt": "2023-02-16T00:47:54.131Z",
"summary": "Make a payment",
"type": "challenge"
}'