Trustly

Overview

Trustly is a payment method to perform payments by using online banking. You can perform purchases and COF purchases through this method by using Payment Page and Gate, refunds and payouts by using Gate.

There are two ways of payout processing: with the redirection of the customer and without it. Refer to your ECommPay key account manager for more information about the applicable processing way.

General information

Payment method type Online banking
Countries and regions AT, BE, BG, CY*, CZ, DE, DK, EE, ES, FI, FR*, GB, GR*, HR*, HU, IE, IT, LT, LU*, LV, MT*, NL, NO, PL, PT*, RO, SE, SI, SK
Payment currencies EUR, BGN, CZK, DKK, EUR, GBP, HUF, NOK, PLN, RON, SEK
Currency conversion On the Trustly side
Purchases +
Payouts +
Stored credentials payments + **
Full refunds +
Partial refunds +
Chargebacks
Notes
  • We recommend to use Additional payment information submission for payment processing
  • To perform payments by using Gate, you must place the Trustly logo on your payment form. Detailed requirements can be found here. To download logo click
  • The processing of a payout performed without the redirection of the customer depends on the recepient's bank and can take up to three days
Onboarding and access fee Refer to your ECommPay key account manager

* Only payouts are supported in these countries.

** Stored credentials payments are available only for customers who are clients of selected Swedish banks.

Interaction diagram

Payment processing by using the Trustly payment method requires merchant's web service, one of ECommPay interfaces, and the ECommPay payment platform, as well as the Trustly technical facilities.



Operations support

  Interfaces Amounts, EUR (or equivalent) Times**
Payment Page CMS Plug-ins Gate Dashboard (Old Dashboard) minimum maximum basic threshold
Purchases + + 1.00 * *
Payouts + * *
Stored credentials payments + + * *
Full refunds + * *
Partial refunds + * *

* For more information refer to the ECommPay key account manager.

** The basic and threshold times are defined as follows:
  • The basic time is the average estimated time between the moment a payment is initiated in the payment platform to the moment the payment result is sent to the initiator. The basic time evaluation is made on the assumption of normal operation of all technical facilities and communication channels and typical customer behaviour (if any input from customer is required). Use the basic time to estimate when to react to the absence of payment result notifications or when to check payment status.
  • The threshold time is the maximum possible time between the moment a payment is initiated in the payment platform to the moment the initiator receives the callback with the payment result. A payment is automatically declined, if its waiting time exceeds the threshold time. For individual setting of the threshold time limit, contact ECommPay technical support.

Processing scenarios

In the Trustly method, to perform a purchase or payout operation, you need to redirect customer to the Trustly service, while to initiate a refund, you need to notify customer via merchant's web service.

Figure: Purchase by using Payment Page



Figure: Purchase by using Gate



Figure: Refund by using Gate



Figure: Payout by using Gate without the redirection of the customer



Figure: Payout by using Gate with the redirection of the customer



The sections that follow provide detailed information about what you need to perform payments and how you can analyse the information on payments and operations.

Purchases by using Payment Page

General information

In the Trustly method, to perform a purchase by using Payment Page, the merchant web service should send a request with all the required parameters and signature to the ECommPay URL and get the callback with the payment result from the payment platform. When opening Payment Page, you can have Payment Page opened with the Trustly method selected. For more information about preselecting payment methods, see in Preselecting payment method.

The full sequence and particularities of the purchase process are provided below.



Figure: Purchase sequence in the Payment Page method:

  1. A customer initiates a purchase on the merchant's web service.
  2. The web service sends the request for Payment Page opening to the specified ECommPay URL.
  3. The request for opening is redirected to the payment platform.
  4. The payment platform performs the initial request processing that involves validation of the required parameters and signature.
  5. Requested Payment Page is generated into the ECommPay payment platform as specified in the project settings and the request parameters.
  6. Payment Page is displayed to the customer.
  7. The customer selects the Trustly method.
  8. The payment platform receives the purchase request for payment processing from Payment Page.
  9. The payment platform performs the internal purchase request processing and sends it to the Trustly service, if all the necessary parameters for making the payment are passed in the request. Otherwise, additional parameters are requested from the customer.
  10. The purchase request is processed on the Trustly service side.
  11. The Trustly service generates the data for redirecting the customer to its website form and sends it to the payment platform.
  12. The payment platform sends the customer redirection data to Payment Page.
  13. The customer is redirected to the Trustly website.
  14. The customer completes all the payment steps required.
  15. The payment is processed on the Trustly side.
  16. The Trustly service sends the result notification to the payment platform.
  17. The payment platform sends a callback with the payment result to the web service.
  18. The payment platform sends the result to Payment Page.
  19. A page with the payment result information is displayed to the customer on Payment Page.

The sections that follow discuss in more details the request format and the Payment Page parameters to use in the Trustly payment method and provide the information on the format of callbacks with payment results. For the general information on how to use the API, see Payment Page API Description.

Request format

There are several things you need to consider when using the Trustly method:

  1. You must provide values for the basic minimum of parameters. Listed below are the parameters that are mandatory for any payment method:
    • project_id—the project ID obtained from ECommPay
    • payment_id—payment ID unique within the project
    • payment_currency—payment currency in ISO-4217 alpha-3 format
    • payment_amount—payment amount in minor units
  2. The ID of the customer within the project must be specified in the customer_id parameter.
  3. The currency of payment can only be one from the General information section.
  4. Additional parameters are required for payment. They are not required to open the Payment Page, but they are always requested from the customer if they were not passed in the request. Additional (required) parameters for payment:
    • customer_first_name—customer first name
    • customer_last_name—customer last name
    • customer_email—email address
    • customer_country—country code in accordance with ISO 3166-1 alpha-2
    • language_code—language code in accordance with ISO 639-1 alpha-2
  5. If you need to have payment form displayed with the Trustly method selected, set the force_payment_method parameter to online-banking-trustly.
  6. Also some additional parameters may be requested. The list of them depends on the merchant business type. These parameters may be passed in the request for the Payment Page opening or left to be filled in by customer.

    The list of possible parameters:
    • identify_doc_number—number of the identity document
    • customer_phone—customer phone
    • payment_extra_param—object with additional data:
      • shipping—shipping address info:
        • address—full shipping address. This parameter may be used for passing shipping address, but as alternative you may use other parameters from the payment_extra_param.shipping object
        • address_country—country code in accordance with ISO 3166-1 alpha-2
        • address_postal_code—postal code
        • address_city—city
        • address_line1—street
        • address_line2—additional information
      • beneficiary—information about the recipient of a money transfer:
        • day_of_birth—day of birth or registration number (if recipient is organisation)
        • party_type—recipient type (PERSON or ORGANISATION),
        • first_name—first name or company name (for organisation)
        • last_name—last name (the parameter value may be empty if recipient is organisation)
        • customer_id—unique identifier of the payment or client for money transfer
        • address—address without country name
        • country—country name code in accordance with ISO 3166-1 alpha-2
  7. If required, you can also add any other additional parameters Payment Page supports.
  8. After you specify all the parameters you need, you must create the signature for the request. For instructions on how to sign a payment request, see Signature generation and verification.

Thus, a correct payment request in the Trustly method must include project and payment IDs, the currency and the amount of a payment in the appropriate currency, as shown in the following example:

EPayWidget.run(
    { payment_id: 'X03936', 
      payment_amount: 1000, 
      payment_currency: 'EUR', 
      project_id: 100,
      customer_id: '1234567', 
      signature: "kUi2x9dKHAVNU0FYldJrxh4yo+52Kt8KU+Y1Y4HASCQ9vySO\/R
                             LCvhtT4DqtVUkDJrOcZzUCwX6R\/ekpZhkIQg=="
    }
)

Here is a correct payment request in the Trustly method (with passing of the additional parameters):

