Promotions
Promotions are a mechanism to reward accounts for completing certain actions.
Promotion Model
Attributes
Promotion Params Model
The shape of params depends on the Promotion's type.
Challenge Params
Attributes
target
objectrewards
object
Draw Params
Attributes
rewards
objectprogress
objectrequired
Promotion Progress Model
Attributes
minimum
numbermaximum
number
Promotion Target Model
Attributes
type
stringfield
stringamount
numberprogress
number
Promotion Rewards Model
Rewards are expressed as a tree of and/or groups rather than a flat list, so that rewards can be grouped for conditional logic. Each item in the group's array is either a leaf Promotion Reward or another nested Promotion Rewards group. For challenge promotions, every leaf reward in the tree is issued when the Promotion is completed, so only and is allowed. For draw promotions, or is also allowed, to be used once winner selection logic decides which branch of rewards is issued; a group must have exactly one of and or or.
Attributes
and
arrayor
array
Promotion Reward Model
Attributes
assetType
stringcollectionId
stringname
stringimg
stringamount
numbertotalSupply
stringremainingSupply
stringissued
booleanissuedToAccountIds
array
Promotion Condition Model
Attributes
field
stringvalue
stringoperator
stringtype
string
Promotion Activity Model
Attributes
Create Promotion experimental
Attributes
Errors
PROMOTION_REWARDS_INVALID
403
curl -X POST https://service.centrapay.com/api/loyalty-programs/WRhAxxWpTKb5U7pXyxQjjY/promotions \-H 'content-type: application/json' \-H 'x-api-key: <TOKEN>' \-d '{ "name": "Spend a Buck", "summary": "Make a payment", "mediaUploadId": "26yUWG6wFgmva8UaDiCTWq", "startsAt": "2023-02-16T00:47:54.131Z", "endsAt": "2024-02-16T00:47:54.131Z", "eventType": "payment", "params": { "target": { "type": "count", "amount": "1" }, "rewards": { "and": [ { "assetType": "centrapay.nzd.main", "amount": "500" } ] } }, "type": "challenge", "conditions": [ { "field": "amount", "value": "99", "operator": "greater-than" }, { "type": "merchantId", "value": "5ee0c486308f590260d9a07f", "operator": "equals" } ], "description": "The amount of the payment must be greater than $1.", "repeatable": true}'{ "id": "8aoMfscvtuewsuJzmzBzAs", "accountId": "57SyRRgZ1U8Kq2wKpCnSR5", "programId": "WRhAxxWpTKb5U7pXyxQjjY", "name": "Spend a Buck", "summary": "Make a payment", "mediaUploadId": "26yUWG6wFgmva8UaDiCTWq", "img": "https://media-upload.centrapay.com/image.png?jhbdsfau67ewejshb=487hsdjhbdgs743", "startsAt": "2023-02-16T00:47:54.131Z", "endsAt": "2024-02-16T00:47:54.131Z", "rewards": [ { "assetType": "centrapay.nzd.main", "amount": "500" }, { "promotionId": "8aoMfscvtuewsuJzmzBzAs" } ], "eventType": "payment", "target": { "type": "count", "amount": "1" }, "params": { "target": { "type": "count", "amount": "1" }, "rewards": { "and": [ { "assetType": "centrapay.nzd.main", "amount": "500" }, { "promotionId": "8aoMfscvtuewsuJzmzBzAs" } ] } }, "type": "challenge", "conditions": [ { "field": "amount", "value": "99", "operator": "greater-than" }, { "type": "merchantId", "field": "merchantId", "value": "5ee0c486308f590260d9a07f", "operator": "equals" } ], "description": "The amount of the payment must be greater than $1.", "createdAt": "2023-02-08T04:04:27.426Z", "createdBy": "crn::user:1234", "updatedAt": "2023-02-08T04:04:27.426Z", "updatedBy": "crn::user:1234", "repeatable": true}Get Promotion experimental
Allows the user to get a Promotion
curl -X GET https://service.centrapay.com/api/promotions/8aoMfscvtuewsuJzmzBzAs \-H 'x-api-key: <TOKEN>'{ "id": "8aoMfscvtuewsuJzmzBzAs", "accountId": "57SyRRgZ1U8Kq2wKpCnSR5", "programId": "WRhAxxWpTKb5U7pXyxQjjY", "name": "Spend a Buck", "summary": "Make a payment", "description": "The amount of the payment must be greater than $1.", "mediaUploadId": "26yUWG6wFgmva8UaDiCTWq", "img": "https://media-upload.centrapay.com/image.png?jhbdsfau67ewejshb=487hsdjhbdgs743", "startsAt": "2023-02-16T00:47:54.131Z", "endsAt": "2024-02-16T00:47:54.131Z", "rewards": [ { "assetType": "centrapay.nzd.main", "amount": "500" } ], "eventType": "payment", "target": { "type": "count", "amount": 1 }, "params": { "target": { "type": "count", "amount": 1 }, "rewards": { "and": [ { "assetType": "centrapay.nzd.main", "amount": "500" } ] } }, "type": "challenge", "conditions": [ { "field": "amount", "value": "100", "operator": "greater-than" } ], "createdAt": "2023-02-08T04:04:27.426Z", "createdBy": "crn::user:1234", "updatedAt": "2023-02-08T04:04:27.426Z", "updatedBy": "crn::user:1234"}curl -X GET https://service.centrapay.com/api/accounts/57SyRRgZ1U8Kq2wKpCnSR5/promotions \-H 'x-api-key: <TOKEN>'{ "items": [ { "id": "8aoMfscvtuewsuJzmzBzAs", "accountId": "57SyRRgZ1U8Kq2wKpCnSR5", "programId": "WRhAxxWpTKb5U7pXyxQjjY", "name": "Spend a Buck", "summary": "Make a payment", "description": "The amount of the payment must be greater than $1.", "mediaUploadId": "26yUWG6wFgmva8UaDiCTWq", "img": "https://media-upload.centrapay.com/image.png?jhbdsfau67ewejshb=487hsdjhbdgs743", "startsAt": "2023-02-16T00:47:54.131Z", "endsAt": "2024-02-16T00:47:54.131Z", "rewards": [ { "assetType": "centrapay.nzd.main", "amount": "500" } ], "eventType": "payment", "target": { "type": "count", "amount": 1 }, "params": { "target": { "type": "count", "amount": 1 }, "rewards": { "and": [ { "assetType": "centrapay.nzd.main", "amount": "500" } ] } }, "type": "challenge", "conditions": [ { "field": "amount", "value": "99", "operator": "greater-than" } ], "createdAt": "2023-02-08T04:04:27.426Z", "createdBy": "crn::user:1234", "updatedAt": "2023-02-08T04:04:27.426Z", "updatedBy": "crn::user:1234" } ]}List Promotions by Loyalty Program experimental
Returns a list of Promotions for a Loyalty Program.
curl -X GET https://service.centrapay.com/api/loyalty-programs/WRhAxxWpTKb5U7pXyxQjjY/promotions \-H 'x-api-key: <TOKEN>'{ "items": [ { "id": "8aoMfscvtuewsuJzmzBzAs", "accountId": "57SyRRgZ1U8Kq2wKpCnSR5", "programId": "WRhAxxWpTKb5U7pXyxQjjY", "name": "Spend a Buck", "summary": "Make a payment", "description": "The amount of the payment must be greater than $1.", "mediaUploadId": "26yUWG6wFgmva8UaDiCTWq", "img": "https://media-upload.centrapay.com/image.png?jhbdsfau67ewejshb=487hsdjhbdgs743", "startsAt": "2023-02-16T00:47:54.131Z", "endsAt": "2024-02-16T00:47:54.131Z", "rewards": [ { "assetType": "centrapay.nzd.main", "amount": "500" } ], "eventType": "payment", "target": { "type": "count", "amount": 1 }, "params": { "target": { "type": "count", "amount": 1 }, "rewards": { "and": [ { "assetType": "centrapay.nzd.main", "amount": "500" } ] } }, "type": "challenge", "conditions": [ { "field": "amount", "value": "100", "operator": "greater-than" } ], "createdAt": "2023-02-08T04:04:27.426Z", "createdBy": "crn::user:1234", "updatedAt": "2023-02-08T04:04:27.426Z", "updatedBy": "crn::user:1234" } ]}List Activities for Promotion experimental
Returns a paginated list of Promotion Activities for a Promotion.
curl -X GET https://service.centrapay.com/api/promotions/8aoMfscvtuewsuJzmzBzAs/activities \-H 'x-api-key: <TOKEN>'{ "items": [ { "id": "WRhAxxWpTKb5U7pXyxQjjY", "activityType": "promotion:created", "promotionId": "8aoMfscvtuewsuJzmzBzAs", "programId": "WRhAxxWpTKb5U7pXyxQjjY", "createdAt": "2023-02-08T04:04:27.426Z" }, { "id": "26yUWG6wFgmva8UaDiCTWq", "activityType": "promotion:shared-progress-incremented", "promotionId": "8aoMfscvtuewsuJzmzBzAs", "programId": "WRhAxxWpTKb5U7pXyxQjjY", "accountId": "57SyRRgZ1U8Kq2wKpCnSR5", "targetProgress": "1", "createdAt": "2023-06-14T12:30:00.000Z" }, { "id": "DKTs3U38hdhfEqwF1JKoT2", "activityType": "promotion:ended", "promotionId": "8aoMfscvtuewsuJzmzBzAs", "createdBy": "crn::user:1234", "createdAt": "2024-02-16T00:47:54.131Z", "status": "ended" } ], "nextPageKey": "DKTs3U38hdhfEqwF1JKoT2"}