> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fourthwall.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gifting Guide

> Handle gift purchase webhooks for Twitch gift redemptions

<Note>
  This is a beta feature.
</Note>

Below you will find all the information you need to know about gifting with Fourthwall.

## 1. How to enable Streamelements gifting

1. Go to [Twitch Gifting App](https://my-shop.fourthwall.com/admin/dashboard/apps/twitch?redirect) in your Fourthwall admin dashboard
2. Select Streamelements gifting radio button and ensure your shop is connected with Streamelements
3. Click on the `Enable` checkbox to enable the Twitch Gifting App

## 2. Webhook configuration

Go to [Webhook Settings](https://my-shop.fourthwall.com/admin/dashboard/settings/for-developers?redirect) and create webhooks for:

* `GIFT_DRAW_STARTED`
* `GIFT_DRAW_ENDED`

## 3. How to start Gift Draw

First, ensure your stream is live:

```bash theme={null}
PUT https://api.fourthwall.com/open-api/v1.0/streaming/start
Authorization: Basic {credentials}
Content-Type: application/json

{
  "services": [
    {
      "type": "TWITCH",
      "broadcasterId": "test-broadcaster-id",
      "broadcasterLogin": "raziosx",
      "thumbnailUrl": "test-thumbnail-url"
    }
  ]
}
```

Then go to your shop main page and purchase any product as a gift. This will trigger the `Gift draw started` webhook event.

## 4. How to finish Gift Draw

Send a request to finish the draw:

```bash theme={null}
PUT https://api.fourthwall.com/open-api/v1.0/gifting/draw/{drawId}/finish
Authorization: Basic {credentials}
Content-Type: application/json

{
  "participants": [
    {
      "service": "TWITCH",
      "userId": "{twitchWinnerUserId}",
      "userName": "{twitchWinnerUserName}"
    }
  ]
}
```

The response will include the winner details along with the redeem URL. The `Gift draw ended` webhook will also be triggered.

<Note>
  Gift draws not finished within the configured time (+ 1 minute) will be automatically finished without winners to allow redoing the draw.
</Note>