EPayWidget.run(
   {    
"payment_id": "X03936",
"payment_amount": 1000,
"payment_currency": 'EUR',
"project_id": 100,
"signature": "kUi2x9dKHAVNU0FYldJrxh4yo+52Kt8KU+Y1Y4HASCQ9vySO\/R
                             LCvhtT4DqtVUkDJrOcZzUCwX6R\/ekpZhkIQg==",
"customer_id": "1234567",
"customer_first_name": "John",
"customer_last_name": "Smith",
"customer_email": "john.smith@test.com"
"customer_country": "SE",
"customer_phone": "123456789",
"language_code": "en",
"identify_doc_number": "SE987546-654",
"payment_extra_param": {
    "shipping": {
        "address_country": "SE",
        "postal_code": "SE1234",
        "address_city": "Stockholm",
        "address_line1": "15 Street",
        "address_line2": "160A"
        },
    "beneficiary": {
        "day_of_birth": "2000-12-20",
        "party_type": "PERSON",
        "first_name": "Eddy",
        "last_name": "Stockmann",
        "customer_id": "321789",
        "address": "Stockholm Avenue 123 A1",
        "country": "SE"
        }
    }    
}
)

For information about all parameters available in the Trustly method, see Payment Page invocation parameters.

Callback format

The Trustly method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 20.00 EUR purchase made by the 1 customer in the 200 project.

Figure: Example of a successful purchase callback

 {
        "project_id": 200,
        "payment": {
            "id": "ECT_TEST_1561994171758",
            "type": "purchase",
            "status": "success",
            "date": "2019-07-01T15:26:40+0000",
            "method": "trustly",
            "sum": {
                "amount": 2000,
                "currency": "EUR"
            },
            "description": "ECT_TEST_1561994171752"
        },
        "customer": {
            "id": "1"
        },
        "operation": {
            "id": 28970000003316,
            "type": "sale",
            "status": "decline",
            "date": "2019-07-01T15:26:40+0000",
            "created_date": "2019-07-01T15:26:08+0000",
            "request_id": "63088b14f83a0bb48882dedfe2cc7fa6aaff",
            "sum_initial": {
                "amount": 2000,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 2000,
                "currency": "EUR"
            },
            "provider": {
                "id": 1246,
                "payment_id": "1076832",
                "date": "2019-07-01T15:26:39+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "GLZgBiriazPCzp3Kj+Pso7V1FNJvNc0WssilWp0lPfM0sUV0Bv3LZl
                                         KumYVzCi6wy9eTBEyl14X4HYxNwZJ94Q=="
    }
}

The following is the example of a callback for a purchase declined because account owner cancelled operation.

Figure: Example of a declined purchase callback

 {
        "project_id": 200,
        "payment": {
            "id": "ECT_TEST_1561994171758",
            "type": "purchase",
            "status": "decline",
            "date": "2019-07-01T15:26:40+0000",
            "method": "trustly",
            "sum": {
                "amount": 2000,
                "currency": "EUR"
            },
            "description": "ECT_TEST_1561994171752"
        },
        "customer": {
            "id": "1"
        },
        "operation": {
            "id": 28970000003316,
            "type": "sale",
            "status": "decline",
            "date": "2019-07-01T15:26:40+0000",
            "created_date": "2019-07-01T15:26:08+0000",
            "request_id": "63088b14f83a0bb48882dedfe2cc7fa6aaff",
            "sum_initial": {
                "amount": 2000,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 2000,
                "currency": "EUR"
            },
            "provider": {
                "id": 1246,
                "payment_id": "1076832",
                "date": "2019-07-01T15:26:39+0000",
                "auth_code": ""
            },
            "code": "20301",
            "message": "Account owner cancelled operation"
        },
        "signature": "GLZgBiriazPCzp3Kj+Pso7V1FNJvNc0WssilWp0lPfM0sUV0Bv3LZl
                                         KumYVzCi6wy9eTBEyl14X4HYxNwZJ94Q=="
    }
}

Related topics

The following topics might be useful when implementing payments by using Payment Page:

Purchases by using Gate

General information

In the Trustly methods, when processing a purchase by using Gate, the merchant web service is required to do the following:

  1. Send a request with all the required parameters and signature to the ECommPay URL.
  2. Perform the redirection of a customer to the Trustly service.
  3. Get the callback with the payment result from the payment platform.

The following diagram provides the detailed picture of the payment processing procedure.



Figure: Purchase by using Gate

  1. A customer initiates a purchase through Trustly on the merchant's web service side.
  2. The web service sends the request for processing the purchase by using Gate to the specified ECommPay URL.
  3. The payment platform receives the request for processing the purchase from Gate.
  4. The payment platform performs the initial request processing that includes validation of the required parameters and signature.
  5. The payment platform sends the response with request receipt confirmation and correctness check result to the web service. For more information, see Response format.
  6. The payment platform performs the internal payment request processing and redirects the request to the Trustly service, if all the necessary parameters for making the payment are passed in the request. Otherwise, additional parameters are requested.
  7. The request is processed on the Trustly side.
  8. The Trustly service sends the data for redirecting the customer to the Trustly service to the payment platform.
  9. The payment platform sends the callback with the redirection data in the redirect_data object to the web service.
  10. The customer is redirected from the web service to the Trustly service.
  11. The customer completes all the payment steps required.
  12. The payment is processed on the Trustly side.
  13. The Trustly service sends the payment result notification to the payment platform.
  14. The payment platform sends a callback to the web service.
  15. The customer receives the payment result on the web service.

The sections that follow discuss in more details the request format and the Gate parameters to use in the Trustly payment method and provide the information on the format of callbacks with purchase results.

Request format

There are several things you must consider when using purchase requests in the Trustly method:

  1. You send purchase requests by sending the /v2/payment/online-banking/trustly/sale request by using HTTP method POST. This is online banking request group: /v2/payment/online-banking/{payment_method}/sale.
  2. The following objects and parameters must be specified in any request:
    • general—object that contains general request identification information:
      • project_id—the project ID obtained from ECommPay
      • payment_id—payment ID unique within the project
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification);
    • customer—object that contains customer information:
      • id—customer ifentifier unique within the project
      • ip_address—IP address
      • first_name—first name
      • last_name—last name
      • email—email address
      • country—country code in accordance with ISO 3166-1 alpha-2
      • language—language code in accordance with ISO 639-1
    • payment—object that contains customer information:
      • amount—purchase amount
      • currency—purchase currency in ISO-4217 alpha-3 format
    • return_url—URL for redirection:
      • success—in case of success
      • decline—in case of decline
  3. The currency of payment can only be one from the General information section.
  4. Additionally some other parameters may be required:
    • customer.phone—customer phone
    • additional_data.shipping—shipping address info:
      • address—full shipping address. This parameter may be used for passing shipping address, but as alternative you may use other parameters from the payment_extra_param.shipping object
      • address_country—country code in accordance with ISO 3166-1 alpha-2
      • address_postal_code—postal code
      • address_city—city
      • address_line1—street
      • address_line2—additional information
    • additional_data.beneficiary—information about the recipient of a money transfer:
      • day_of_birth—day of birth or registration number (if recipient is organisation)
      • party_type—recipient type (PERSON or ORGANISATION),
      • first_name—first name or company name (for organisation)
      • last_name—last name (the parameter value may be empty if recipient is organisation)
      • customer_id—unique identifier of the payment or client for money transfer
      • address—address without country name
      • country—country name code in accordance with ISO 3166-1 alpha-2

    The list of them depends on the merchant business type. If web service supports clarification of parameters, then you will receive a message with a list of missing parameters in a callback. For more information see Additional payment information submission.

    If web service does not support clarification of parameters, then you need to pass all those parameters (from the second and fourth points) in the purchase request.

  5. If required, you can also add any other additional parameters Gate supports.
  6. After you specify all the parameters you need, you must create the signature for the request. For instructions on how to sign a payment request, see Signature generation and verification.

Thus, a correct payment request in the Trustly method must include project and payment IDs, customer data, currency and amount of the purchase, return URLs, as shown in the following example:

Figure: Example of a purchase request (with clarification support)

