Consume

The Reward Consume endpoint allows you to set the state of vouchers to pending, verify, notified, redeemed, or expired. See the table below to understand the various states.

The Reward Consume endpoint will enable integrations whereby rewards are redeemed through a different mechanism i.e. not via the built-in peer-to-peer confirmation. This can be in the form of issuing coupons, digital codes, digital tickets, airtime credits, etc.

Reward Voucher States

States

pending The voucher has been obtained but a notification to the user has not been sent.

notified

The voucher has been obtained and a voucher notification has been sent.

verify

Send a peer-to-peer confirmation request to the user's device, requesting them to confirm that the reward has been received.

redeemed

Set the voucher to redeemed i.e. confirm that the user has received the reward.

expired

Set the voucher to expired.

Consuming Vouchers

In order to consume vouchers, you will need to retrieve the voucher guid. This can either be done via the reward list endpoint, or automatically via reward webhooks. The consume endpoint allows you to set the voucher state for a single or multiple users.

ListWebhooks

Parameters

Key

Type

guids

Array. A list of GUIDs.

state

String. The state that vouchers should be set to.

curl -X POST \
  v1/rewards/consume \
  -H 'Authorization: Basic <Your Base64 Encoded Token>' \
  -d '{
	"guids" : ["3bf56525-d5ad-4f39-88b3-0cdcd0bfc7dc",...etc],
	"state" : "redeemed"
}'

Success Response

The response will contain how many vouchers changed their state. Vouchers will only change their state if the current state does not match the new state.

{
    "status": "success",
    "data": {
        "changed": 5
    },
    "hash": "dfdfac8d5493733dfab6d24c599785ba",
    "response_time": 0.11311697959899902
}

Last updated