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

# Callback Charge

> Receive updates about your payin

<Note>
  **Endpoint**: `POST https://your.endpoint.to.notify`

  This is **your endpoint** where WEpayments will send notifications about payin status changes.
</Note>

## Response

You should respond with **200 OK** to acknowledge receipt of the webhook.

## Body

The webhook payload contains the following fields:

<ResponseField name="id" type="integer">
  Payin ID

  Example: `49339`
</ResponseField>

<ResponseField name="invoice" type="string">
  Payin invoice

  Example: `eb21ce52-2897-475b-85af-a5201f4035bf`
</ResponseField>

<ResponseField name="end_to_end" type="string">
  Payin end-to-end

  Example: `END-TO-END-ID`
</ResponseField>

<ResponseField name="status" type="object">
  Object that contains the current status of your payin.

  <Expandable title="Status Object">
    <ResponseField name="id" type="integer">
      Current status ID of your payin

      Example: `7`
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the current status of your payin

      Example: `Rejected`
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="status_detail" type="object">
  This object will only be returned if the payin is rejected/canceled and the merchant is using the "Account Mismatch" functionality. It provides more details on the reason for the rejection.

  <Expandable title="Status Detail Object">
    <ResponseField name="code" type="string">
      Code that represents the reason for the rejection

      Example: `WE0001`

      See [Status Detail Codes](#status-detail-codes) table below for all possible values.
    </ResponseField>

    <ResponseField name="detail" type="string">
      Explanation of the reason for the rejection

      Example: `The payment was made from an unregistered account.`
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="updated_at" type="string">
  Last update of your payin.

  Format: `<date-time>`

  Example: `2024-09-09T20:55:56.000000Z`
</ResponseField>

<ResponseField name="metadata" type="object">
  Additional metadata about the payment.

  <Expandable title="Metadata Object">
    <ResponseField name="paid_amount" type="number">
      Amount paid by the end user.

      <Warning>
        Since the `paid_amount` parameter contains sensitive financial information, we recommend considering this data only if you are verifying the webhook signature.
      </Warning>

      Example: `9.9`
    </ResponseField>

    <ResponseField name="payer" type="object">
      This object contains information about the payer of the payin.

      <Expandable title="Payer Object">
        <ResponseField name="bank_payer" type="object">
          Information about the end user's bank account used to pay the QR Code
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Webhook Payload Example

```json theme={null}
{
  "id": 49339,
  "invoice": "eb21ce52-2897-475b-85af-a5201f4035bf",
  "status": {
    "id": 7,
    "name": "Rejected"
  },
  "status_detail": {
    "code": "WE0001",
    "detail": "The payment was made from an unregistered account."
  },
  "updated_at": "2024-09-09T20:55:56.000000Z",
  "metadata": {
    "paid_amount": 9.9,
    "payer": {
      "bank_payer": {
        "bank_code": "001",
        "branch": "1234",
        "account": "12345678",
        "account_type": "checking",
        "holder_name": "Customer Name",
        "holder_document": "12345678900"
      }
    }
  }
}
```

## Status Codes

Common payin status codes:

| Status ID | Status Name     | Description                                 |
| --------- | --------------- | ------------------------------------------- |
| 1         | Created         | Charge has been created                     |
| 2         | Canceled        | Charge canceled due to expiration           |
| 3         | Rejected        | Charge rejected due to compliance           |
| 4         | Paid            | Charge successfully paid                    |
| 5         | Credited        | Amount is paid and available for withdrawal |
| 6         | Drop\_requested | Cancellation requested                      |

See [Payin Status Flow](/cash-in/status-flow) for detailed status information.

## Status Detail Codes

When a PIX transaction is rejected/canceled, the `status_detail.code` field provides specific information about the rejection reason:

| Code                                              | Description                                           |
| ------------------------------------------------- | ----------------------------------------------------- |
| `reason_payer_divergence`                         | CPF mismatch                                          |
| `reason_payer_restriction_deceased_holder`        | CPF restriction: deceased holder                      |
| `reason_payer_restriction_canceled`               | CPF restriction: canceled document                    |
| `reason_payer_restriction_suspended`              | CPF restriction: suspended document                   |
| `reason_payer_pending_regularization`             | CPF restriction: pending regularization               |
| `reason_payer_restriction_unknown`                | CPF restriction: unknown document                     |
| `gl_cpf_payer_restriction_underage`               | CPF restriction: underage (Brazilian law)             |
| `reason_payer_restriction_age_above_limit`        | Restriction: age above limit (> 80 years)             |
| `pending_challenge`                               | Pending challenge                                     |
| `reason_payer_restriction_receita`                | CPF restriction (Tax Authority)                       |
| `payer_restriction_high_risk`                     | CPF high risk                                         |
| `pending_review_manual`                           | Payment created; awaiting manual review               |
| `payer_restriction`                               | Rejected per compliance policy                        |
| `reason_payer_restriction_pep`                    | PEP (Politically Exposed Person)                      |
| `reason_payer_restriction_list_restrict`          | CPF on restriction list                               |
| `reason_payer_restriction_cpf_irregular`          | Irregular CPF                                         |
| `reason_payer_restriction_judicial_block`         | Judicial block                                        |
| `reason_payer_restriction_partners_and_ownership` | Certified restriction (partners/ownership)            |
| `reason_payer_restriction_ofac`                   | CPF on OFAC list                                      |
| `reason_payer_restriction_interpol`               | CPF on INTERPOL list                                  |
| `reason_payer_restriction_onu`                    | CPF on UN list                                        |
| `reason_payer_restriction_euro`                   | CPF on European restriction list                      |
| `WE0001`                                          | The payment was made from an unregistered account     |
| `WE0002`                                          | The payment was made from an unauthorized institution |
| `reason_payer_restriction_pld`                    | KYC restriction                                       |

<Note>
  These codes are only returned when the payin status is **Rejected/Canceled** and the merchant has the "Account Mismatch" functionality enabled.
</Note>

## Best Practices

<Note>
  **Always Respond 200 OK**: Your endpoint must respond with HTTP 200 to acknowledge receipt.
</Note>

<Warning>
  **Validate Webhook Signature**: Always validate the webhook signature to ensure it's from WEpayments. See [Webhook Signature Documentation](/concepts/webhooks) for details.
</Warning>

<Warning>
  **Verify paid\_amount**: The `paid_amount` field represents the actual amount paid by the customer and is important to consider for reconciliation.
</Warning>

## Related Resources

<CardGroup cols={3}>
  <Card title="Create Charge" icon="plus" href="/api-reference/cash-in/payin/create-charge">
    Create PIX or Boleto charges
  </Card>

  <Card title="Status Flow" icon="diagram-project" href="/cash-in/status-flow">
    Understand payin status lifecycle
  </Card>

  <Card title="Rejection Reasons" icon="circle-xmark" href="/cash-in/rejection-reasons">
    Learn about rejection codes
  </Card>

  <Card title="Get Charge" icon="magnifying-glass" href="/api-reference/cash-in/payin/get-unique-charge">
    Query charge details
  </Card>

  <Card title="Webhook Signature" icon="shield-check" href="/concepts/webhooks">
    Validate webhook signatures
  </Card>
</CardGroup>
