# Workflow: test the integration

> Sandbox verification with test payments and webhooks, then the controlled first live payment.

## Sandbox (no bank, no money)

1. Create a payment through the application using `BANKEMES_TEST_API_TOKEN` (or `bankemes_create_test_payment`). Responses carry `"livemode": false`; the checkout page shows a test banner and never calls Kaspi.
2. `bankemes_simulate_test_payment({ payment_id, outcome: "paid" })` (also `failed`, `expired`, `cancelled`).
3. The worker delivers the signed `payment.paid` webhook within seconds; `bankemes_verify_test_webhook({ resource_id })` confirms the application answered 2xx.
4. Check that the application marked the order paid only after verifying the signature and re-reading the payment.

Remote invoices (`/api/v1/invoices/remote`) have no test token mode. Never send a remote invoice from acceptance checks to the real bank. For an isolated full-stack check, use the repository Kaspi simulator and isolated webhook transport; see [merchant-managed buyer subscriptions](https://bankemes.kz/for-agents/workflows/merchant-subscriptions).

## Going live

A sandbox pass proves the code, not the bank connection. Switch the application to `BANKEMES_API_TOKEN` and ask the customer to make one small real payment themselves. Report the live integration as working only after that payment is `paid` in Bankemes.

Source: https://bankemes.kz/for-agents/workflows/test-integration
