# Simulate a PSE link payment

`POST /v1/sandbox/recharge-links/{slug}/pay` · [Sandbox only]

> Base URL: Sandbox `https://sandbox.zulu.com.co/v1`
>
> A test helper: it only exists in the sandbox.

Simulates someone paying a link (`PAID`) or the bank refusing the payment (`REFUSED`). An approved payment creates the deposit, credits your balance and sends the `RECHARGE_LINKS` and `DEPOSITS` webhooks. On open-amount links send the `amount` the payer "typed". Exists only in the sandbox.

## Authentication

`Authorization: Bearer <access_token>` (401 when missing or expired) and `X-API-Key` (403 when missing or not matching).

## Request

### Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `slug` | string | required | Link slug. |

### Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | optional | Idempotency key (up to 255 characters), valid for 24 hours per workspace. Repeating the call with the same key and body returns the original response with `Idempotent-Replayed: true`; a different body answers 422 and, while the first call is still running, 409. Production ignores it today: every call creates a new resource. max. 255 characters. [Sandbox · coming soon] |

### Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `outcome` | string | required | Payment outcome. Values: `PAID` (The payment is approved: the deposit is created.), `REFUSED` (The bank refuses the payment.). |
| `amount` | integer | optional | Amount the payer "typed": required on open-amount links; on fixed-amount links, omit it or send the same one. > 0. |
| `payer` | object | optional | Simulated payer. Whatever you omit is filled with deterministic synthetic data. |
| `payer.fullName` | string | optional | Full name or company name. max. 120 characters. |
| `payer.documentType` | string | optional | Document type. max. 10 characters. |
| `payer.documentNumber` | string | optional | Document number. max. 20 characters. |
| `payer.bankName` | string | optional | Payer's bank. max. 80 characters. |
| `failureReason` | string | optional | Refusal reason, only with `REFUSED`. max. 120 characters. |

## Responses

### 200

Payment simulated.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `rechargeLink` | object | required | A PSE payment link. |
| `rechargeLink.slug` | string | required | Public identifier of the link (Base58, 10 characters). |
| `rechargeLink.reference` | string | required | Your reference (the one you sent, or the slug when you sent none). The deposit the link produces carries it. |
| `rechargeLink.amount` | integer \| null | required | Fixed amount (COP); `null` when the payer types it. |
| `rechargeLink.concept` | string \| null | required | Concept the payer sees. |
| `rechargeLink.paymentMethod` | string | required | Payment method. Values: `PSE` (PSE (debit from any Colombian bank).). |
| `rechargeLink.status` | string | required | Link status. Values: `CREATED` (Created; nobody opened it yet.), `AWAITING_PAYMENT` (The payer opened the checkout; the payment is in progress.), `PAID` (Paid: the deposit is in your balance.), `REFUSED` (The bank refused the payment; the payer may retry.), `EXPIRED` (Expired unpaid.), `CANCELLED` (You cancelled it.). |
| `rechargeLink.checkoutUrl` | string | required | Payment page to share (a fake checkout in the sandbox). |
| `rechargeLink.expiresAt` | string (date-time) \| null | required | Expiry (UTC); `null` when it never expires. |
| `rechargeLink.paidAt` | string (date-time) \| null | required | Payment time (UTC); `null` until paid. |
| `rechargeLink.failureReason` | string \| null | required | Reason of the last refusal; `null` when there was none. |
| `rechargeLink.createdAt` | string (date-time) | required | Creation time (UTC). |
| `deposit` | any \| null | required | The deposit created; `null` when the payment was refused. |
| `deposit.depositId` | string | required | Deposit id: `SBX-MOV-CREDIT-{uuid}` in the sandbox. |
| `deposit.method` | string | required | How it arrived. Values: `PSE` (Payment of a PSE link.), `BRE_B` (Bre-B transfer to one of your keys.), `BRE_B_QR` (Payment of one of your Bre-B QR codes.). |
| `deposit.amount` | integer | required | Amount credited (COP, whole pesos). |
| `deposit.currency` | string | required | Always `COP`. Always `"COP"`. |
| `deposit.reference` | string | required | What it belongs to: the link's `reference` (PSE), the key that received it (Bre-B) or the QR's `reference` (or its id). |
| `deposit.externalId` | string | required | Network id (PSE CUS or Bre-B transfer id). Synthetic in the sandbox. |
| `deposit.payer` | object | required | Payer of the deposit. In the sandbox the data is synthetic (or what you send to the simulator). |
| `deposit.payer.fullName` | string | required | Full name or company name. |
| `deposit.payer.documentType` | string | required | Document type. |
| `deposit.payer.documentNumber` | string | required | Document number. |
| `deposit.payer.bankName` | string | required | Bank the payer paid from. |
| `deposit.createdAt` | string (date-time) | required | Arrival (UTC). |

### 400

Invalid request: the body is not JSON, a field has another type or fails its validation.

### 401

The access token is missing, invalid or expired.

### 403

The `X-API-Key` is missing, invalid or does not match the token.

### 404

The resource does not exist.

### 409

Conflict with the current state.

### 422

