# Set Webhook API

Merchant can set webhooks using merchant dashboard too. Please visit payu site for the same. If you wish to set webhook url using apis, please continue reading this page.

{% tabs %}
{% tab title="Production" %}
<https://payout.payumoney.com/payout/v2/webhook>
{% endtab %}

{% tab title="Testing" %}
[https://test.payumoney.com/payout/v2/webhook](https://www.payumoney.com/payout/saveWebhook)&#x20;
{% endtab %}
{% endtabs %}

## **Request Header Params**

| **Key**          | **Description**                                              | **Data type** | **Mandatory** | **possible Values**    |
| ---------------- | ------------------------------------------------------------ | ------------- | ------------- | ---------------------- |
| Authorization    | Access token generated earlier.                              | String        | Yes           | Bearer {access\_token} |
| payoutMerchantId | This is the merchant id provided while onboarding to payouts | String        | Yes           |                        |

Pro Tip: payoutMerchantId is different from payuMoneyMerchant Id, please use the correct one for seamless experience

## **Request Params**

| **Key**              | **Description**                                                                                                                                                                                                     | **Data type** | **Mandatory** | **Possible Values**                                                                                                                                                                        |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| webhook              | Set the webhooks for different type of events. Like deposit, transfer success or failure. If default webhook url is set for any merchant and any specific webhook is missing, Event will get pushed to default url. | String        | yes           | <p>default<br>deposit<br>transfer\_success<br>transfer\_failed<br><strong>transfer\_reversed</strong><br>low\_balance<br>request\_processing\_failed<br>smart\_send\_detail\_submitted</p> |
| values.url           | <p>This is the post url of the api where the merchant will listen to payu events.</p><p>In other words, this is the webhook url.</p>                                                                                | String        | Yes           |                                                                                                                                                                                            |
| values.authorization | <p>Merchant can provide this value which will be sent in the header while pushing the payouts event to the merchant.</p><p>Using this merchant can authenticate that request is coming from payu.</p>               | String        | No            |                                                                                                                                                                                            |

{% hint style="info" %}
&#x20;Do not forget to whitelist payu for a server call to your webhook(api)
{% endhint %}

{% hint style="info" %}
Webhook api you create should be a POST api(do not use GET)
{% endhint %}

## **Example**

Content-Type : application/json

Method : Post

**Sample Request :**

```
[
  {
    "webhook" :"transfer_success",
     "values": {
                  "url":"https://test.com/webhook/payment",
                  "authorization":"asjafya56%^eyy63547ysrt4"
               }
   }
]
```

**Response :**

{% tabs %}
{% tab title="Success" %}

```
{
 "status": 0,
 "msg": "Webhook saved successfully",
 "code": null,
 "data": null
 }
```

{% endtab %}

{% tab title="Failure" %}

```
{
 "status": 1,
 "msg": "Webhook url is invalid",
 "code": 20407,
 "data": null
 }
```

{% endtab %}
{% endtabs %}

&#x20;
