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

# Transaction simulator webhooks

> Post webhook payloads to move simulated transactions, payouts, and refunds to their next state.

Some simulator responses leave a resource in a pending state, such as a
transaction marked as `capture_pending` or a payout marked as `processing`.
You can move these resources to their next state by posting a webhook payload to
the connector's webhook URL.

To send a webhook, grab the webhook URL for the connector from your dashboard,
and then post a JSON payload with the expected values.

The simulator routes each payload using its `event` field, so every payload must
include an `event` value that matches one of the supported events below.
The `payment_service_transaction_id` needs to be set to the ID of the transaction.
The rest of the fields are optional.

## Authorizations

### Authorization succeeded

Example payload:

```json theme={"system"}
{
  "event": "authorization.succeeded",
  "transaction_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "payment_service_transaction_id": "tx-12345",
  "scheme_transaction_id": "123456789012345",
  "payment_service_authorization_id": "auth-12345",
  "authorized_amount": 1299,
  "transaction_link_id": "123456789012345",
  "iso_response_code": "00",
  "raw_response_code": "00",
  "raw_response_description": "Approved",
  "merchant_advice_code": "01"
}
```

### Authorization failed

Example payload:

```json theme={"system"}
{
  "event": "authorization.failed",
  "transaction_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "payment_service_transaction_id": "tx-12345",
  "scheme_transaction_id": "123456789012345",
  "payment_service_authorization_id": "auth-12345",
  "authorized_amount": 0,
  "transaction_link_id": "123456789012345",
  "iso_response_code": "07",
  "raw_response_code": "E104",
  "raw_response_description": "System error",
  "merchant_advice_code": "01"
}
```

## Captures

### Capture succeeded

Example payload:

```json theme={"system"}
{
  "event": "capture.succeeded",
  "transaction_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "payment_service_transaction_id": "tx-12345",
  "scheme_transaction_id": "123456789012345",
  "payment_service_capture_id": "capture-12345",
  "capture_id": "b2c3d4e5-f6a7-8901-bcde-f21234567890",
  "capture_amount": 1299,
  "transaction_link_id": "123456789012345",
  "iso_response_code": "00",
  "raw_response_code": "00",
  "raw_response_description": "Approved",
  "merchant_advice_code": "01"
}
```

### Capture failed

Example payload:

```json theme={"system"}
{
  "event": "capture.failed",
  "transaction_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "payment_service_transaction_id": "tx-12345",
  "payment_service_capture_id": "capture-12345",
  "capture_id": "b2c3d4e5-f6a7-8901-bcde-f21234567890",
  "iso_response_code": "96",
  "raw_response_code": "E104",
  "raw_response_description": "System error"
}
```

## Refunds

### Refund succeeded

Example payload:

```json theme={"system"}
{
  "event": "refund.succeeded",
  "refund_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "payment_service_refund_id": "REFUND1234567890",
  "amount": 1299
}
```

## Payouts

### Payout succeeded

Example payload:

```json theme={"system"}
{
  "event": "payout.succeeded",
  "payout_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "xid": "PAYOUT1234567890",
  "raw_response_code": "00",
  "raw_response_description": "Approved"
}
```

### Payout declined

The simulator uses a `service_decline` code by default.

Example payload:

```json theme={"system"}
{
  "event": "payout.declined",
  "payout_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "xid": "PAYOUT1234567890",
  "code": "service_decline",
  "raw_response_code": "E104",
  "raw_response_description": "Declined"
}
```

### Payout failed

The simulator uses a `service_error` code by default.

Example payload:

```json theme={"system"}
{
  "event": "payout.failed",
  "payout_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "xid": "PAYOUT1234567890",
  "code": "service_error",
  "raw_response_code": "E104",
  "raw_response_description": "System error"
}
```

<Warning>
  Payout and refund webhooks are only available for the card simulator.
</Warning>
