> For the complete documentation index, see [llms.txt](https://everyday-digital.gitbook.io/falkor-dev-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://everyday-digital.gitbook.io/falkor-dev-docs/pathways/rewards/consume.md).

# 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                                                                                                                                                            |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>pending</strong><br>The voucher has been obtained but a notification to the user has not been sent.</p>                                                |
| <p><strong>notified</strong></p><p>The voucher has been obtained and a voucher notification has been sent.</p>                                                    |
| <p><strong>verify</strong></p><p>Send a peer-to-peer confirmation request to the user's device, requesting them to confirm that the reward has been received.</p> |
| <p><strong>redeemed</strong></p><p>Set the voucher to redeemed i.e. confirm that the user has received the reward.</p>                                            |
| <p><strong>expired</strong></p><p>Set the voucher to expired.</p>                                                                                                 |

## 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.

{% content-ref url="/pages/-MILCeGORSmvu2L\_zOEU" %}
[List](/falkor-dev-docs/pathways/rewards/list.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MILDIkjuq4JAZQrfay9" %}
[Webhooks](/falkor-dev-docs/pathways/webhooks.md)
{% endcontent-ref %}

### 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
}
```
