How to setup a redeem option

Scrimmage supports a couple of redeem options including coupons, limited goods, and original app balance.

Redeem to Coupons (Prizeout)

If you want to give your users the ability to redeem rewards for coupons, the simplest way is to use our existing integration with Prizeout. They aggregate thousands of coupons from around the world, making them available to your users.

To get started, sign up on their website and then create a Prizeout type redeem option on our admin panel. For detailed instructions on setting up the redeem option, refer to the redeem option setup documentation .

Redeem Back to Balance

If your app includes a wallet, you can enable users to exchange reward tokens for money in their wallet.

To implement this, you need to set up a webhook that we will call each time someone wants to redeem money. For security reasons, we do not request access to your wallet management; it is the responsibility of your backend to transfer the funds to the user.

From the webhook, you must reply with a 200 status code, and then the transaction will be marked as succeeded, and the user will lose their tokens. If you return an error, the transaction will be postponed, and the user's token will be frozen. You can also reply with a 201 status code, and the transaction will be marked as postponed.

Webhook Body:

{
  "event": "redeem.static",
  "redeemOptionName": "",
  "namespace": "",
  "transactionId": "transaction id from initial request (uuid)",
  "userId": "user id from initial request",
  "amount": 1200, // deprecated, use currencyAmount instead
  "tokenAmount": 12,
  "currencyAmount": 1200,
  "conversionRate": 10,
}
  • tokenAmount - amount of token paid by the user
  • currencyAmount - amount in cents after conversion using conversionRate (tokenAmount * conversionRate * 100)
  • conversionRate - value specified in the configuration of the redeem option

Authorization

To ensure that it is us calling the webhook, you must verify that the Authorization header contains the correct value, which you specify from the admin panel.

Postponed Transactions

To authorize your request to us, you must specify the secretKey obtained from the API Secret Key field in your redeem configuration on the admin panel.

To confirm the postponed transaction, send a POST request to /fed/providers/%redeem option name%/events/redeem.static.success:

{
  "secretKey": "secret key from admin dashboard",
  "transactionId": "transaction id from initial request"
}

To cancel the postponed transaction, send a POST request to /fed/providers/%redeem option name%/events/redeem.static.failure:

{
  "secretKey": "secret key from admin dashboard",
  "transactionId": "transaction id from initial request"
}

Redeem to Limited Goods

If you want to offer users the option to redeem coins for digital or physical items, then you should use the tangible redeem option.

First, create a tangible redeem option on our admin panel. You can specify the item's name, description, image, and endpoints of your backend that will be called when a user wants to redeem the item. You can also specify the number of items available for redemption. If you do not specify a quantity, the item will be available until you remove it.

When a user wants to redeem an item, we will call the specified endpoint and send the following body:

{
  "event": "redeem.static",
  "redeemOptionName": "redeem option name from admin dashboard",
  "namespace": "production",
  "transactionId": "transaction id from initial request (uuid)",
  "userId": "user id from initial request",
  "price": 50,
  "productName": "product name from admin dashboard",
  "address": "user address from initial request (if available)",
  "email": "user email from initial request (if available)"
}

To successfully redeem the item, you must reply with a 200 status code, marking the transaction as succeeded and the user will lose their tokens. If you return an error, the transaction will be postponed. Alternatively, replying with a 201 status code will mark the transaction as postponed.