# End-to-End Testing

Follow these steps to validate your complete integration before going to production.

## On-ramp (buy) test flow

### 1. Create a buy order

Call `POST /v2/buy` (API integration) or construct your referral URL (Referral integration) with:

- A valid test wallet address
- A supported crypto and fiat combination
- Your sandbox `redirectUrl`


Verify that you receive a `checkoutUrl` (API) or that your referral URL loads correctly.

### 2. Open the checkout

Navigate to the `checkoutUrl` in a browser or via your embedded checkout component.

Verify:

- The checkout loads without errors
- Pre-populated values (wallet address, crypto, fiat, amount) match what you submitted


### 3. Complete identity verification

Enter test personal details (realistic-looking name, address, date of birth).

If prompted for mobile verification, use:

- Mobile: any valid-format number
- PIN: `7203`


If prompted for document upload, use test document images.

### 4. Complete payment

Enter test card details:

- Card: `4111 1111 1111 1111`
- Expiry: any future date
- CVV: any 3 digits


### 5. Verify order completion

After completing payment:

- Confirm you are redirected to your `redirectUrl`
- Look up the order via `GET /v2/orders/{orderId}` and confirm `status` is `complete`
- Confirm a webhook was delivered to your configured endpoint with `status: "complete"`


## Off-ramp (sell) test flow

### 1. Create a sell order

Call `POST /v2/sell` with a test wallet address, crypto asset, and fiat currency.

### 2. Complete checkout

Open the `checkoutUrl`. Provide bank account details and complete any required KYC steps.

**Non-custodial:** The checkout will display a deposit address. In sandbox, no actual transfer is required — the order will simulate completion.

**Custodial:** The checkout will return the customer to your platform (via deeplink or webhook, depending on your configuration). Verify that your platform receives the deposit address correctly. In sandbox the order will simulate completion once the flow runs through.

### 3. Verify completion

Confirm the order reaches `complete` status via order lookup or webhook.

## Webhook test

1. Configure a webhook URL in the Partner Dashboard (use webhook.site or ngrok for local testing).
2. Create and complete an order.
3. Confirm the webhook is received with the correct `order_id` and `status`.
4. Confirm your endpoint responds with `200 OK`.
5. If using HMAC verification, confirm signature validation passes.


## iFrame / WebView test

If using embedded checkout:

1. Load the checkout URL in your iFrame or WebView component.
2. Verify the checkout renders correctly within your layout.
3. Confirm camera access works (attempt to reach the document upload step).
4. Complete a full order flow inside the embedded view.
5. Verify the WebView/iFrame navigates to your `redirectUrl` on completion.


## Ready for production

Once you have completed the end-to-end test flow and confirmed all components are working, notify Banxa to enable your production environment.