Reward transaction for FIXED amount

You can think of the Reward endpoint as the when you want to reward a user in exchange or Tokens or NFTs. This is determined by the Reward created on your Okapi dashboard.

In this example, we want to give our users 5$ OFF their order in exchange for 500 Okapi coins . To do so, we need to use the reward endpoint.

To see how to create a reward on Okapi, see the Create an reward section.

This endpoint takes an id (reward ID) and a user (unique identifier).

const data = await okApiClient.reward({ id: "REWARD_ID", user: "john@doe.com" })
    "txSignature": "UEiSQsYjbhDun2NRtQXQNdfmqqPz8sAxdLGDMvheMjC9UcbjmLF3eR4F6X213ZX679Wjy7NW8hKL7dcZ8b6qrQU",
    "succcess": true

If the reward ID exists and the transaction is successful, your user (john@doe.com) will be debited 500 Okapi coin from it's wallet. You will get a success boolean and a txSignature .

You can take a look at the transaction from the response here https://explorer.solana.com/tx/UEiSQsYjbhDun2NRtQXQNdfmqqPz8sAxdLGDMvheMjC9UcbjmLF3eR4F6X213ZX679Wjy7NW8hKL7dcZ8b6qrQU to see that the user has been debited 500 Okapi coins . Note that you can see that your account received the 500 Okapi coins debited from your user account.

Cost: 10 compute units

Note: The documentation for Reward transaction for DYNAMIC amount is coming soon.

Last updated