---
title: "Trustly"
canonical_url: https://docs.connect.worldline-solutions.com/payment-product/trustly/testing/globalcollect
---

* [Overview](https://docs.connect.worldline-solutions.com/payment-product/trustly/overview.md)
* [Countries \& currencies](https://docs.connect.worldline-solutions.com/payment-product/trustly/countries-and-currencies.md)
* [Integration](https://docs.connect.worldline-solutions.com/payment-product/trustly/integration.md)
* [Process flows](https://docs.connect.worldline-solutions.com/payment-product/trustly/process-flows.md)
* [Testing](https://docs.connect.worldline-solutions.com/payment-product/trustly/testing.md)
* [Additional information](https://docs.connect.worldline-solutions.com/payment-product/trustly/additional-information.md)
* [Consumer experience](https://docs.connect.worldline-solutions.com/payment-product/trustly/consumer-experience.md)
* [Reporting](https://docs.connect.worldline-solutions.com/payment-product/trustly/reporting.md)
* [FAQ](https://docs.connect.worldline-solutions.com/payment-product/trustly/faqs.md)

# Testing

You have two flexible options for testing Trustly:

1. Global Collect's Test Scenario Selector (Recommended) --- This is your default testing environment. It lets you quickly simulate different payment scenarios without additional setup, making it ideal for getting started right away.
2. Trustly's Test Environment --- If you prefer to test directly with Trustly's environment, simply contact your implementation manager. They'll help you switch the configuration so you can test against Trustly's systems.

# Test Scenario Selector

The Test Scenario Selector allows you to select payment product-specific test cases and specify the feedback timeframe. You must be onboarded for Trustly (Payment Product ID: 806) in pre-production to use it.

The Test Scenario Selector replaces the redirection to the third-party provider's test environment for payment completion, as described in the [Trustly Integration Section.](https://docs.connect.worldline-solutions.com/payment-product/trustly/integration/globalcollect.md)

To access the Test Scenario Selector, go to the [Configuration Center in the pre-production environment](https://login.preprod.connect.worldline-solutions.com/auth/realms/ingenico/protocol/openid-connect/auth?response_type=code&client_id=ConfigurationCenter&redirect_uri=https%3A%2F%2Faccount.preprod.connect.worldline-solutions.com&state=ee972166-10ae-4559-824e-e37783d648e3&login=true&scope=openid) and click the API Explorer. You can then select either Create Hosted Checkout or Create Payment to test your integration.

## Payment flow feedback types for Trustly

When testing Trustly in the pre-production environment, you can select from the following feedback types:

* Immediate notification: The test case response is returned immediately.
* Delayed notification (15 minutes): The test case response is returned within 15 minutes.
* Delayed notification (1--24 hours): The test case response is returned within 1 to 24 hours.
* Consumer failed to return: The consumer exits the session before being redirected back to your site.

## How to test Trustly

On the Test Scenario Selector page, a number of applicable test scenarios are displayed:

* Test case result (the outcome of the test case).
* Payment flow feedback (the timeframe within which feedback needs to be received).

![Test_scenario_selector_trustly_1.png](https://docs.connect.worldline-solutions.com/dA/729107a0a8/test_scenario_selector_trustly_1.png?language_id=1)

Only one test scenario can be simulated at a time.

1. Select **one** Test case result and **one** of the applicable Payment flow feedback options. The **refund outcome** can also be selected at this step if you would like to refund the transaction at a later stage.

![Test_scenario_selector_trustly_2.png](https://docs.connect.worldline-solutions.com/dA/48cf5471af/test_scenario_selector_trustly_2.png?language_id=1)

1. Click on the Submit button.

![Test_scenario_selector_trustly_3.png](https://docs.connect.worldline-solutions.com/dA/9e3473c55c/test_scenario_selector_trustly_3.png?language_id=1)

1. The transaction result is displayed.

![Payment status page showing EUR 100.00 order summary with three items and Your payment is successful confirmation message](https://docs.connect.worldline-solutions.com/dA/78bf6eca7e/trustly_sc_3.png?language_id=1)

### Test scenarios

|         Scenario         |                             Description                             |            End status             |                                                                    Payment flow feedback                                                                     |
|--------------------------|---------------------------------------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Successful               | Simulates a transaction successfully completed at the consumer bank | CAPTURED (800/900) or PAID (1000) | * Immediate Notification * Delayed Notification (15 minutes) * Delayed Notification (Next day) * Delayed Notification (Next day) * Consumer failed to return |
| Cancelled (unsuccessful) | Simulates a transaction cancelled by the 3rd party                  | REJECTED (125)                    | Immediate notification                                                                                                                                       |

### Testing refunds

* You can select refund scenarios on the Test Scenario along with the test case result and payment flow feedback.
* Only transactions in PAID status (1000) can be refunded, as described in [Refunds and Cancellations.](https://docs.connect.worldline-solutions.com/accepting-payments/payment-scenarios/refunds-and-cancellations.md)

![Testing_refunds_trustly_1.png](https://docs.connect.worldline-solutions.com/dA/96624ecc03/testing_refunds_trustly_1.png?language_id=1)

### Refund scenarios

You can select refund scenarios only when you choose a Successful test case result and a payment flow feedback type.  

|   Scenario   |                      Description                      | End status |
|--------------|-------------------------------------------------------|------------|
| Successful   | Simulates a successfully completed transaction refund | 1800       |
| Unsuccessful | Simulates a transaction refund that was rejected      |

# Trustly test environment

You can test Trustly through their test environment. To test different scenarios, use the [API Explorer](https://docs.connect.worldline-solutions.com/documentation/api-explorer.md) available through your [Configuration Center](https://docs.connect.worldline-solutions.com/documentation/configuration-center.md) account. Depending on your integration option, you can use different API calls for testing.

For MyCheckout hosted payment pages, send [POST /hostedcheckouts](https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/java/hostedcheckouts/create.html?paymentPlatform=ALL) API request and validate response:

* HTTP status code=201
* partialRedirectUrl contains a link

POST HOSTEDCHECKOUTS REQUESTCopy code

```hljs javascript language-javascript
{
  "order": {
    "references": {
      "merchantReference": "Example Merchant Reference"
    },
    "amountOfMoney": {
      "amount": 8500,
      "currencyCode": "EUR"
    },
    "customer": {
      "contactDetails": {
        "emailAddress": "connect@worldline.com"
      },
      "merchantCustomerId": "11011011",
      "billingAddress": {
        "countryCode": "NL"
      }
    }
  },
  "hostedCheckoutSpecificInput": {
    "variant": "100",
    "locale": "en_GB"
  }
}
```

1. Click the link in the response to access the hosted page displaying your selected variant. Then select Trustly from the payment product list.

![Trustly sc_1.png](https://docs.connect.worldline-solutions.com/dA/d36d8accd5/trustly sc_1.png?language_id=1)

1. For your own payment pages testing, send Create payment\>[POST /v1/{merchantId}/payments](https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/java/payments/create.html?paymentPlatform=ALL) API request and validate response:

* HTTP status code=201
* merchantAction.redirectURL contains a link to the provider's page
* payment.statusOutput.statusCode=20

POST PAYMENTS REQUESTCopy code

```hljs javascript language-javascript
{
  "order": {
    "references": {
      "merchantReference": "Example Merchant Reference"
    },
    "amountOfMoney": {
      "currencyCode": "EUR",
      "amount": 8500
    },
    "customer": {
      "personalInformation": {
        "name": {
          "firstName": "John",
          "surname": "Smith"
        }
      },
      "contactDetails": {
        "emailAddress": "connect@worldline.com"
      },
      "merchantCustomerId": "11011011",
      "billingAddress": {
        "countryCode": "NL"
      }
    }
  },
  "redirectPaymentMethodSpecificInput": {
    "redirectionData": {
      "returnUrl": "https://example.org/return"
    },
    "paymentProductId": 806
  }
}
```

POST PAYMENTS RESPONSECopy code

```hljs javascript language-javascript
{
  "creationOutput": {
    "additionalReference": "Example Merchant Ref",
    "externalReference": "Example Merchant Reference"
  },
  "merchantAction": {
    "actionType": "REDIRECT",
    "redirectData": {
      "RETURNMAC": "0b478cfe34dd4f6a914165b9af7c80b7",
      "redirectURL": "https://orb-ams1.gc.preprod.gi.worldline-solutions.com/orb/orb?ACTION=DO_START&REF=000008800410000075260000100001&MAC=3a1559f6e956410bbfdea491e824e359"
    },
    "showData": []
  },
  "payment": {
    "id": "000008800410000075260000100001",
    "paymentOutput": {
      "amountOfMoney": {
        "amount": 8500,
        "currencyCode": "EUR"
      },
      "references": {
        "merchantReference": "Example Merchant Reference",
        "paymentReference": "T88400063ZXA"
      },
      "paymentMethod": "redirect",
      "redirectPaymentMethodSpecificOutput": {
        "paymentProductId": 806
      }
    },
    "status": "REDIRECTED",
    "statusOutput": {
      "isCancellable": true,
      "isRetriable": false,
      "statusCategory": "PENDING_PAYMENT",
      "statusCode": 20,
      "statusCodeChangeDateTime": "20260428170937",
      "isAuthorized": false,
      "isRefundable": false
    }
  }
}
```

1. Fill the required fields **First name** and **Surname** , and click **Pay.**

**![Truslty_sc_2.png](https://docs.connect.worldline-solutions.com/dA/f0730fe5e3/truslty_sc_2.png?language_id=1)**

1. You will be redirected to the Trustly page. To proceed with your test payment, select **Set order options** and click **Continue.**

![Trustly_test_system_1.png](https://docs.connect.worldline-solutions.com/dA/7102d9634b/trustly_test_system_1.png?language_id=1)

1. Select the test cases from the overview on this page.

![Trustly_test_system_2.png](https://docs.connect.worldline-solutions.com/dA/3c0d8f0a9a/trustly_test_system_2.png?language_id=1)

1. After you select a bank, the checkout requests a login or personal ID.

* For all countries except Sweden, enter a value with 6 or more characters using only lowercase a--z and digits 0--9. Do not use spaces, hyphens, underscores, periods, commas, or special characters. When your input meets these requirements, the Continue button is enabled.
* For Sweden, enter a Swedish personal identity number (personnummer). You can use a synthetic number as long as it follows the valid format. The format is YYMMDDNNNN (10 digits) or YYYYMMDDNNNN (12 digits), with the last digit as a checksum. Example synthetic numbers: 1212121212 (10 digits) or 190112311113 (12 digits).

These rules apply only in the test environment. Do not use real consumer credentials.

![Trustly_test_system_3.png](https://docs.connect.worldline-solutions.com/dA/ecbcbd5a03/trustly_test_system_3.png?language_id=1)

1. Enter the one-time code displayed on the checkout and select **Continue.**

![Trustly_test_system_-4.png](https://docs.connect.worldline-solutions.com/dA/7fedea6cb7/trustly_test_system_-4.png?language_id=1)

1. Select a test bank account and select **Continue.**

![Trustly_test_system_5.png](https://docs.connect.worldline-solutions.com/dA/549ec58f49/trustly_test_system_5.png?language_id=1)

1. Enter the one-time code from the checkout and select **Confirm Payment.**

![Trustly_test_system_6.png](https://docs.connect.worldline-solutions.com/dA/6c290bd2f1/trustly_test_system_6.png?language_id=1)

1. The payment result displays in the browser. When the countdown completes or you select **Return to Merchant**, you are redirected to the website.

![Trustly_sc_3.png](https://docs.connect.worldline-solutions.com/dA/78bf6eca7e/trustly_sc_3.png?language_id=1)  

## Testing refunds

To start a refund process, you should use the API call [POST /v1/{merchantId}/payments/{paymentId}/refund](https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/java/payments/refund.html?paymentPlatform=ALL). This action is only applicable if the payment status is PAID. If you wish to refund the full order amount, you can do so by sending a request using the same API call, but with an empty body. Refer to the integration guide on specifics around Trustly refunds: [https://docs.connect.worldline-solutions.com/payment-product/trustly/integration/globalcollect#refund](https://docs.connect.worldline-solutions.com/payment-product/trustly/integration/globalcollect.md#refund)
[Next Additional information](https://docs.connect.worldline-solutions.com/payment-product/trustly/additional-information.md)