{
  "general": {
    "project_id": 200,
    "payment_id": "ECT_TEST_1561994171758",
    "signature": "+e6gss++zs/St78SnjYwwOdf+fejG8RLjoSlFUdMLR5EJ0pBSulQK
                                   lBQQi3wCFVYnEm7M13MAerP3eTOLViNkA=="
  },
  "customer": {
    "id": "123",
    "email": "example@mail.com",
    "first_name": "John",
    "last_name": "Johnson"
  },
  "payment": {
    "amount": 2000,
    "currency": "EUR"
  }
}

Formats of the customer redirection data

To redirect a customer from the web service to the Trustly site, you must receive a callback from the payment platform containing the URL for redirection in the redirect_data.url parameter and data to be sent in the request body in the redirect_data.body parameter, and use these parameters when opening the HTML page using the method specified in the redirect_data.method parameter.

The following is the callback fragment containing the token for purchase.

 "redirect_data": {
                    "body": [],
                    "method": "GET",
                    "url": "https://example.com/en/v1.1/payment/903d8cd4-b8e9-066727d8826c"
                }

Callback format

The Trustly method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 20.00 EUR purchase made by the 1 customer in the 200 project.

Figure: Example of a successful purchase callback

 {
        "project_id": 200,
        "payment": {
            "id": "ECT_TEST_1561994171758",
            "type": "purchase",
            "status": "success",
            "date": "2019-07-01T15:26:40+0000",
            "method": "trustly",
            "sum": {
                "amount": 2000,
                "currency": "EUR"
            },
            "description": "ECT_TEST_1561994171752"
        },
        "customer": {
            "id": "1"
        },
        "operation": {
            "id": 28970000003316,
            "type": "sale",
            "status": "decline",
            "date": "2019-07-01T15:26:40+0000",
            "created_date": "2019-07-01T15:26:08+0000",
            "request_id": "63088b14f83a0bb48882dedfe2cc7fa6aaff",
            "sum_initial": {
                "amount": 2000,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 2000,
                "currency": "EUR"
            },
            "provider": {
                "id": 1246,
                "payment_id": "1076832",
                "date": "2019-07-01T15:26:39+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "GLZgBiriazPCzp3Kj+Pso7V1FNJvNc0WssilWp0lPfM0sUV0Bv3LZl
                                         KumYVzCi6wy9eTBEyl14X4HYxNwZJ94Q=="
    }
}

The following is the example of a callback for a purchase declined because account owner cancelled operation.

Figure: Example of a declined purchase callback

 {
        "project_id": 200,
        "payment": {
            "id": "ECT_TEST_1561994171758",
            "type": "purchase",
            "status": "decline",
            "date": "2019-07-01T15:26:40+0000",
            "method": "trustly",
            "sum": {
                "amount": 2000,
                "currency": "EUR"
            },
            "description": "ECT_TEST_1561994171752"
        },
        "customer": {
            "id": "1"
        },
        "operation": {
            "id": 28970000003316,
            "type": "sale",
            "status": "decline",
            "date": "2019-07-01T15:26:40+0000",
            "created_date": "2019-07-01T15:26:08+0000",
            "request_id": "63088b14f83a0bb48882dedfe2cc7fa6aaff",
            "sum_initial": {
                "amount": 2000,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 2000,
                "currency": "EUR"
            },
            "provider": {
                "id": 1246,
                "payment_id": "1076832",
                "date": "2019-07-01T15:26:39+0000",
                "auth_code": ""
            },
            "code": "20301",
            "message": "Account owner cancelled operation"
        },
        "signature": "GLZgBiriazPCzp3Kj+Pso7V1FNJvNc0WssilWp0lPfM0sUV0Bv3LZl
                                         KumYVzCi6wy9eTBEyl14X4HYxNwZJ94Q=="
    }
}

Related topics

The following topics might be useful when implementing payments through Gate:

COF purchases by using Payment Page

General information

The Trustly method supports three types of COF purchases: OneClick, regular payments, and autopayments. For more information about COF purchases types, see the COF purchase registration section.

Note: COF purchases are available only for customers who are clients of selected Swedish banks. Not all banks available under the Trustly method support COF purchases or some of their types.

The registration of COF purchases through the Payment Page can be performed during the initial payment, when the customer agrees to perform COF purchases on the Trustly payment form. Further OneClick payments can be made without re-authorizing the customer on the Trustly payment form through the Payment Page and Gate. Regular and autopayments are carried out without customer intervention through Gate (for more information, see COF purchases by using Gate).

COF purchases registration

To register COF purchases at the time of payment, the customer on the Trustly payment form must agree to make COF purchases using the Trustly service. After successful payment according to the standard scheme described in the section Purchases by using Payment Page, two callbacks are passed to the merchant’s web service:

  • callback of successful payment
  • repeated callback of a successful payment with information about registered COF purchases (on the next business day)

Information about registered COF purchases is contained in the recurring object.

Figure: Example of a successful COF purchase registration

