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

# Refund Webhook

> Receive real-time notifications about credit card refund status changes

Refund webhooks allow you to receive automatic notifications whenever the status of a credit card refund changes. When you [create a refund](https://docs.wepayout.co/api-reference/cash-in/refund/create-refund.md) for a credit card charge, WEpayments processes it asynchronously through the card processor and sends a POST request to your notification URL each time the refund reaches a new status.

> [!NOTE]
>
> This webhook is **specific to refunds** and is separate from the [Credit Card Webhook](https://docs.wepayout.co/credit-card/webhook.md), which notifies you about the charge (payin) status. A refund generates its own independent notifications.

> [!WARNING]
>
> The payload format described on this page applies to **credit card** refunds. Refunds for other payment methods (such as Pix) may use a different payload structure — see [Create Refund](https://docs.wepayout.co/api-reference/cash-in/refund/create-refund.md).

## How It Works

1. **Create a refund** for a credited credit card charge and provide a `notification_url`
2. **Receive notifications** automatically each time the refund status changes
3. **Process the payload** containing the refund details and amounts
4. **Return a 200 OK** response to acknowledge receipt

> [!WARNING]
>
> A credit card charge can only be refunded if it is **credited to the wallet** and the refund is requested within **180 days** of the original payment. See [Create Refund](https://docs.wepayout.co/api-reference/cash-in/refund/create-refund.md) for all refund rules.

## Setting Up the Refund Webhook

To receive notifications, include the `notification_url` parameter when [creating the refund](https://docs.wepayout.co/api-reference/cash-in/refund/create-refund.md):

```json theme={null}
{
  "amount": 10000,
  "reason": "Customer requested cancellation",
  "notification_url": "https://your-domain.com/webhooks/credit-card-refund"
}
```

Each refund can have its own notification URL, allowing you to route refund notifications to a dedicated endpoint.

## Refund Statuses

You will receive a webhook for each of the following refund statuses:

| Status ID | Status Name | Description |
| - | - | - |
| 2 | Requested | The refund has been requested and is being processed by the card processor. |
| 4 | Paid | The refund has been successfully completed. |
| 5 | Error | An error occurred while processing the refund. |

### Refund Status Flow

**Success scenario:**

```
REQUESTED (2) → PAID (4) ✓
```

**Error scenario:**

```
REQUESTED (2) → ERROR (5) ✗
```

## Webhook Payload

When a credit card refund status changes, you'll receive a POST request with the following data:

**id** `integer`

Unique identifier of the refund.

Example: `123`

**payinId** `integer`

ID of the credit card charge (payin) being refunded.

Example: `456`

**statusId** `integer`

Current refund status ID (`2`, `4`, or `5`).

**user** `object`

User who created the refund.

**User Object**

**user.id** `integer`

User ID.

**user.name** `string`

User name.

**clientId** `integer`

Your client ID in the WEpayments system.

**amountCents** `integer`

Amount of this refund, **in cents**.

Example: `10000`

**statuses** `array`

History of all status changes for this refund.

**Status History Item**

**id** `integer`

Status history record ID.

**statusId** `integer`

Status ID (`2`, `4`, or `5`).

**status\_id** `integer`

Same value as `statusId` (kept for backward compatibility).

**name** `string`

Status name (`Requested`, `Paid`, or `Error`).

**notification** `integer`

Whether this status change generated a notification (`1`) or not (`0`).

**createdAt** `string`

When this status was set (ISO 8601 format).

**created\_at** `string`

Same value as `createdAt` (kept for backward compatibility).

**endToEndId** `string`

End-to-end identifier. Used for Pix refunds; typically `null` for credit card refunds.

**reason** `string`

Reason provided when the refund was created.

**walletErrorCode** `string`

Error code returned by the processor when the refund fails (status `5`). `null` otherwise.

**callbackUrl** `string`

The notification URL configured for this refund.

**createdAt** `string`

Refund creation timestamp (ISO 8601 format).

**updatedAt** `string`

Timestamp of the last update (ISO 8601 format).

## Example Payloads

```json Requested theme={null}
{
  "id": 123,
  "payinId": 456,
  "statusId": 2,
  "user": {
    "id": 789,
    "name": "João Silva"
  },
  "clientId": 10,
  "amountCents": 10000,
  "statuses": [
    {
      "id": 1,
      "statusId": 2,
      "status_id": 2,
      "name": "Requested",
      "notification": 1,
      "createdAt": "2026-02-19T12:34:56.000000Z",
      "created_at": "2026-02-19T12:34:56.000000Z"
    }
  ],
  "endToEndId": null,
  "reason": "Customer requested cancellation",
  "walletErrorCode": null,
  "callbackUrl": "https://your-domain.com/webhooks/credit-card-refund",
  "createdAt": "2026-02-19T12:34:56.000000Z",
  "updatedAt": "2026-02-19T12:34:56.000000Z"
}
```

```json Paid theme={null}
{
  "id": 123,
  "payinId": 456,
  "statusId": 4,
  "user": {
    "id": 789,
    "name": "João Silva"
  },
  "clientId": 10,
  "amountCents": 10000,
  "statuses": [
    {
      "id": 1,
      "statusId": 2,
      "status_id": 2,
      "name": "Requested",
      "notification": 1,
      "createdAt": "2026-02-19T12:34:56.000000Z",
      "created_at": "2026-02-19T12:34:56.000000Z"
    },
    {
      "id": 2,
      "statusId": 4,
      "status_id": 4,
      "name": "Paid",
      "notification": 1,
      "createdAt": "2026-02-19T12:36:22.000000Z",
      "created_at": "2026-02-19T12:36:22.000000Z"
    }
  ],
  "endToEndId": null,
  "reason": "Customer requested cancellation",
  "walletErrorCode": null,
  "callbackUrl": "https://your-domain.com/webhooks/credit-card-refund",
  "createdAt": "2026-02-19T12:34:56.000000Z",
  "updatedAt": "2026-02-19T12:36:22.000000Z"
}
```

```json Error theme={null}
{
  "id": 123,
  "payinId": 456,
  "statusId": 5,
  "user": {
    "id": 789,
    "name": "João Silva"
  },
  "clientId": 10,
  "amountCents": 10000,
  "statuses": [
    {
      "id": 1,
      "statusId": 2,
      "status_id": 2,
      "name": "Requested",
      "notification": 1,
      "createdAt": "2026-02-19T12:34:56.000000Z",
      "created_at": "2026-02-19T12:34:56.000000Z"
    },
    {
      "id": 2,
      "statusId": 5,
      "status_id": 5,
      "name": "Error",
      "notification": 1,
      "createdAt": "2026-02-19T12:35:10.000000Z",
      "created_at": "2026-02-19T12:35:10.000000Z"
    }
  ],
  "endToEndId": null,
  "reason": "Customer requested cancellation",
  "walletErrorCode": "PROCESSOR_ERROR",
  "callbackUrl": "https://your-domain.com/webhooks/credit-card-refund",
  "createdAt": "2026-02-19T12:34:56.000000Z",
  "updatedAt": "2026-02-19T12:35:10.000000Z"
}
```

## Authentication

Credit card refund webhooks are delivered with the following headers:

| Header | Value |
| - | - |
| `Accept` | `application/json` |
| `Content-type` | `application/json` |
| `User-Agent` | `WEpayments` |

> [!NOTE]
>
> If you have configured a **custom authentication header** for your account (callback authentication key and value), it will be included in every refund webhook request. Contact our support team to set up a custom authentication header so you can validate that the request was sent by WEpayments.

## Webhook Endpoint Requirements

Your webhook endpoint must:

* **Accept POST requests** - All webhook notifications are sent via POST
* **Use HTTPS** - Only secure HTTPS URLs are accepted
* **Return 200 OK** - Respond with a 200 status code within 5 seconds
* **Be publicly accessible** - The endpoint must be reachable from the internet

## Retry Policy

> [!NOTE]
>
> If your endpoint responds with a status code other than 200, the notification will be retried up to **15 times**, with a 5-minute interval between attempts.

## Related Resources

> [card] [Create Refund](https://docs.wepayout.co/api-reference/cash-in/refund/create-refund.md)
>
> Create a refund for a credit card charge

> [card] [Credit Card Webhook](https://docs.wepayout.co/credit-card/webhook.md)
>
> Notifications about the charge status

> [card] [About Credit Card](https://docs.wepayout.co/credit-card/about-credit-card.md)
>
> How credit card charges and refund modes work

> [card] [Create Credit Card Charge](https://docs.wepayout.co/api-reference/credit-card/create-charge.md)
>
> Create a new credit card charge


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.