# How to Verify Custom Reward From Your Website with Callback Verification

<mark style="color:blue;">For example:</mark>&#x20;

Let's say you wish to provide winners with a $50 coupon reward after they have won the giveaway.&#x20;

Upon successful integration of API callbacks between your site and Cwallet, the participants will receive their rewards automatically according to the method you have specified.

However, the $50 coupon reward is just one of the reward examples, because you can create any type of rewards distributed from your websites.&#x20;

<mark style="color:blue;">Why and how is it auto-distributed?</mark>

Following the successful integration of the API callback, winners will be able to claim their rewards via a specific URL containing their track\_id and eligibility. Regardless of the method of delivery, the reward will be automatically sent to the winner. In this way, you are not required to manually distribute rewards on your website.&#x20;

**Please follow the steps to create custom rewards and to integrate API callback:**

**Step 1:**

Enter a reward name, number of winners, and upload an image of that reward.

<figure><img src="https://content.gitbook.com/content/LIfMHqDEB5rVHERvbUyz/blobs/EJa8Uken5NHxZRWC1cxX/image%20147.png" alt=""><figcaption></figcaption></figure>

**Step 2:**

After that, you will need to get url params (something like <mark style="color:green;">track\_id=MVNHLLEEwIR</mark>) from your website and parse out the trackId.

<figure><img src="https://content.gitbook.com/content/LIfMHqDEB5rVHERvbUyz/blobs/sGpyZXeCRpyLEyoKibFo/Frame%20514335%20(3).png" alt=""><figcaption></figcaption></figure>

<mark style="color:blue;">**About track\_id:**</mark>

TrackId is necessary to detect the user's participation in the task and to verify it. We will detect when a user clicks to participate in the task, the <mark style="color:green;">?trackId={{trackId}}</mark> will be used for detection.

You will see the <mark style="color:green;">?trackId={{trackId}}</mark> applied to your website link:

**If your website link is**

<figure><img src="https://content.gitbook.com/content/LIfMHqDEB5rVHERvbUyz/blobs/5vuhcCuabKfI0lKhhcOX/Frame%20514336%20(2).png" alt=""><figcaption></figcaption></figure>

**the visitors may come to your site via the link**

<figure><img src="https://content.gitbook.com/content/LIfMHqDEB5rVHERvbUyz/blobs/xCDy7k06BNCN6w2S9m9n/Frame%20514337%20(1).png" alt=""><figcaption></figcaption></figure>

**Step 3:**

Next, please copy the API key we provide you to integrate it with your website.

<figure><img src="https://content.gitbook.com/content/LIfMHqDEB5rVHERvbUyz/blobs/IpnFMt7esR68XwOP84Y9/image%20144%20(3).png" alt=""><figcaption></figcaption></figure>

Then enter the parameters according to the rules of const data, and encrypt the whole const data using the standard **HmacSHA256** algorithm.

<figure><img src="https://content.gitbook.com/content/LIfMHqDEB5rVHERvbUyz/blobs/XE9higB0oqrJWAfkhGsr/Frame%20514335%20(4).png" alt=""><figcaption></figcaption></figure>

**Step 4:**

Use our official API below and pass the corresponding parameters in the following code.

**Official API:** <https://cwallet.com/cctip/v1/giveaway/task/callback>

```javascript
const api_key =
"3lhpTSAJd6XDgBe4XWcozob4iMmYUlkPc9c4fwnoydGk4Bh5lSA3qrSiqgXeJcX7"; // your api_key

const { track_id} = queryString.parse(location.search);

const timestamp=new Date().getTime()

const data = `track_id=${track_id}&timestamp=${timestamp}`

const sign = crypto.HmacSHA256(data, api_key).toString(); // HmacSHA256

fetch("https://cwallet.com/cctip/v1/giveaway/player/status", {
method: "POST",
headers: {
"Content-Type": "application/json",
},

body: JSON.stringify({
track_id,
sign,
timestamp,
}),
}).then(async (res) => {
console.log(await res.json());
});
```

**Step 5:**

After the above steps are completed, enter your website link and click the ‘Check API callback’ to test it.

<figure><img src="https://content.gitbook.com/content/LIfMHqDEB5rVHERvbUyz/blobs/Ky4XYshl4Mp6ejEfquq7/image%2023%20(1).png" alt=""><figcaption></figcaption></figure>

**Note:**

Each project you created on Cwallet Giveaway Tool will have a unique API key, and it will not change. So you only need to integrate once for a website. Also, you will be able to create custom rewards on multiple websites if you need to.