The operation can not be processed; nothing is recorded.

### 429

Too many requests: wait the seconds in `Retry-After`.

### 500

Internal error.

## Errors

| HTTP | error | cause | Description |
| --- | --- | --- | --- |
| 400 | `BadRequestApiError` | `error in struct validation` | One or more fields fail their validation. `values` carries one message per field, keyed by its JSON path, naming the Go validator that failed. |
| 400 | `BadRequestApiError` | `invalid json body: %s` | The body is not valid JSON, or a field has the wrong type (a string where a number goes, for example). Answered before the fields are validated. |
| 401 | — | `Unauthorized` | The `Authorization: Bearer <access_token>` header is missing, or the token is invalid or expired. |
| 403 | — | `Forbidden` | The `X-API-Key` is missing, unknown, revoked or does not belong to the credentials of the token. |
| 404 | `NotFoundApiError` | `recharge link "%s" not found` | No link with that slug exists in your workspace. |
| 409 | `ResourceConflictApiError` | `idempotency key "%s" is still being processed` | Another call with the same `Idempotency-Key` is still running. Retry in a few seconds to receive its response. |
| 422 | `UnprocessableEntityApiError` | `idempotency key "%s" was used with a different request` | The `Idempotency-Key` was already used in the last 24 hours with a different body or operation. Use a new key for every distinct operation. |
| 422 | `UnprocessableEntityApiError` | `recharge link "%s" is %s` | The link's status does not allow the operation (a `PAID` or `EXPIRED` link can no longer be cancelled or paid). |
| 422 | `UnprocessableEntityApiError` | `recharge link "%s" has no fixed amount: amount is required` | The link has an open amount: the simulator needs the `amount` the payer "typed". |
| 422 | `UnprocessableEntityApiError` | `amount %d does not match the amount of recharge link "%s"` | The link has a fixed amount and the `amount` sent differs. Omit it or send the same one. |
| 422 | `UnprocessableEntityApiError` | `amount %d is outside the allowed range of %d to %d` | The amount is outside the range allowed for PSE links. |
| 429 | — | `Too Many Requests` | You exceeded the request limit of your credentials. Wait the seconds in `Retry-After`. |
| 500 | `InternalServerApiError` | `[code:1] unexpected error` | Internal error. On operations that move money, check the state before retrying so the operation is not duplicated. |

## Examples

### Approved payment

```bash
curl https://sandbox.zulu.com.co/v1/sandbox/recharge-links/7QmVt3KpXz/pay \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "outcome": "PAID",
  "payer": {
    "fullName": "Marta Ruiz",
    "documentType": "CC",
    "documentNumber": "52123456",
    "bankName": "Banco Davivienda"
  }
}'
```

**Response 200**

```json
{
  "rechargeLink": {
    "slug": "7QmVt3KpXz",
    "reference": "FAC-2026-0042",
    "amount": 250000,
    "concept": "Cuota de noviembre",
    "paymentMethod": "PSE",
    "status": "PAID",
    "checkoutUrl": "https://developers.zulu.com.co/checkout/7QmVt3KpXz",
    "expiresAt": "2026-11-27T15:04:05.123Z",
    "paidAt": "2026-11-24T16:10:00.000Z",
    "failureReason": null,
    "createdAt": "2026-11-24T15:04:05.123Z"
  },
  "deposit": {
    "depositId": "SBX-MOV-CREDIT-8a4e1c2b-7d3f-4b6a-9e5c-0f1d2a3b4c5d",
    "method": "PSE",
    "amount": 250000,
    "currency": "COP",
    "reference": "FAC-2026-0042",
    "externalId": "SBXPSE2611241610001A7K",
    "payer": {
      "fullName": "Marta Ruiz",
      "documentType": "CC",
      "documentNumber": "52123456",
      "bankName": "Banco Davivienda"
    },
    "createdAt": "2026-11-24T16:10:00.000Z"
  }
}
```

### Payment refused by the bank

```bash
curl https://sandbox.zulu.com.co/v1/sandbox/recharge-links/7QmVt3KpXz/pay \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "outcome": "REFUSED",
  "failureReason": "Fondos insuficientes"
}'
```

**Response 200**

```json
{
  "rechargeLink": {
    "slug": "7QmVt3KpXz",
    "reference": "FAC-2026-0042",
    "amount": 250000,
    "concept": "Cuota de noviembre",
    "paymentMethod": "PSE",
    "status": "REFUSED",
    "checkoutUrl": "https://developers.zulu.com.co/checkout/7QmVt3KpXz",
    "expiresAt": "2026-11-27T15:04:05.123Z",
    "paidAt": null,
    "failureReason": "Fondos insuficientes",
    "createdAt": "2026-11-24T15:04:05.123Z"
  },
  "deposit": null
}
```

### The link was already paid

```bash
curl https://sandbox.zulu.com.co/v1/sandbox/recharge-links/7QmVt3KpXz/pay \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "outcome": "PAID"
}'
```

**Response 422**

```json
{
  "error": "UnprocessableEntityApiError",
  "cause": "recharge link \"7QmVt3KpXz\" is PAID"
}
```