{
        "project_id": 1625,
        "payment": {
            "id": "ID_1234567890000",
            "type": "purchase",
            "status": "success",
            "date": "2019-09-16T15:18:02+0000",
            "method": "trustly",
            "sum": {
                "amount": 100,
                "currency": "EUR"
            },
            "description": "Trustly sale transaction"
        },
        "account": {
            "number": "1902377919"
        },
        "customer": {
            "id": "123"
        },
        "recurring": {
            "id": 1007592570,
            "currency": "EUR",
            "valid_thru": "2020-01-31T00:00:00+0000"
        },
        "operation": {
            "id": 6841000003665,
            "type": "sale",
            "status": "success",
            "date": "2019-09-16T15:18:03+0000",
            "created_date": "2019-09-16T15:15:13+0000",
            "request_id": "==request id==",
            "sum_initial": {
                "amount": 100,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 100,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "1784257774",
                "date": "2019-09-16T15:18:02+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "ajfgtBiriazPCzp3Kj+Pso7V1FNJvNc0WssilWp0lPfM0sUV0Bv3LZl
                                         KumYVzCi6wy9eTBEyl14X4HYxNwZJ94Q=="
    }

OneClick payments processing

After successful registration of COF purchases, OneClick payments are performed without authorisation of the customer using the saved data. OneClick payments follow the following scheme.



Figure: OneClick payment by using Payment Page

  1. A customer initiates a purchase on the merchant's web service.
  2. The web service sends the request for Payment Page opening to the specified ECommPay URL.
  3. The request for opening is redirected to the payment platform.
  4. The payment platform performs the initial request processing that involves validation of the required parameters and signature.
  5. Requested Payment Page is generated into the ECommPay payment platform as specified in the project settings and the request parameters.
  6. Payment Page is displayed to the customer.
  7. The customer selects the Trustly method.
  8. The list of saved payment instruments is displayed to the customer.
  9. The customer selects saved payment instrument.
  10. The payment platform receives the purchase request for payment processing from Payment Page.
  11. The payment platform performs the internal purchase request processing and sends it to the Trustly service, if all the necessary parameters for making the payment are passed in the request. Otherwise, additional parameters are requested from the customer.
  12. The payment is processed on the Trustly side.
  13. The Trustly service sends the result notification to the payment platform.
  14. The payment platform sends a callback with the payment result to the web service.
  15. The payment platform sends the result to Payment Page.
  16. A page with the payment result information is displayed to the customer on Payment Page.

Callback format

The Trustly method uses the standard format for callbacks to deliver OneClick purchase results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 1.00 EUR purchase made by the 123 customer in the 1625 project.

Figure: Example of a successful callback for OneClick payment

{
        "project_id": 1625,
        "payment": {
            "id": "ID_1568639174831",
            "type": "recurring",
            "status": "success",
            "date": "2019-09-17T07:12:03+0000",
            "method": "trustly",
            "sum": {
                "amount": 100,
                "currency": "EUR"
            },
            "description": "Trustly COF purchase"
        },
        "customer": {
            "id": "123"
        },
        "recurring": {
            "id": 1007592570,
            "currency": "EUR"
        },
        "operation": {
            "id": 2110000003671,
            "type": "recurring",
            "status": "success",
            "date": "2019-09-17T07:12:03+0000",
            "created_date": "2019-09-17T07:10:02+0000",
            "request_id": "63088b14f83a0bb48882dedfe2cc7fa6aaff",
            "sum_initial": {
                "amount": 100,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 100,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "1562050323",
                "date": "2019-09-17T07:12:01+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "khgsuyriazPCzp3Kj+Pso7V1FNJvNc0WssilWp0lPfM0sUV0Bv3LZl
                                         sgjhVzCi6wy9eTBEyl14X4HYxNwZJ94Q=="
    }

COF purchases by using Gate

General information

The Trustly method supports three types of COF purchases: OneClick, regular payments, and autopayments. For more information about COF purchases types, see the Credential-on-file (COF) purchases section.

Note: COF purchases are available only for customers who are clients of selected Swedish banks. Not all banks available under the Trustly method support COF purchases or some of their types.

Registration of COF purchases can be carried out in two ways: during the initial payment and during the payment instrument verification. In both cases, the user agrees to repeat payments on the Trustly payment form. Further OneClick payments can be made without re-authorizing the customer on the Trustly payment form through the Payment Page and Gate. Regular and autopayments are carried out without customer intervention through Gate.

COF purchase registration by using account verification

The full sequence of COF purchase registration by using account verification is provided below.



Figure: Account verification by using Gate

  1. A customer initiates Trustly account verification on the merchant's web service side.
  2. The web service sends the request for account verification by using Gate to the specified ECommPay URL.
  3. The payment platform receives the request for account verification from Gate.
  4. The payment platform performs the initial request processing that includes validation of the required parameters and signature.
  5. The payment platform sends the response with request receipt confirmation and correctness check result to the web service. For more information, see Response format.
  6. The payment platform performs the internal request processing and redirects the request to the Trustly service.
  7. The account verification request is processed on the Trustly side.
  8. The Trustly service sends the data for redirecting the customer to the Trustly service to the payment platform.
  9. The payment platform sends the callback with the redirection data in the redirect_data object to the web service.
  10. The customer is redirected from the web service to the Trustly service.
  11. The customer completes all the steps required for account verification and agrees for COF purchases processing.
  12. The account verification is performed on the Trustly side.
  13. The Trustly service sends the verification result notification to the payment platform.
  14. The ECommPay payment platform sends a callback with verification results to the web service.
  15. The Trustly service sends the notification with the result of COF purchases registration to the payment platform. That callback is usually sent on the next business day after account confirmation.
  16. The ECommPay payment platform sends a callback with the result of COF purchases registration to the web service.

Request format for account verification

There are several things you must consider when using purchase requests in the Trustly method:
  1. You send purchase requests by sending the /v2/payment/online-banking/trustly/account_verification request by using HTTP method POST. This is the request for online-banking payments group: /v2/payment/online-banking/{payment_method}/account_verification.
  2. The following objects and parameters must be specified in any request:
    • general—general purchase information:
      • project_id—project identifier
      • payment_id—unique purchase identifier
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification
    • customer—customer information:
      • id—customer ifentifier unique within the project
      • ip_address—customer IP address
    • payment—purchase information:
      • amount—purchase amount
      • currency—purchase currency in the ISO-4217 alpha-3 format.
    • return_url—URL for redirection:
      • success—in case of success
      • decline—in case of decline
    • recurring_register—sign of the need to register COF purchases. Value of the parameter should be true true.
    • recurring—information about COF purchases:
      • type—COF purchases type (OneClick payments—C, regular payments— R, autopayments—U)
      • Mandatory parameters for regular payments:
        • time—time of the COF purchases
        • expiry_year—end of payment period, year
        • expiry_month—end of payment period, month
        • expiry_day—end of payment period, day
        • interval—interval between payments in the units of chosen period
        • amount—amount of the COF purchase
        • period—frequency of COF purchases (D—every day, W—every week, M—every month, Q—every quarter, Y—every year)
        • scheduled_payment_id—next COF purchase identifier
        • start_date—date and time of the next COF purchase
  3. The currency of payment can only be one from the General information section.
  4. If required, you can also add any other additional parameters Gate supports.
  5. After you specify all the parameters you need, you must create the signature for the request. For instructions on how to sign a payment request, see Signature generation and verification.

Figure: Example of a request to verify customer account for COF purchases registration

{
    "general": {
        "project_id": 1625,
        "payment_id": "ID_1234567890001"
    },
    "customer": {
        "id": "123",
        "ip_address": "1.2.3.4"
    },
    "payment": {
        "amount": 0,
        "currency": "EUR"
    },
    "recurring_register": true,
    "recurring": {
        "type": "U",
        "expiry_year": 2020,
        "expiry_month": 1
    }
}

Callback format

Figure: Example of a callback about the validity of a customer account in Trustly

{
        "project_id": 1625,
        "payment": {
            "id": "ID_1234567890001852",
            "type": "account_verification",
            "status": "success",
            "date": "2019-09-17T07:19:03+0000",
            "method": "trustly",
            "sum": {
                "amount": 0,
                "currency": "EUR"
            },
            "description": "Trustly account verification"
        },
        "account": {
            "number": "1902377919"
        },
        "customer": {
            "id": "123",
            "phone": "123456789"
        },
        "operation": {
            "id": 4311000003631,
            "type": "account verification",
            "status": "success",
            "date": "2019-09-17T07:19:03+0000",
            "created_date": "2019-09-17T07:16:47+0000",
            "request_id": "482f8f5649984daa9e09a4e0dfa03170947b5fd842",
            "sum_initial": {
                "amount": 0,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 0,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "1212450138",
                "date": "2019-09-17T07:19:02+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "SkqaFkJww6bqUnh+4qslJyIRKlwjqenv5knXcTTaTLMCUT1Jjs2zHrbFl
                                               w5sKRxtDRmnwlwKNGQqROpCrpOCNw=="
    }

Figure: Example of a callback about COF purchases registration

{
        "project_id": 1625,
        "payment": {
            "id": "ID_1234567890001",
            "type": "account_verification",
            "status": "success",
            "date": "2019-09-09T11:28:25+0000",
            "method": "trustly",
            "sum": {
                "amount": 0,
                "currency": "EUR"
            },
            "description": "Trustly account verification"
        },
        "account": {
            "number": "7840142519"
        },
        "customer": {
            "id": "123",
            "phone": "40000000361"
        },
        "recurring": {
            "id": 63374,
            "currency": "EUR",
            "valid_thru": "2035-01-31T00:00:00+0000"
        },
        "operation": {
            "id": 6517218122349,
            "type": "account verification",
            "status": "success",
            "date": "2019-09-09T11:28:27+0000",
            "created_date": "2019-09-09T11:28:20+0000",
            "request_id": "482f8f5649984daa9e09a4e0dfa03170947b5fd842",
            "sum_initial": {
                "amount": 0,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 0,
                "currency": "EUR"
            },
            "provider": {
                "id": 1407,
                "payment_id": "15680285012",
                "date": "2019-09-09T11:28:25+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "SkqaFkJww6bqUnh+4qslJyIRKlwjqenv5knXcTTaTLMCUT1Jjs2zHrbFl
                                               w5sKRxtDRmnwlwKNGQqROpCrpOCNw=="
    }

COF purchases registration during the initial payment

To register COF purchases during the initial payment the customer should agree to perform COF purchases on the Trustly payment form. After successful purchase using standard payment procedure two notifications are going to be sent to the web service:
  • callback about successful purchase
  • repeated callback about successful purchase with information about registered COF purchases (usually on the next business day)

Figure: Example of a callback about registered COF purchases

{
        "project_id": 1625,
        "payment": {
            "id": "ID_1234567890000",
            "type": "purchase",
            "status": "success",
            "date": "2019-09-16T15:18:02+0000",
            "method": "trustly",
            "sum": {
                "amount": 100,
                "currency": "EUR"
            },
            "description": "Trustly sale transaction"
        },
        "account": {
            "number": "1902377919"
        },
        "customer": {
            "id": "123"
        },
        "recurring": {
            "id": 1007592570,
            "currency": "EUR",
            "valid_thru": "2020-01-31T00:00:00+0000"
        },
        "operation": {
            "id": 6841000003665,
            "type": "sale",
            "status": "success",
            "date": "2019-09-16T15:18:03+0000",
            "created_date": "2019-09-16T15:15:13+0000",
            "request_id": "khafkuasf575akhafykhaj0cd7absw",
            "sum_initial": {
                "amount": 100,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 100,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "1784257774",
                "date": "2019-09-16T15:18:02+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "ajfgtBiriazPCzp3Kj+Pso7V1FNJvNc0WssilWp0lPfM0sUV0Bv3LZl
                                         KumYVzCi6wy9eTBEyl14X4HYxNwZJ94Q=="
    }

OneClick payments processing

After successful registration of COF purchases, OneClick payments are performed without authorisation of the customer using the saved data. OneClick payments follow the following scheme.

Figure: OneClick payment by using Gate



Figure: OneClick payment by using Gate

  1. A customer initiates a purchase by using saved data through Trustly on the merchant's web service side.
  2. The web service sends the request for processing the purchase by using Gate to the specified ECommPay URL.
  3. The payment platform receives the request for processing the purchase from Gate.
  4. The payment platform performs the initial request processing that includes validation of the required parameters and signature.
  5. The payment platform sends the response with request receipt confirmation and correctness check result to the web service. For more information, see Response format.
  6. The payment platform performs the internal payment request processing and redirects the request to the Trustly service.
  7. The payment is processed on the Trustly side.
  8. The Trustly service sends the payment result notification to the payment platform.
  9. The payment platform sends a callback to the web service.
  10. The customer receives the payment result on the web service.

OneClick payment request format

There are several things you must consider when using OneClick payment requests in the Trustly method:

  1. You send purchase requests by sending the /v2/payment/online-banking/trustly/sale/saved request by using HTTP method POST. This is online banking request group: This is the request for online-banking payments group: /v2/payment/online-banking/{payment_method}/sale/saved.
  2. The following objects and parameters must be specified in any request:
    • general—object that contains general request identification information:
      • project_id—the project ID obtained from ECommPay
      • payment_id—payment ID unique within the project
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification);
    • customer—object that contains customer information:
      • id—customer ifentifier unique within the project
      • ip_address—IP address
    • payment—object that contains customer information:
      • amount—purchase amount
      • currency—purchase currency in ISO-4217 alpha-3 format
    • return_url—URL for redirection:
      • success—in case of success
      • decline—in case of decline
    • recurring_id—COF purchase identifier
  3. The currency of payment can only be one from the General information section.

Thus, a correct OneClick payment request in the Trustly method must include project, recurring, and payment IDs, customer data, currency and amount of the purchase, return URLs, as shown in the following example:

Figure: Example of the OneClick payment request

{
  "general": {
    "project_id": 1625,
    "payment_id": "ID_1568639174831"
  },
  "customer": {
    "id": "123",
    "ip_address": "1.1.1.1"
  },
  "payment": {
    "amount": 100,
    "currency": "EUR",
    "description": "Trustly one-click transaction"
  },
  "recurring": {
    "id": 62944
  }
}

Regular payments and autopayments request format

There are several things you must consider when using Regular payments or autopayments requests in the Trustly method:

  1. You send purchase requests by sending the /v2/payment/online-banking/trustly/recurring request by using HTTP method POST. This is the request for online-banking payments group: /v2/payment/online-banking/{payment_method}/recurring.
  2. The following objects and parameters must be specified in any request:
    • general—object that contains general request identification information:
      • project_id—the project ID obtained from ECommPay
      • payment_id—payment ID unique within the project
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification);
    • customer—object that contains customer information:
      • id—customer ifentifier unique within the project
      • ip_address—IP address
    • payment—object that contains customer information:
      • amount—purchase amount
      • currency—purchase currency in ISO-4217 alpha-3 format
    • recurring_id—COF purchase identifier
  3. The currency of payment can only be one from the General information section.

Thus, a correct OneClick payment request in the Trustly method must include project, recurring, and payment IDs, customer data, currency and amount of the purchase, as shown in the following example:

Figure: Example of the payment request

{
  "general": {
    "project_id": 1625,
    "payment_id": "ID_1568639174831"
  },
  "customer": {
    "id": "123",
    "ip_address": "1.1.1.1"
  },
  "payment": {
    "amount": 100,
    "currency": "EUR",
    "description": "Trustly COF purchase transaction"
  },
  "recurring": {
    "id": 1007592570
  }
}

Callback format

The Trustly method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 1.00 EUR purchase made by the 123 customer in the 1625 project.

Figure: Example of a successful callback for OneClick payment

{
        "project_id": 1625,
        "payment": {
            "id": "ID_1568639174831",
            "type": "recurring",
            "status": "success",
            "date": "2019-09-17T07:12:03+0000",
            "method": "trustly",
            "sum": {
                "amount": 100,
                "currency": "EUR"
            },
            "description": "Trustly COF purchase"
        },
        "customer": {
            "id": "123"
        },
        "recurring": {
            "id": 1007592570,
            "currency": "EUR"
        },
        "operation": {
            "id": 2110000003671,
            "type": "recurring",
            "status": "success",
            "date": "2019-09-17T07:12:03+0000",
            "created_date": "2019-09-17T07:10:02+0000",
            "request_id": "63088b14f83a0bb48882dedfe2cc7fa6aaff",
            "sum_initial": {
                "amount": 100,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 100,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "1562050323",
                "date": "2019-09-17T07:12:01+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "khgsuyriazPCzp3Kj+Pso7V1FNJvNc0WssilWp0lPfM0sUV0Bv3LZl
                                         sgjhVzCi6wy9eTBEyl14X4HYxNwZJ94Q=="
    }

Related topics

The following topics might be useful when implementing payments through Gate:

Refunds by using Gate

General information

Trustly supports full and partial refunds processing. In the Trustly method, any refund follows the usual procedure which is common to Gate: merchant's web service sends a request with all the required parameters and signature to ECommPay URL, Gate accepts the request and redirects to the payment platform for further processing. The full sequence of the payout process is provided below.



Figure: Refund sequence by using Gate

  1. A customer orders a refund on the merchant's web service side.
  2. Merchant's web service sends the request for the refund processing by using Gate to the appropriate ECommPay URL.
  3. Gate redirects the request to the ECommPay payment platform.
  4. The payment platform performs all the necessary checks and processes the request.
  5. The reply with the request processing results is sent to the merchant's web service. For more information, see Response format.
  6. The payment platform redirects the refund request to the Trustly service.
  7. The payment is processed on the Trustly side.
  8. Trustly sends the result notification to the payment platform.
  9. The payment platform sends a callback with the payment result to the web service.
  10. The customer receives the refund result from the web service.

The sections that follow discuss in more details the request format and the Gate parameters to use in the Trustly payment method and provide the information on the format of callbacks with refund results.

Request format

There are several things you must consider when using refund requests in the Trustly method:
  1. You send payout requests by sending the /v2/payment/online-banking/trustly/refund request by using HTTP method POST. This is online banking request group: /v2/payment/online-banking/{payment_method}/refund.
  2. The following objects and parameters must be specified in any request:
    • general—object that contains general request identification information:
      • project_id—the project ID obtained from ECommPay
      • payment_id—the ID of the payment being refunded (unique within the project)
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification);
    • customer—object that contains customer information:
      • ip_address—IP address
    • payment—object that contains customer information:
      • amount—refund amount in minor units (mandatory for partial refunds only)
      • currency—refund currency in ISO-4217 alpha-3 format (mandatory for partial refunds only)
      • description—comment or description of the refund
  3. If required, you can also add any other additional parameters Gate supports.

Thus, a correct partial refund request in the Trustly method must include project and payment IDs, customer IP address, currency and amount of the refund, as shown in the following example:

Figure: Example of a refund request

"general": {    
    "project_id": 239,    
    "payment_id": "182",   
    "signature": "of8k9xerKSKpFBR4XL1QFaDH3p9Mh0CIcjmOwSwKJ7agjhcaukyKLTZYO56
                                                            lCv+f1M0Sf/7eg=="
  },  
   "customer": {    
     "ip_address": "1.2.3.4" 
  },  
  "payment": {    
    "amount": 10000,    
    "currency": "EUR"
    "description": "test refund"
  }

Callback format

The Trustly method uses the standard format for callbacks to deliver refund results. For more information, see Callbacks.

The following is the example of a callback with an information about successful refund for the 1902377919 account of the 125 customer in the 1625 project.

Figure: Example of a successful refund callback

{
        "project_id": 1625,
        "payment": {
            "id": "ID_1234567890000",
            "type": "purchase",
            "status": "partially refunded",
            "date": "2019-09-18T12:25:39+0000",
            "method": "trustly",
            "sum": {
                "amount": 500,
                "currency": "EUR"
            },
            "description": "test payment"
        },
        "account": {
            "number": "1902377919"
        },
        "customer": {
            "id": "123"
        },
        "operation": {
            "id": 6841000003971,
            "type": "refund",
            "status": "success",
            "date": "2019-09-18T12:25:39+0000",
            "created_date": "2019-09-18T12:25:36+0000",
            "request_id": "719ecb2f23f3d482fabb0c5994700fb36b020735ba3c2ae",
            "sum_initial": {
                "amount": 500,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 500,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "1784257774",
                "date": "2019-09-18T12:25:37+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "xCafDfCf+h8/5+SB+o6vUQDVS7+C11AZm955u4nasFDam/fdxqmNnnY
                                           KGzFXZZZChOTwnZxttFi+nDhLMcYMzA=="
    }

The following is the example of a callback for a refund declined due to customer account is no longer available.

Figure: Example of a declined refund callback

{
        "project_id": 1625,
        "payment": {
            "id": "ID_1234567890000",
            "type": "purchase",
            "status": "success",
            "date": "2019-09-18T12:25:39+0000",
            "method": "trustly",
            "sum": {
                "amount": 500,
                "currency": "EUR"
            },
            "description": "test payment"
        },
        "account": {
            "number": "1902377919"
        },
        "customer": {
            "id": "123"
        },
        "operation": {
            "id": 6841000003971,
            "type": "refund",
            "status": "decline",
            "date": "2019-09-18T12:25:39+0000",
            "created_date": "2019-09-18T12:25:36+0000",
            "request_id": "719ecb2f23f3d482fabb0c5994700fb36b020735ba3c2ae",
            "sum_initial": {
                "amount": 500,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 500,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "1784257774",
                "date": "2019-09-18T12:25:37+0000",
                "auth_code": ""
            },
            "code": "20106",
            "message": "Customer account is no longer available"
        },
        "signature": "xCafDfCf+h8/5+SB+o6vUQDVS7+C11AZm955u4nasFDam/fdxqmNnnY
                                           KGzFXZZZChOTwnZxttFi+nDhLMcYMzA=="
    }

Related topics

The following topics might be useful when implementing payments through Gate:

Payouts by using Gate without the redirection of the customer

General information

To perform a payout through the Trustly method, merchant's web service sends a request with all the required parameters and signature to ECommPay URL, and receives a callback with the payment result. The full sequence of the payout process is provided below.

Figure: Payout by using Gate

  1. A customer orders a payout through the Trustly system.
  2. Merchant's web service sends the request for the payout processing by using Gate to the appropriate ECommPay URL.
  3. Gate redirects the request to the ECommPay payment platform.
  4. The payment platform performs all the necessary checks and processes the request.
  5. The reply with the request processing results is sent to the merchant's web service. For more information, see Response format.
  6. The payment platform redirects the payout request to the Trustly service.
  7. The payout is processed on the Trustly side.
  8. Trustly sends the result notification to the payment platform.
  9. The payment platform sends a callback with the payment result to the web service.
  10. The customer receives the notification about the payout result from the web service.

The sections that follow discuss in more details the request format and the Gate parameters to use in the Trustly payment method and provide the information on the format of callbacks with payout results.

Request format

There are several things you must consider when using payout requests in the Trustly method:
  1. You perform payout by sending the request to /v2/payment/online-banking/trustly/payout by using HTTP method POST. This is online banking request group: /v2/payment/online-banking/{payment_method}/payout.
  2. The following objects and parameters must be specified in any request:
    • general—object that contains general request identification information:
      • project_id—the project ID obtained from ECommPay
      • payment_id—payment ID unique within the project
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification);
    • Object payment—payout information:
      • amount—payout amount in minor currency units
      • currency—payout currency in the ISO-4217 alpha-3 format
    • Object customer—customer information:
      • id—customer identifier unique within the project
      • first_name—first name
      • last_name—last name
      • country—country code in accordance with ISO 3166-1 alpha-2
      • ip_address—IP address
      • day_of_birth—date of birth in the DD-MM-YYYY format
    • Object account—recepient bank account information:
      • number—account number
      • clearinghouse—the registration country of the interbank clearing center used by the bank of the account holder. For allowed list of values, see Matching of parameter values
      • bank_code—international bank identifier (BIC or SWIFT) or a specific code used by the interbank clearing center registered in some countries indicated in Matching of parameter values (in such cases the value of the parameter is determined by a regular expression)

      The allowed values of the bank_code and number parameters depend on the value of the clearinghouse parameter. The value of the number parameter is determined by regular expressions corresponding to the specified value of the clearinghouse parameter. The value of the bank_code parameter is determined by a regular expression only when it is not necessary to indicate a BIC or SWIFT code in its value, in other cases the value is not determined by a regular expression (the corresponding table cells are left blank).

      Table 1. Matching of parameter values
      clearinghouse bank_code number
      AUSTRIA   ^AT[0-9]{18}$
      BELGIUM   ^BE[0-9]{14}$
      BULGARIA   ^BG[0-9]{2}[A-Z]{4}[0-9]{4}[0-9]{2}[A-Z0-9]{8}$
      CROATIA   ^HR[0-9]{2}[0-9]{7}[0-9]{10}$
      CYPRUS   ^CY[0-9]{10}[0-9A-Z]{16}$
      CZECH_REPUBLIC ^[0-9]{4}$ ^[0-9]{16}$
      DENMARK ^[0-9]{4}$ ^[0-9]{4,10}$
      ESTONIA ^[0-9]{2}$ ^[0-9]{4,14}$
      FINLAND   ^FI[0-9]{16}$
      FRANCE   ^FR[0-9]{12}[0-9A-Z]{11}[0-9]{2}$
      GERMANY   ^DE[0-9]{20}$
      GREECE   ^GR[0-9]{25}$
      HUNGARY ^[0-9]{8}$ ^[0-9]{24}$
      IRELAND   ^IE[0-9]{2}[A-Z]{4}[0-9]{14}$
      ITALY   ^IT[0-9]{2}[A-Z][0-9]{10}[0-9A-Z]{12}$
      LATVIA   ^LV[0-9]{2}[A-Z]{4}[0-9A-Z]{13}$
      LITHUANIA   ^LT[0-9]{18}$
      LUXEMBOURG   ^LU[0-9]{18}$
      MALTA   ^MT[0-9]{2}[A-Z]{4}[0-9]{5}[0-9A-Z]{18}$
      NETHERLANDS   ^NL[0-9]{2}[A-Z]{4}[0-9]{10}$
      NORWAY ^[0-9]{4}$ ^[0-9]{7}$
      POLAND   ^PL[0-9]{26}$
      PORTUGAL ^[0-9]{8}$ ^[0-9]{13}$
      ROMANIA   ^RO[0-9]{2}[A-Z]{4}[0-9A-Z]{16}$
      SLOVAKIA   ^SK[0-9]{22}$
      SLOVENIA   ^SI56[0-9]{15}$
      SPAIN   ^ES[0-9]{22}$
      SWEDEN ^[0-9]{4,5}$ ^[0-9]{1,15}$
      UNITED_KINGDOM ^[0-9]{6}$ ^[0-9]{8}$
  3. Merchants providing services related to money transfers to e-wallets or to other credit organisations, when the sender is not a merchant, but a third party, must specify the sender's data in the additional_data.sender object:
    • day_of_birth—date of birth
    • party_type—sender type "PERSON" or "ORGANISATION",
    • first_name—name of the sender or organisation
    • last_name—last name of the sender or null for organisation
    • customer_id—the unique sender identifier of the money transfer
    • address—the full address (except country)
    • country— sender country in the ISO 3166-1 alpha-2 format
  4. The currency of payment can only be one from the General information section.
  5. If required, you can also add any other additional parameters Gate supports.

Thus, a correct payment request in the Trustly method must include project and payment IDs, signature, currency and amount of the payout, customer and account information, as shown in the following example:

Figure: Example of a payout request

{
  "general": {
    "project_id": 112,
    "payment_id": "ECT_TEST_156"
  },
  "payment": {
    "amount": 100,
    "currency": "EUR",
    "description": "Trustly account payout"
  },
  "customer": {
    "id": "123",
    "first_name": "Ada",
    "last_name": "Lovelace",
    "country": "SE",
    "day_of_birth": "24-07-1999",
    "ip_address": "1.1.1.1"
  },
  "account": {
    "clearinghouse": "SWEDEN",
    "bank_code": "1234",
    "number": "21312"
  }
 }

Callback format

The Trustly method uses the standard format for callbacks to deliver payout results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 50.00 EUR payout made to the 123 customer in the 1625 project.

Figure: Example of a successful payout callback

 {
        "project_id": 1625,
        "payment": {
            "id": "ECT_TEST_1568711984262232",
            "type": "payout",
            "status": "success",
            "date": "2019-09-18T07:18:03+0000",
            "method": "trustly",
            "sum": {
                "amount": 5000,
                "currency": "EUR"
            },
            "description": "Trustly payout"
        },
        "account": {
            "number": "1902377919"
        },
        "customer": {
            "id": "123",
            "phone": "1230921"
        },
        "operation": {
            "id": 20988000004401,
            "type": "payout",
            "status": "success",
            "date": "2019-09-18T07:18:03+0000",
            "created_date": "2019-09-18T07:12:38+0000",
            "request_id": "821d7c5b4d08587252da9834ab50590d8d4d976d26801a",
            "sum_initial": {
                "amount": 5000,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 5000,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "3063307773",
                "date": "2019-09-18T07:13:03+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "fKyx/vYDhDNxQ0myVETvkXfj7r+4Z1lcEp/7dbL4ip+XtpiYp/onBiqLn
                                                QkeKm+cVJJ71MlOSgr5CXprwe8LPw=="
    }

The following is the example of a callback for a payout declined due to insufficient funds on merchant balance.

Figure: Example of a declined payout callback

 {
        "project_id": 1625,
        "payment": {
            "id": "ECT_TEST_1568711984262232",
            "type": "payout",
            "status": "decline",
            "date": "2019-09-18T07:18:03+0000",
            "method": "trustly",
            "sum": {
                "amount": 5000,
                "currency": "EUR"
            },
            "description": "Trustly payout"
        },
        "account": {
            "number": "1902377919"
        },
        "customer": {
            "id": "123",
            "phone": "1230921"
        },
        "operation": {
            "id": 20988000004401,
            "type": "payout",
            "status": "decline",
            "date": "2019-09-18T07:18:03+0000",
            "created_date": "2019-09-18T07:12:38+0000",
            "request_id": "821d7c5b4d08587252da9834ab50590d8d4d976d26801a",
            "sum_initial": {
                "amount": 5000,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 5000,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "3063307773",
                "date": "2019-09-18T07:13:03+0000",
                "auth_code": ""
            },
            "code": "3028",
            "message": "Insufficient funds on merchant balance"
        },
        "signature": "jfhgfvYDhDNxQ0myVETvkXfj7r+4Z1lcEp/7dbL4ip+XtpiYp/onBiqLn
                                                QkeKm+cVJJ71MlOSgr5CXprwe8LPw=="
    }

Related topics

The following topics might be useful when implementing payments through Gate:

Payouts by using Gate with the redirection of the customer

General information

To perform a payout through the Trustly method, merchant's web service sends a request with all the required parameters and signature to ECommPay URL, and receives a callback with the payment result. The full sequence of the payout process is provided below.



Figure: Payout by using Gate

  1. A customer orders a payout through the Trustly system.
  2. Merchant's web service sends the request for the payout processing by using Gate to the appropriate ECommPay URL.
  3. Gate redirects the request to the ECommPay payment platform.
  4. The payment platform performs all the necessary checks and processes the request.
  5. The reply with the request processing results is sent to the merchant's web service. For more information, see Response format.
  6. The payment platform performs the internal payment request processing and redirects the request to the Trustly service, if all the necessary parameters for making the payment are passed in the request. Otherwise, additional parameters are requested.
  7. The request is processed on the Trustly side.
  8. The Trustly service sends the data for redirecting the customer to the Trustly service to the payment platform.
  9. The payment platform sends the callback with the redirection data in the redirect_data object to the web service.
  10. The customer is redirected from the web service to the Trustly service.
  11. The customer selects payout amount.
  12. The request is processed on the Trustly side.
  13. Trustly sends the notification of request acceptance to the payment platform.
  14. The payment platform sends request to approve payout amount to the web service. To be able to receive a approval request, it is necessary to pass information to the Key Account Manager about the URL to which the request is sent payout_merchant_approval_url. For more information, see Format of payout approval requests and responses.
  15. The response to the request is sent to the payment platform.
  16. The payout request is sent from the payment platform to the Trustly service.
  17. The payout is processed on the Trustly side.
  18. The Trustly service sends the payment result notification to the payment platform.
  19. The payment platform sends a callback with the payment result to the web service.
  20. The customer receives the notification about the payout result from the web service.

The sections that follow discuss in more details the request format and the Gate parameters to use in the Trustly payment method and provide the information on the format of callbacks with payout results.

Payout initiation request format

There are several things you must consider when using payout initiation requests in the Trustly method:

  1. You perform payout by sending the request to /v2/payment/online-banking/trustly/payout by using HTTP method POST. This is online banking request group: /v2/payment/online-banking/{payment_method}/payout.
  2. The following objects and parameters must be specified in any request:
    • general—object that contains general request identification information:
      • project_id—the project ID obtained from ECommPay
      • payment_id—payment ID unique within the project
      • signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification);
    • customer—object that contains customer information:
      • id—customer identifier unique within the project
      • ip_address—IP address
      • first_name—first name
      • last_name—last name
      • email—email address
      • country—country code in accordance with ISO 3166-1 alpha-2
      • language—language code in accordance with ISO 639-1
      • day_of_birth—customer birthday in the dd-mm-yyyy format
    • payment—object that contains customer information:
      • amount—payout amount (always 0)
      • currency—payout currency in ISO-4217 alpha-3 format
    • return_url—URL for redirection:
      • success—in case of success
      • decline—in case of decline
  3. Merchants providing services related to money transfers to e-wallets or to other credit organisations, when the sender is not a merchant, but a third party, must specify the sender's data in the additional_data.sender object:
    • day_of_birth—date of birth
    • party_type—sender type "PERSON" or "ORGANISATION",
    • first_name—name of the sender or organisation
    • last_name—last name of the sender or null for organisation
    • customer_id—the unique sender identifier of the money transfer
    • address—the full address (except country)
    • country— sender country in the ISO 3166-1 alpha-2 format
  4. The currency of payment can only be one from the General information section.
  5. If required, you can also add any other additional parameters Gate supports.

Thus, a correct payment request in the Trustly method must include project and payment IDs, customer data, currency and amount of the payout, URLs for redirection, as shown in the following example:

Figure: Example of a payout initiation request

{
    "general": {
        "project_id": 255,
        "payment_id": "ECT_TEST_15392667771145",
        "signature": "Uhka8CiYAlDlc2wRq60vlSmTTCb0Zp0KYV4NF0Nn7
             DD55XuZQerMr5cAVZNLP64Pn2ja9u0filH8Z03Gr0wh8Q=="
    },
    "customer": {
        "id": "124",
        "ip_address": "185.123.193.224",
        "first_name": "John",
        "last_name": "Smith",
        "email": "qwe@qw.qw",
        "country": "GB",
        "language": "en",
        "day_of_birth": "16-06-1997"
    },
    "payment": {
        "amount": 0,
        "currency": "EUR"
},
    "return_url":{
      "decline" : "http://example.url/decline",
      "success" : "http://example.url/success"
    }
   }

Formats of the customer redirection data

The selection of payout amount is available to the customer on the Trustly side. The link for redirection is generated and passed in the callback or in the email.
  • The link for redirection in the callback. You must receive a callback from the payment platform containing the URL for redirection in the redirect_data.url parameter and data to be sent in the request body in the redirect_data.body parameter, and use these parameters when opening the HTML page using the method specified in the redirect_data.method parameter.
    "redirect_data": {
                "method": "GET",
                "body": [],
                "encrypted": [],
                "url": "https://test.trustly.com/_/orderclient.php?SessionID=757e9445-2616-
                                    411a-b52d-eda5ac58d75b&OrderID=3063307773&Locale=en_SE"
            }
  • The link for redirection in the email. The email is sent from the ECommPay domain to the customer email address specified in the request for payout. Next, the customer must follow the link provided in the email.

To configure the preferred method of passing links for redirection, contact the ECommPay technical support.

Format of payout approval requests and responses

After successful payout request callback from the Trustly service, the payment platform sends request for payout amount approval to the web service. To be able to receive a approval request, it is necessary to pass information to the Key Account Manager about the URL to which the request is sent payout_merchant_approval_url.

Figure: Example of the payout amount approval

{
   "type":"approve_payout",
   "project_id":111,
   "customer_id":"1234567",
   "payment_id":"987654321654",
   "amount":12300,
   "currency":"EUR",
   "signature":"lY0LTSAzpR7zGce5qfYGacOuYlHGWqkMcQlqmjlsDDZI2
                 gVcE1qVeWANnkIR7mdOqRXJnL1kO0lUmkQ0YYLWRg=="
}
Response to the request should be sent synchronously and contain the following parameters:
  • result—parameter can take values 1 (payout is approved by merchant) and 0 (payout request is declined)
  • payment_id—payment ID unique within the project
  • currency—payout currency in ISO-4217 alpha-3 format
  • amount—payout amount in minor units
  • signature—signature

In order to add the reason for payout decline, use the description parameter. That parameter is optional.

Figure: Example of the response (payout is approved)

{
   "result":1,
   "payment_id":"987654321654",
   "amount":12300,
   "currency":"EUR",
   "signature":"lY0LTSAzpR7zGce5qfYGacOuYlHGWqkMcQlqmjlsDDZI2gVcE1
                           qVeWANnkIR7mdOqRXJnL1kO0lUmkQ0YYLAAAt=="
}

Figure: Example of the response (payout request is declined)

{
   "result":0,
   "payment_id":"987654321654",
   "amount":12300,
   "currency":"EUR",
   "description":"Account is blocked",
   "signature":"lY0LTSAzpR7zGce5qfYGacOuYlHGWqkMcQlqmjlsDDZI2gVcE
                        1qVeWANnkIR7mdOqRXJnL1kO0lUmkQ0YYLBBBt=="
}
In case of an error, pass the code and the error description.

Figure: Example of the response (error)

{
   "code":"123",
   "message":"Customer not found"
}

Format of final callbacks

The Trustly method uses the standard format for callbacks to deliver payout results. For more information, see Callbacks.

The following is the example of a callback with an information about successful 50.00 EUR payout made to the 123 customer in the 1625 project.

Figure: Example of a successful payout callback

 {
        "project_id": 1625,
        "payment": {
            "id": "ECT_TEST_1568711984262232",
            "type": "payout",
            "status": "success",
            "date": "2019-09-18T07:18:03+0000",
            "method": "trustly",
            "sum": {
                "amount": 5000,
                "currency": "EUR"
            },
            "description": "Trustly payout"
        },
        "account": {
            "number": "1902377919"
        },
        "customer": {
            "id": "123",
            "phone": "1230921"
        },
        "operation": {
            "id": 20988000004401,
            "type": "payout",
            "status": "success",
            "date": "2019-09-18T07:18:03+0000",
            "created_date": "2019-09-18T07:12:38+0000",
            "request_id": "821d7c5b4d08587252da9834ab50590d8d4d976d26801a",
            "sum_initial": {
                "amount": 5000,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 5000,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "3063307773",
                "date": "2019-09-18T07:13:03+0000",
                "auth_code": ""
            },
            "code": "0",
            "message": "Success"
        },
        "signature": "fKyx/vYDhDNxQ0myVETvkXfj7r+4Z1lcEp/7dbL4ip+XtpiYp/onBiqLn
                                                QkeKm+cVJJ71MlOSgr5CXprwe8LPw=="
    }

The following is the example of a callback for a payout declined due to insufficient funds on merchant balance.

Figure: Example of a declined payout callback

 {
        "project_id": 1625,
        "payment": {
            "id": "ECT_TEST_1568711984262232",
            "type": "payout",
            "status": "decline",
            "date": "2019-09-18T07:18:03+0000",
            "method": "trustly",
            "sum": {
                "amount": 5000,
                "currency": "EUR"
            },
            "description": "Trustly payout"
        },
        "account": {
            "number": "1902377919"
        },
        "customer": {
            "id": "123",
            "phone": "1230921"
        },
        "operation": {
            "id": 20988000004401,
            "type": "payout",
            "status": "decline",
            "date": "2019-09-18T07:18:03+0000",
            "created_date": "2019-09-18T07:12:38+0000",
            "request_id": "821d7c5b4d08587252da9834ab50590d8d4d976d26801a",
            "sum_initial": {
                "amount": 5000,
                "currency": "EUR"
            },
            "sum_converted": {
                "amount": 5000,
                "currency": "EUR"
            },
            "provider": {
                "id": 1322,
                "payment_id": "3063307773",
                "date": "2019-09-18T07:13:03+0000",
                "auth_code": ""
            },
            "code": "3028",
            "message": "Insufficient funds on merchant balance"
        },
        "signature": "jfhgfvYDhDNxQ0myVETvkXfj7r+4Z1lcEp/7dbL4ip+XtpiYp/onBiqLn
                                                QkeKm+cVJJ71MlOSgr5CXprwe8LPw=="
    }

Related topics

The following topics might be useful when implementing payments through Gate:

Analysis of payments results

As with other payment methods ECommPay offers, when using the Trustly method, you have several options to analyse the information about payments and operations performed by using the method—alone or in conjunction with other methods.

You can load and analyse all the necessary information in Dashboard, for instance you can use the analytic panels on the Analytics tab to this end.

Also, you can export the information for further analysis by using third party analytical tools. The following options are available:

  • Dashboard allows you to download reports in CSV and XLS formats—by using the tools on the Payments tab. You can perform export as a one-time download to your local computer or have payment data regularly exported and delivered to email addresses you specify.
  • Data API allows you to have payment information exported in JSON format and delivered to a URL you specify. The payment information is exported by using the /operations/get queries.

If you have any further questions regarding payment data analysis, contact ECommPay technical support.