# Test without charging for real

Your merchant has **two keys**, and both are in the portal, under Settings:

| Key           | What for                                                 |
| ------------- | -------------------------------------------------------- |
| `evpk_live_…` | Production. Charges for real.                            |
| `evpk_test_…` | Testing. Touches no gateway and moves not a single peso. |

Switching environment means switching the key. **There is no other address, no other domain, no extra parameter**: the same API, the same `https://api.evetev.com/v1`, and the environment is decided by which key you called with.

```bash
curl https://api.evetev.com/v1/pagos \
  -H "Authorization: Bearer evpk_test_tu_llave_de_pruebas" \
  -H "Idempotency-Key: prueba-1" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantId": "tu-merchant-id",
    "monto": 89000,
    "moneda": "COP",
    "referencia": "prueba-1"
  }'
```

## What you can test today

- That your key authenticates and that your `merchantId` is the right one.
- That your request is well formed: validation errors are **the same** as in production, with the same per-field detail.
- That your error handling works: try sending a negative amount, a `urlRetorno` on another domain, or reusing an `Idempotency-Key` with a different body.
- That idempotency does what you expect: repeat the same key with the same body and we return the charge that already existed, without creating another.
- Reading your test charges: `GET /v1/pagos` and `GET /v1/pagos/:id` with the test key return yours.
- **Building your PSE bank selector.** `GET /v1/pagos/bancos` with the test key returns a list of banks with exactly the shape of the real one —code and name— without calling the gateway. It includes BANKA, the test bank.
- **Completing the payment and receiving your webhook**, with the same signature as in production. That is what follows.

## Completing the payment

Nobody pays a test charge: you complete it yourself, with an endpoint that **only exists for the sandbox**.

```bash
curl -X POST https://api.evetev.com/v1/pagos/{id}/simular \
  -H "Authorization: Bearer evpk_test_tu_llave" \
  -H "Content-Type: application/json" \
  -d '{ "resultado": "aprobado" }'
```

`resultado` is `aprobado` or `fallido`. Those are the only two, because they are the only two events EvePay actually emits: offering you «refunded» here would be teaching you a webhook that is never going to reach you.

When you simulate, **your webhook receives the event exactly as in production**: the same body, the same signature, the same header. It is not a separate path — underneath it goes through the same code that runs when the real gateway reports in. If your signature verification works here, it works there.

Simulating the same result twice does not deliver two events, and simulating `fallido` on an already approved charge does nothing: the transition is not valid.

With that you can exercise what actually costs you:

- That your signature verification accepts the good one and rejects the bad one.
- That you read the **raw** body and not the already parsed one.
- That you survive the same event twice without shipping twice.
- That you answer `200` quickly and do the heavy work afterwards.

> **Only with the test key, and only on test charges.** With the production key it answers 409, and a real charge cannot be simulated even with the test key. Real money is moved by whoever buys.

## The whole path, from the browser

The `checkoutUrl` of a test charge leads to a screen with two buttons: «pretend I paid» and «pretend it failed». On click, EvePay sends the webhook and **returns you to your return page**, exactly as the real gateway would.

With that you can walk the entire journey without leaving the browser: your store → pay → your thank-you page. That is precisely where a sale is lost if something is wrong, and until now it could not be rehearsed.

The screen says in large type that it is not a checkout. Your customer will see something else.

> **The link is the credential.** It carries an identifier that only exists inside the `checkoutUrl`, like any payment link. And that address **does not exist for real charges**: with a production charge it answers 404.

## What you still CANNOT test

- Choosing the bank on the payment screen: it asks for no details, it just completes the charge.
- Test cards or cash: those methods are not enabled yet, not even in production.
- Simulating a gateway outage or a delay.

## What the test environment guarantees

This is not a marketing promise, it is how it is built:

- A charge made with a test key **does not write a single movement** into our ledger.
- It does not enter any disbursement batch or any payable balance.
- It does not show up in your production listings or totals, and the other way round: with the production key you do not see the test ones.
- What was born a test is a test forever. There is no way to turn it into a real one.

Fees are calculated **with your real rate**, so that what you see in `GET /v1/pagos/:id/liquidacion` is the number you are actually going to pay. A sandbox that lies about the fee is not much use.

## If something does not add up

If a test key creates a charge that shows up in your real numbers, **that is a bug on our side and we want to know the same day**: [contacto@evetev.com](mailto:contacto@evetev.com).
