Testing & Demos

Testing your Smart Fields integration is a critical step before moving into production. With the Localpayment Sandbox, you can safely simulate real-world scenarios, validate your frontend and backend flows, and ensure your implementation is secure and stable.

Stage Environment

To test your integration, use the sandbox environment with test API keys. Configure your SDK initialization as follows:

const localpayment = LP({
    clientCode: 'your_stage_client_code',
    apiKey: 'your_stage_api_key'
});

In your application, make sure you are using both the correct API Key and the Stage SDK URL:

<script src="https://sdk.stage.localpayment.com/localpayment-sdk.min.js"></script>

Notes:

  • You must generate separate API Keys for each environment (Stage and Production).

  • Domains are validated at the moment a session is initialized. If the request comes from a non-registered domain, the SDK will return a “Invalid Source Domain” error.

  • Sandbox transactions do not move real money, but they simulate the full payment flow so you can test securely.

Test Card Numbers

You can use the following test card numbers to simulate different scenarios.

Brand
Card Number
Notes

Visa

4111 1111 1111 1111

Always succeeds

Mastercard

5555 5555 55554444

Always succeeds

Invalid Card

4242424242424241

Invalid card number

Declined

4000000000000127

Declined

Notes:

  • Use any valid future date for the expiration (e.g., 12/2028).

  • Use any valid 3-digit CVV (e.g., 123).

  • Use any name for the cardholder.

Error Simulation

Test your error handling by simulating these common scenarios:

Invalid Card Number

Expired Card

Session Expiration

Network Errors

Your integration should listen to error events from the SDK and handle them gracefully (e.g., show error messages to the user, retry).

Complete Test Example

Here's a complete example page you can use to validate your integration:

See full code example

Note: To run the example, serve the site from localhost (e.g., via a local web server). Ensure localhost is added as an allowed domain on the Smart Fields API Key you’re using; otherwise, session initialization will fail due to domain validation.

Last updated

Was this helpful?