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

# Testing

Complete guide to testing integration. Test data, scenarios, and validation checklist.

Thoroughly test your Localpayment integration before going live. This comprehensive guide provides test data, scenarios, and validation procedures to ensure your implementation works correctly across all payment methods and edge cases.

## Prerequisites

Before you begin testing, ensure you have the following configured:

> [card] [API Credentials](https://docs.localpayment.com/docs/api-keys-and-environments.md)
>
> Valid API credentials and access token for authentication.

> [card] [Account Setup](https://docs.localpayment.com/docs/make-your-first-test-payment.md)
>
> Proper account setup for your target country and business verification.

> [card] [IP Whitelisting](https://docs.localpayment.com/docs/dashboard-whitelist-your-ips.md)
>
> Whitelist your server IP addresses for API access.

> [card] [Webhook Endpoint](https://docs.localpayment.com/docs/webhooks.md)
>
> Set up a webhook URL to receive payment notifications.

***

## Sandbox Environment

The Stage environment is a complete replica of our production system, designed specifically for testing:

> [card] Realistic Processing
>
> Simulates actual payment flows and timing.

> [card] No Real Money
>
> All transactions use test data.

> [card] Full Feature Set
>
> All payment methods and operations are available.

> [card] Isolated Testing
>
> Your Stage data is kept separate from production.

***

## Test Data

### Card Payments

Test credit and debit card payments with various scenarios:

| Card Number | Scenario | Expected Result | Test Purpose |
| - | - | - | - |
| 4242424242424242 | ✅ Successful Payment | Immediate approval | Basic payment flow |
| 4000000000000002 | ❌ Card Declined | Decline with reason | Decline handling |
| 4000002500003155 | 🔐 3D Secure Required | Authentication redirect | 3D Secure flow |
| 4000000000009995 | ⚠️ Processing Error | Temporary failure | Balance checks |

**Standard Card Details:**

* **Expiry Date**: Any future date (e.g., 12/2029)
* **CVC**: Any 3-digit number (e.g., 123) for Mastercard and Visa cards or any 4-digit number (e.g., 1234) for American Express cards.
* **Cardholder Name**: Any test name (e.g., "John Doe")

***

## Error Scenario Testing

### Validation Errors

* Omit required fields (paymentMethod, amount)
* Use invalid formats (wrong currency, invalid document numbers)
* Test parameter constraints (amount limits, country restrictions)

### Authentication Tests

* Use expired access tokens
* Test with invalid credentials
* Verify IP whitelisting restrictions

***

## Webhook Testing

Ensure your webhook endpoint correctly handles notifications:

### Endpoint Configuration

* Verify HTTPS requirement
* Test signature verification
* Confirm immediate 200 OK response

### Event Processing

* Test all event types (payins, payouts, virtual accounts)
* Verify idempotency handling
* Confirm async processing

### Error Handling

* Test timeout scenarios
* Verify retry logic
* Monitor delivery failures

***

## Virtual Account Simulation (Stage)

For Virtual Account integrations, Localpayment provides a dedicated simulation endpoint to test the full lifecycle (Creation -> Funding -> Notification).

### Virtual Account Payments (Simulation)

To simulate a successful payment in Stage, use the same beneficiary data — name, document type, and document ID — that was provided when creating the virtual account. There are no separate test identities required; the [Simulate a Virtual Account Payment](https://docs.localpayment.com/reference/simulate-payin-to-virtual-account.md) endpoint will validate the payer data against the information registered during account creation.

### Core Test Scenarios:

| Scenario | Objective | Requirement |
| :- | :- | :- |
| **Verify Status** | Confirm account activation | Check [Get Virtual Account Status](https://docs.localpayment.com/reference/get-virtual-account-status.md) after creation. |
| **Simulate Pay-In** | Trigger a mock payment | Use [Simulate a Virtual Account Payment](https://docs.localpayment.com/reference/simulate-payin-to-virtual-account.md) with the same beneficiary data from account creation. |
| **Webhook Delivery** | Validate listener logic | Ensure `payin.completed` (status: `COMPLETED`) is received after simulation. |

> [!NOTE]
>
> **Important**
>
> * **Field Mapping**: For the simulation call, use the `beneficiary.bank.account.number` returned by [Get Virtual Account Status](https://docs.localpayment.com/reference/get-virtual-account-status.md) to identify the target account. The `externalId` in the simulation request should be a unique identifier for the payin transaction — use a different value for each request. Also include your real **accountNumber** (Merchant ID) to identify the project.
> * **Identities**: Use the same beneficiary data — name, document type, and ID — that was provided when creating the virtual account. See the [Full Simulation Guide](https://docs.localpayment.com/docs/simulate-virtual-account-payment.md) for details.

***

## Validation Checklist

Before moving to production, verify:

* **Payment Flows**: Confirm that all payment methods behave correctly, including both success and error scenarios.
* **Webhook Handling**: Ensure all webhook events are received, verified, and processed as expected.
* **Error Handling**: Display clear error messages to users and implement proper retry logic where needed.
* **Security**: Enforce HTTPS, verify signatures, and ensure all sensitive data is handled securely.
* **User Experience**: Provide clear loading states, helpful messaging, and smooth redirect flows throughout the payment journey.

***

## Testing Tools

Download our complete Postman collection with pre-configured test scenarios:

> [card] [Postman Collection](https://docs.localpayment.com/reference/postman-collection.md)
>
> Get the complete testing collection with environment templates


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.