Test your integration

Before going live, you should simulate various payment scenarios in the Sandbox environment to ensure your application handles both successful and failed transactions correctly.

Need advanced test cases? This topic covers the essential testing workflows. For a comprehensive list of specific amounts and parameters to trigger errors (NSF, Risk, Frozen Account, and so on), see Testing.

The Demo Bank

In the Sandbox environment, Trustly provides a simulated financial institution called "Trustly Bank" (or "Demo Bank"). This allows you to complete the entire payment flow without moving real money or using real banking credentials.

When the Trustly Lightbox opens:

  1. Select Trustly Bank from the bank list.
  2. Enter any non-empty string for the Username and Password. For example, user / password.
  3. Select an account (Checking or Savings) to complete the authorization.

Successful payment (happy path)

Verify that your application correctly handles a completed transaction.

  1. Start an Instant Payment or Trustly Pay flow with a valid amount such as 100.00.
  2. In the Lightbox, select Trustly Bank, log in, and approve the transfer.
  3. Confirm the customer is redirected to your returnUrl.
  4. Verify the following:
    • The URL parameters contain status=2 (Authorized).
    • The server logs show the Authorize webhook notification.

Customer cancellation

Verify that your application correctly handles customers who abandon the flow.

  1. Start a payment flow.
  2. In the Lightbox, click the X (Close) icon or the Cancel button on the login screen.
  3. Confirm the customer is redirected to your cancelUrl.
  4. Check that the URL parameters contain status=7 (Canceled).

Payouts and disbursements

To test Payouts or Disbursements, you must use specific account data to ensure the transaction is accepted by the backend.

Lightbox payouts

For standard Payouts (using the Lightbox), follow the Happy Path instructions. When you reach the account selection screen in the Demo Bank, select the Checking account.

Manual Disbursements

For API-based Disbursements, use the following test data to simulate a valid recipient.

FieldValueResult
Routing Number124003116Valid ABA Routing Number
Account Number123456575Simulates a valid account

Simulate errors

To ensure your error handling logic works, you can trigger specific decline states by using specific transaction amounts or account numbers.

For the complete list of Magic Amounts and triggers, see Testing.