> This page is for North America.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://trustly.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://trustly.ferndocs.com/_mcp/server.

# Establish a new Transaction for authorization

POST https://sandbox.trustly.one/api/v1/establish
Content-Type: application/json

This endpoint creates a new unauthorized transaction and returns a URL to be provided for a user to authorize the transaction. After the user has authorized the transaction with a bank, the transaction can be used with other Trustly APIs to retrieve account data or process payments.

For more details and descriptions of the fields supported by this endpoint see [Establish Data object](doc:features/establish-data-object).

> **Note for Money Transfer** 
> If your application is configured for "Money Transfer" many properties in the `customer`, `beneficiary` and `beneficiaryAccount` objects will be required. 
> See the [Money Transfers guide](doc:money-transfer) for more details.

Reference: https://trustly.ferndocs.com/api-reference/api/transactions/post-establish

## Authentication

- `Authorization` header (basic auth, required) — Basic authentication of the form `Basic <base64(username:password)>`.

## Request

### Query parameters

- `createTransaction` (boolean, optional) — If true, Trustly will return a transactionId that can be used with other API's. Either createTransaction or notify is required.
- `notify` (boolean, optional) — If true, Trustly will notify the User via SMS or Email with a URL that can be used to complete the transaction. Either createTransaction or notify is required.
- `channel` (string, optional) — Comma separated list of notification channels. Currently only sms and email are supported. Example: sms,email will send a notification via SMS and email to the User. Required if notify is true.

### Body (application/json)

This endpoint expects an object.

- `merchantId` (string, required) — Your Trustly-provided Merchant ID.
- `accessId` (string, required) — Your Trustly-provided client application access ID.
- `currency` (enum, required) — 3-letter ISO Currency Code.
  - Allowed values: `USD`, `CAD`
- `returnUrl` (string, required) — The URL where the user should be redirected to when the user successfully authorizes the transaction (must be a valid URL or function).
- `cancelUrl` (string, required) — The URL where the user should be redirected to if the user exits or the transaction is canceled (must be a valid URL or function).
- `requestSignature` (string, required) — Request Signature used to secure the request.
- `merchantReference` (string, required) — A unique identifier that you create to represent the Transaction in the Trustly system.
- `amount` (string, optional) — The amount of the transaction. This represents the maximum amount of the transactions that can be processed with the Authorization. If the amount is 0.00, there will be no upper bound on the transaction. (10 characters with support for 2 decimal places)
- `description` (string, optional) — A summary description of the order. Do not pass Consumer PII (name, email address, etc) in this field.
- `notificationUrl` (string, optional) — Notification URL to use for notifications associated with this transaction. This overrides the notification URL configured by Trustly during onboarding.
- `paymentType` (enum, optional) — Specifies the type of transaction to create. Possible values are Instant, Deferred, Disbursement, Recurring, Verification, and Retrieval. Default is Retrieval. **Note:** If your application is configured for "Money Transfer" and utilizes the "Instant" `paymentType` several properties under `customer`, `beneficiary` and `beneficiaryAccount` will be required. > See the [Money Transfers guide](doc:money-transfer) for more details.
  - Allowed values: `Retrieval`, `Deferred`, `Disbursement`, `Instant`, `Recurring`, `Verification`
- `displayAmount` (double, optional) — Optionally displays the provided transaction amount to the user throughout the Lightbox experience.
- `customer` (any, optional)
- `account` (EstablishPostRequestBodyContentApplicationJsonSchemaAccount, optional) — Account information. Required if paymentType is Verification and a transactionId is not included.
- `beneficiary` (EstablishPostRequestBodyContentApplicationJsonSchemaBeneficiary, optional) — The ultimate beneficiary of this payment. Required when using `paymentType: Instant` for [Money Transfer](doc:money-transfer)
- `beneficiaryAccount` (EstablishPostRequestBodyContentApplicationJsonSchemaBeneficiaryAccount, optional) — Financial institution account associated with the ultimate beneficiary of a transaction. Required when using `paymentType: Instant` for [Money Transfer](doc:money-transfer)
- `kycType` (string, optional) — Specifies the KYC (Know Your Customer) type. This field is optional and can only be used by merchants configured for [Trustly ID](doc:trustly-id).
- `metadata` (EstablishPostRequestBodyContentApplicationJsonSchemaMetadata, optional) — Provide additional use case-specific properties in this object.

## Response

### 200

OK

- `url` (string, required)
- `merchantId` (string, optional) — Your Merchant ID.
- `paymentType` (double, optional) — The Payment Type of the transaction to create. Currently only Disbursement, Deferred, and Instant are supported.
- `returnUrl` (string, optional) — Return URL to use when the transaction is completed.
- `cancelUrl` (string, optional) — Cancel URL to use if the user cancels the transaction.
- `notificationUrl` (string, optional) — Notification URL to use for notifications associated with this transaction. This overrides the notification URL configured at the merchant level.
- `data` (string, optional)
- `accessId` (string, optional) — Your client application access id. It will be provided to you.
- `requestSignature` (string, optional) — Request Signature that can be validated to verify the response authenticity.
- `transactionId` (string, optional) — Transaction ID retrieved from Trustly.
- `merchantReference` (string, optional) — An external reference from the merchant. Ex: Order identifier from merchant e-commerce application.
- `description` (string, optional) — Merchant order description
- `currency` (enum, optional) — 3-letter ISO Currency Code. Currently only USD is supported.
  - Allowed values: `USD`
- `kycType` (enum, optional) — Specifies the KYC (Know Your Customer) type as number. The possible value is 1 (OnlineBanking). This field is optional and can only be used by merchants configured for [Trustly ID](doc:trustly-id).
  - Allowed values: `OnlineBanking`
- `amount` (string, optional) — The amount of the transaction. This represents the maximum amount of the transactions that can be processed with the Authorization. If the amount is 0.00, there will be no upper bound on the transaction. (10 characters with support for 2 decimal places)
- `verification` (Verification, optional)
- `customer` (Customer, optional) — The Trustly customer object, containing identification details and contact information.
- `account` (Account, optional)
- `metadata` (Attribute, optional)
- `trustlyABRequest` (TrustlyABRequest, optional)

## Types

### EstablishPostRequestBodyContentApplicationJsonSchemaAccount

Account information. Required if paymentType is Verification and a transactionId is not included.

- `routingNumber` (string, optional) — Bank Routing Number
- `accountNumber` (string, optional) — Bank Account Number
- `type` (string, optional) — Financial Institution Account Type

### EstablishPostRequestBodyContentApplicationJsonSchemaBeneficiary

The ultimate beneficiary of this payment. Required when using `paymentType: Instant` for [Money Transfer](doc:money-transfer)

- `name` (string, optional) — Full name of the Customer
- `taxId` (string, optional) — Customer tax ID (e.g. SSN [US], SIN [CA]). *May be required depending on industry and location.*
- `address` (Address, optional) — Valid mailing or billing address associated with the customer
- `phone` (string, optional) — Customer phone number.
- `email` (string, optional) — Customer email address.
- `dateOfBirth` (string, optional) — Customer date of birth.
- `createdAt` (integer, optional) — The record created date and time as a UNIX timestamp.
- `updatedAt` (integer, optional) — The record created date and time as a UNIX timestamp.

### EstablishPostRequestBodyContentApplicationJsonSchemaBeneficiaryAccount

Financial institution account associated with the ultimate beneficiary of a transaction. Required when using `paymentType: Instant` for [Money Transfer](doc:money-transfer)

- `accountNumber` (double, optional)
- `iban` (string, optional) — International Bank Account Number (IBAN)
- `paymentProvider` (PaymentProvider, optional) — Details of the Financial institution

### EstablishPostRequestBodyContentApplicationJsonSchemaMetadata

Provide additional use case-specific properties in this object.

- `lang` (string, optional) — Display language for text in the Trustly UI using the [ISO 639 Language Code](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format (e.g. `de_DE` or `fr_CA`). Defaults to `en_US` if not provided.
- `finishButtonLabelType` (enum, optional) — Modify the final button label of the Trustly UI. The default label is "Continue", by passing a supported alternative in this property the button label can be changed to "Pay Now", "Deposit" or "Withdraw".
  - Allowed values: `pay`, `deposit`, `withdraw`
- `integrationContext` (enum, optional) — Configuration required for mobile app compatibility with OAuth bank login flows. More details can be found in the [OAuth and Mobile apps guide](doc:oauth-guide).
  - Allowed values: `InAppBrowser`, `InAppBrowserNotify`, `ExternalBrowser`
- `urlScheme` (string, optional) — The deep link url associated with your mobile application. When users are directed to an external bank login or bank application on success or failure they will be redirected to this url. More details can be found in the [OAuth and Mobile apps guide](doc:oauth-guide).
- `clc` (EstablishPostRequestBodyContentApplicationJsonSchemaMetadataClc, optional) — Properties relating to Trustly In-Person configuration. Required for Trustly In-Person apps.

### Verification

- `status` (enum, optional) — Verification Status: * `1`: Automatic - Payment verification followed Trustly internal rules. * `2`: ToVerify - Payment transaction is held (status = OnHold) for further investigation and approval by the merchant. * `3`: Verified - Payment was verified and approved by the merchant or Trustly (see Verification Mode). * `4`: Refused - Payment was denied by the merchant or Trustly after verification.
  - Allowed values: `1`, `2`, `3`, `4`
- `mode` (enum, optional) — Verification Mode: * `1`: VerifiedByMerchant * `2`: ApprovedByMerchant * `3`: VerifiedByTrustly * `4`: AmountAuthorizedByMerchant
  - Allowed values: `1`, `2`, `3`, `4`
- `verifyCustomer` (boolean, optional) — If true, the Customer information (name and zip code) was verified against information provided by the User's bank.

### Customer

The Trustly customer object, containing identification details and contact information.

- `name` (string, required) — Full name of the Customer
- `address` (Address, required) — Valid mailing or billing address associated with the customer
- `phone` (string, required) — Customer phone number.
- `email` (string, required) — Customer email address.
- `taxId` (string, optional) — Customer tax ID (e.g. SSN [US], SIN [CA]). *May be required depending on industry and location.*
- `dateOfBirth` (string, optional) — Customer date of birth.
- `createdAt` (integer, optional) — The record created date and time as a UNIX timestamp.
- `updatedAt` (integer, optional) — The record created date and time as a UNIX timestamp.
- `customerId` (string, optional) — A unique Trustly customer identifier.
- `externalId` (string, optional) — A unique merchant customer identifier.
- `merchantId` (string, optional) — A unique Trustly merchant identifier.
- `enrollDate` (integer, optional) — Date of the user's first transaction in your system, regardless of payment method used as a UNIX timestamp.
- `vip` (string, optional) — Range that determines how low-risk the customer represents to the merchant
- `currency` (string, optional) — Customer currency.
- `balance` (string, optional) — Customer account balance (not associated with a financial institution account).
- `organizationNumber` (string, optional) — Organization number for business accounts
- `externalTier` (string, optional) — It should describe the customer''s rank to the merchant (e.g. Gold, Diamond, 4 stars, etc.)
- `personId` (string, optional) — Unique customer identity throughout different banks.
- `customData` (CustomerCustomData, optional) — Object for sending merchant-specific custom data.
- `driverLicense` (DriverLicense, optional)
- `nationalId` (string, optional) — Customer National ID

### Account

- `providerId` (string, optional) — Payment provider ID.
- `paymentProvider` (PaymentProvider, optional) — Details of the Financial institution
- `country` (enum, optional) — 2-character ISO code of the country for the bank account that was selected. Currently only the US, CA, UK, DE, and AU are supported.
  - Allowed values: `US`, `CA`, `UK`, `DE`, `AU`
- `name` (string, optional) — A description to identify a specific account (e.g. Test checking account)
- `type` (double, optional) — See Financial Institution Account Type Values.
- `profile` (double, optional) — See Financial Institution Account Profile Values
- `accountNumber` (string, optional) — Bank Account Number or VAN if `virtualAccountRoutingPair` is equal to `true`.
- `iban` (string, optional) — IBAN (International Bank Account Number) is an internationally agreed system of identifying bank accounts across national borders
- `verified` (boolean, optional) — Indicates if the account is verified or not.
- `verification` (FinancialInstitutionAccountVerification, optional)
- `source` (double, optional)
- `routingNumber` (string, optional) — Bank Routing Number
- `token` (string, optional) — The Account Token
- `accountNumberLastFour` (string, optional) — The last 4 digits of the real account number.
- `virtualAccountRoutingPair` (boolean, optional) — Indicates if account is using virtual/tokenized account and routing numbers (VANs/TANs) or not.

### Attribute

- `name` (string, optional)
- `value` (string, optional)

### TrustlyABRequest

- `successURL` (string, optional)
- `failURL` (string, optional)
- `uRLTarget` (string, optional)
- `callbackURL` (string, optional)
- `notificationURL` (string, optional)

### Address

Valid mailing or billing address associated with the customer

- `country` (string, required) — 2 character [ISO Country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
- `address1` (string, optional) — Address line 1 (e.g., street or PO Box)
- `address2` (string, optional) — Address line 2 (e.g., apartment, suite or unit number)
- `city` (string, optional) — City, district, town or village
- `state` (string, optional) — State, province or region code
- `zip` (string, optional) — ZIP or Postal Code

### PaymentProvider

Details of the Financial institution

- `name` (string, required) — Name of the payment provider
- `paymentProviderId` (string, optional) — A unique identifier for the Payment Provider.
- `type` (double, optional)
- `instantPayoutAvailable` (boolean, optional) — Whether payment provider supports instant payout.
- `subType` (enum, optional) — Financial Institution Account Type: * `1000`: Online Banking * `2000`: Manual Entry * `2001`: Manual Entry with Challenge Deposit
  - Allowed values: `1000`, `2000`, `2001`
- `swift` (string, optional)
- `address` (Address, optional) — Valid mailing or billing address associated with the customer
- `country` (enum, optional) — 2-letter ISO country code of the financial institution
  - Allowed values: `US`, `CA`, `UK`, `DE`, `AU`
- `instantPayment` (boolean, optional)

### EstablishPostRequestBodyContentApplicationJsonSchemaMetadataClc

Properties relating to Trustly In-Person configuration. Required for Trustly In-Person apps.

- `propertyId` (double, optional) — ID number for property or location
- `machineId` (double, optional) — ID number specific to an associated Electronic Wagering System
- `qrTimestamp` (datetime, optional) — Timestamp of QR code generation
- `playerNumber` (double, optional) — Player tracking number

### CustomerCustomData

Object for sending merchant-specific custom data.

### DriverLicense

- `number` (string, required) — Driver License number.
- `state` (string, required) — 2 character ISO State code.

### FinancialInstitutionAccountVerification

- `verified` (boolean, required) — true if the account is verified; false otherwise.
- `type` (enum, required) — Verification Type: * `1`: Manual - The account was verified with manual account verification. For example, Manual Electronic Check and Micro Challenge Deposit. * `2`: Online Banking verification - The Account was verified using the Trustly Online Banking application. * `3`: Database verification - The Account was verified using the Trustly database or a Third-Party Service.
  - Allowed values: `1`, `2`, `3`
- `hasEnoughFunds` (boolean, required) — If true, there is enough balance in account.
- `verificationDate` (integer, required) — The date and time the verification was completed as a UNIX timestamp.
- `score` (enum, optional) — Verification Score: * `0`: Invalid input. The account or routing number are invalid. (Verified Mapping = false) * `1`: There is a strong indication that the account is invalid. (Verified Mapping = false) * `2`: There are active non-bankable returns on this account that are less than 3 years old. (Verified Mapping = false) * `3`: There are administrative returns on this account. (Verified Mapping = false) * `4`: The format appears to be suspicious. (Verified Mapping = false) * `5`: There is no data on this account or format. (Verified Mapping = false) * `6`: We have not seen this account, but the format appears to be valid. (Verified Mapping = true) * `7`: We have seen this account but have not received a final disposition on the transaction. (Verified Mapping = true) * `8`: We have seen this account, but not in the last 6 months, and have seen no returns associated with the account. (Verified Mapping = true) * `9`: We have seen this account in the last 6 months and have seen no returns associated with the account. (Verified Mapping = true) * `10`: This account has been directly validated with/by the financial institution or 3rd party. We have the highest confidence that this account is valid. (Verified Mapping = true)
  - Allowed values: `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`
- `thirdPartyScore` (enum, optional) — Verification Third-Party Score: * `0`: Failed RT validation. (Verified Mapping = 0) * `100`: The supplier has a strong indication that this account is invalid. (Verified Mapping = 1) * `200`: The supplier has active non-bankable debt(s) on this account that are less than 3 years old. (Verified Mapping = 2) * `300`: The supplier has administrative returns on this account. (Verified Mapping = 3) * `400`: The supplier does not have Neg data on this account, but the format appears to be suspicious. (Verified Mapping = 4) * `500`: The supplier does not have data on this account or format. (Verified Mapping = 5) * `600`: The supplier has not seen this account, but the format appears valid. (Verified Mapping = 6) * `700`: The supplier has seen this account, but did not receive a final disposition on the transaction. (Verified Mapping = 7) * `800`: The supplier has seen this account, but not in the last 6 months. (Verified Mapping = 8) * `900`: The supplier has seen this account in the last 6 months. (Verified Mapping = 9) * `999`: The supplier has the highest confidence that this account is valid. (Verified Mapping = 10)
  - Allowed values: `0`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900`, `999`
- `numberOfTries` (double, optional) — Number of tries allowed.
- `numberOfAttemptsLeft` (double, optional) — Number of remaining attempts.

## Examples

### Example

**Response**

```json
{
  "url": "https://sandbox.trustly.one/start/establish?accessId=A48B73F694C4C8EE6306&token=1apuAbZyvZQRUM2ZB8UYMg7stPYC2v%2Fvu5UzY%2FScstZPbW6C264dkrywUI2ddPPqcjpwX1Ldaai8b%2FECcAi%2BR1StkxSRAmpE6Ct1fwfLxULVq6L%2BtbHlmK6r4%2BjHi11RbWF%2FtdC9TDy1fyS43nmH2VkAG3bmRNTl3rtIJilChcbakzdLuUDXi2yrv9vEimzkV882Wdzp5%2Bg63gBKFGcJQVq6KbyAL9HpfmJRKz2DBGWUXpZzgopB%2BiblkpY0gwy5FKBvEUyO7GU9jlVON8ynCl2QG6HqCAYFStqTqOj%2FFcqoOGqf5v5eN6SsB5%2BCJPmUYbeay7p%2BuEsMU9q4gG0AF%2FVDDxdHbQVxw60mYc0KTw2BfFg6lQFrihlyhy5N9rrvsWNmy7Ni995NyQ9ODHGkSFM1I%2FOKUG00GzRXzBJv6diQsITZkgf6acXdTLOeTcXglNwj23ouQRWckIK6Q8omYg%3D%3D",
  "establishData": {
    "merchantId": "110005514",
    "description": "Merchant order description",
    "currency": "USD",
    "amount": "0.00",
    "paymentType": 2,
    "returnUrl": "http://yourdomain.com/return?",
    "cancelUrl": "http://yourdomain.com/cancel?",
    "notificationUrl": "http://yourdomain.com/notification?",
    "data": "eNoT4jQ0NDAwMDU1NJFiD/APDvF19FOSSi0uSUzKySzOUEgqzcwpUcjMU4DKaTGHBrsYsRjoGRhYMDkJZJSUFFjp6+fkJyfmZOQXl3hhiGTnFCtxeeVn5CkE52aWZFgbMYUG2zjxahsqWFpaKliaWphbWHoJZwEV6BWDFDhkFScW6yXn52bs39o75a5eSbUBoxenoZGxiamZqblZEJBpYmBgbGhoVrOC6T8MMAIADTpBdA==",
    "accessId": "A48B73F694C4C8EE6306",
    "requestSignature": "S0lH/SLAhuKF+jspNLiMYK1IWAM="
  }
}
```

**SDK Code**

```python Example
import requests

url = "https://sandbox.trustly.one/api/v1/establish"

response = requests.post(url, auth=("<username>", "<password>"))

print(response.json())
```

```javascript Example
const url = 'https://sandbox.trustly.one/api/v1/establish';
const credentials = btoa("<username>:<password>");

const options = {method: 'POST', headers: {Authorization: `Basic ${credentials}`}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox.trustly.one/api/v1/establish"

	req, _ := http.NewRequest("POST", url, nil)

	req.SetBasicAuth("<username>", "<password>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Example
require 'uri'
require 'net/http'

url = URI("https://sandbox.trustly.one/api/v1/establish")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")

response = http.request(request)
puts response.read_body
```

```java Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox.trustly.one/api/v1/establish")
  .basicAuth("<username>", "<password>")
  .asString();
```

```php Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox.trustly.one/api/v1/establish', [
  'headers' => [
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp Example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://sandbox.trustly.one/api/v1/establish");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

IRestResponse response = client.Execute(request);
```

```swift Example
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = ["Authorization": "Basic \(credentials)"]

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.trustly.one/api/v1/establish")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Trustly ID Example

**Request**

```json
{
  "merchantId": "110005514",
  "accessId": "A48B73F694C4C8EE6306",
  "currency": "USD",
  "returnUrl": "http://yourdomain.com/return?",
  "cancelUrl": "http://yourdomain.com/cancel?",
  "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
  "merchantReference": "ABCDE12345",
  "amount": "1.00",
  "description": "Merchant KYC request",
  "notificationUrl": "http://yourdomain.com/notification?",
  "paymentType": "Instant",
  "kycType": "OnlineBanking"
}
```

**Response**

```json
{
  "url": "https://sandbox.trustly.one/start/establish?accessId=A48B73F694C4C8EE6306&token=1apuAbZyvZQRUM2ZB8UYMg7stPYC2v%2Fvu5UzY%2FScstZPbW6C264dkrywUI2ddPPqcjpwX1Ldaai8b%2FECcAi%2BR1StkxSRAmpE6Ct1fwfLxULVq6L%2BtbHlmK6r4%2BjHi11RbWF%2FtdC9TDy1fyS43nmH2VkAG3bmRNTl3rtIJilChcbakzdLuUDXi2yrv9vEimzkV882Wdzp5%2Bg63gBKFGcJQVq6KbyAL9HpfmJRKz2DBGWUXpZzgopB%2BiblkpY0gwy5FKBvEUyO7GU9jlVON8ynCl2QG6HqCAYFStqTqOj%2FFcqoOGqf5v5eN6SsB5%2BCJPmUYbeay7p%2BuEsMU9q4gG0AF%2FVDDxdHbQVxw60mYc0KTw2BfFg6lQFrihlyhy5N9rrvsWNmy7Ni995NyQ9ODHGkSFM1I%2FOKUG00GzRXzBJv6diQsITZkgf6acXdTLOeTcXglNwj23ouQRWckIK6Q8omYg%3D%3D",
  "establishData": {
    "merchantId": "110005514",
    "description": "Merchant KYC request",
    "currency": "USD",
    "amount": "1.00",
    "paymentType": 1,
    "returnUrl": "http://yourdomain.com/return?",
    "cancelUrl": "http://yourdomain.com/cancel?",
    "notificationUrl": "http://yourdomain.com/notification?",
    "data": "eNoT4jQ0NDAwMDU1NJFiD/APDvF19FOSSi0uSUzKySzOUEgqzcwpUcjMU4DKaTGHBrsYsRjoGRhYMDkJZJSUFFjp6+fkJyfmZOQXl3hhiGTnFCtxeeVn5CkE52aWZFgbMYUG2zjxahsqWFpaKliaWphbWHoJZwEV6BWDFDhkFScW6yXn52bs39o75a5eSbUBoxenoZGxiamZqblZEJBpYmBgbGhoVrOC6T8MMAIADTpBdA==",
    "accessId": "A48B73F694C4C8EE6306",
    "requestSignature": "S0lH/SLAhuKF+jspNLiMYK1IWAM=",
    "kycType": 1
  }
}
```

**SDK Code**

```python Trustly ID Example
import requests

url = "https://sandbox.trustly.one/api/v1/establish"

payload = {
    "merchantId": "110005514",
    "accessId": "A48B73F694C4C8EE6306",
    "currency": "USD",
    "returnUrl": "http://yourdomain.com/return?",
    "cancelUrl": "http://yourdomain.com/cancel?",
    "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
    "merchantReference": "ABCDE12345",
    "amount": "1.00",
    "description": "Merchant KYC request",
    "notificationUrl": "http://yourdomain.com/notification?",
    "paymentType": "Instant",
    "kycType": "OnlineBanking"
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript Trustly ID Example
const url = 'https://sandbox.trustly.one/api/v1/establish';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"merchantId":"110005514","accessId":"A48B73F694C4C8EE6306","currency":"USD","returnUrl":"http://yourdomain.com/return?","cancelUrl":"http://yourdomain.com/cancel?","requestSignature":"a/n62XqfgQA31xmFnCxNEOjd7g=","merchantReference":"ABCDE12345","amount":"1.00","description":"Merchant KYC request","notificationUrl":"http://yourdomain.com/notification?","paymentType":"Instant","kycType":"OnlineBanking"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Trustly ID Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox.trustly.one/api/v1/establish"

	payload := strings.NewReader("{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return?\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel?\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"1.00\",\n  \"description\": \"Merchant KYC request\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Instant\",\n  \"kycType\": \"OnlineBanking\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<username>", "<password>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Trustly ID Example
require 'uri'
require 'net/http'

url = URI("https://sandbox.trustly.one/api/v1/establish")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return?\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel?\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"1.00\",\n  \"description\": \"Merchant KYC request\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Instant\",\n  \"kycType\": \"OnlineBanking\"\n}"

response = http.request(request)
puts response.read_body
```

```java Trustly ID Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox.trustly.one/api/v1/establish")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return?\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel?\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"1.00\",\n  \"description\": \"Merchant KYC request\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Instant\",\n  \"kycType\": \"OnlineBanking\"\n}")
  .asString();
```

```php Trustly ID Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox.trustly.one/api/v1/establish', [
  'body' => '{
  "merchantId": "110005514",
  "accessId": "A48B73F694C4C8EE6306",
  "currency": "USD",
  "returnUrl": "http://yourdomain.com/return?",
  "cancelUrl": "http://yourdomain.com/cancel?",
  "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
  "merchantReference": "ABCDE12345",
  "amount": "1.00",
  "description": "Merchant KYC request",
  "notificationUrl": "http://yourdomain.com/notification?",
  "paymentType": "Instant",
  "kycType": "OnlineBanking"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp Trustly ID Example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://sandbox.trustly.one/api/v1/establish");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return?\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel?\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"1.00\",\n  \"description\": \"Merchant KYC request\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Instant\",\n  \"kycType\": \"OnlineBanking\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Trustly ID Example
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "merchantId": "110005514",
  "accessId": "A48B73F694C4C8EE6306",
  "currency": "USD",
  "returnUrl": "http://yourdomain.com/return?",
  "cancelUrl": "http://yourdomain.com/cancel?",
  "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
  "merchantReference": "ABCDE12345",
  "amount": "1.00",
  "description": "Merchant KYC request",
  "notificationUrl": "http://yourdomain.com/notification?",
  "paymentType": "Instant",
  "kycType": "OnlineBanking"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.trustly.one/api/v1/establish")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Basic Deferred Example

**Request**

```json
{
  "merchantId": "110005514",
  "accessId": "A48B73F694C4C8EE6306",
  "currency": "USD",
  "returnUrl": "http://yourdomain.com/return",
  "cancelUrl": "http://yourdomain.com/cancel",
  "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
  "merchantReference": "ABCDE12345",
  "amount": "0.00",
  "description": "Merchant order description",
  "notificationUrl": "http://yourdomain.com/notification?",
  "paymentType": "Deferred",
  "customer": null
}
```

**Response**

```json
{
  "url": "https://sandbox.trustly.one/start/establish?accessId=A48B73F694C4C8EE6306&token=1apuAbZyvZQRUM2ZB8UYMg7stPYC2v%2Fvu5UzY%2FScstZPbW6C264dkrywUI2ddPPqcjpwX1Ldaai8b%2FECcAi%2BR1StkxSRAmpE6Ct1fwfLxULVq6L%2BtbHlmK6r4%2BjHi11RbWF%2FtdC9TDy1fyS43nmH2VkAG3bmRNTl3rtIJilChcbakzdLuUDXi2yrv9vEimzkV882Wdzp5%2Bg63gBKFGcJQVq6KbyAL9HpfmJRKz2DBGWUXpZzgopB%2BiblkpY0gwy5FKBvEUyO7GU9jlVON8ynCl2QG6HqCAYFStqTqOj%2FFcqoOGqf5v5eN6SsB5%2BCJPmUYbeay7p%2BuEsMU9q4gG0AF%2FVDDxdHbQVxw60mYc0KTw2BfFg6lQFrihlyhy5N9rrvsWNmy7Ni995NyQ9ODHGkSFM1I%2FOKUG00GzRXzBJv6diQsITZkgf6acXdTLOeTcXglNwj23ouQRWckIK6Q8omYg%3D%3D",
  "establishData": {
    "merchantId": "110005514",
    "description": "Merchant order description",
    "currency": "USD",
    "amount": "0.00",
    "paymentType": 2,
    "returnUrl": "http://yourdomain.com/return?",
    "cancelUrl": "http://yourdomain.com/cancel?",
    "notificationUrl": "http://yourdomain.com/notification?",
    "data": "eNoT4jQ0NDAwMDU1NJFiD/APDvF19FOSSi0uSUzKySzOUEgqzcwpUcjMU4DKaTGHBrsYsRjoGRhYMDkJZJSUFFjp6+fkJyfmZOQXl3hhiGTnFCtxeeVn5CkE52aWZFgbMYUG2zjxahsqWFpaKliaWphbWHoJZwEV6BWDFDhkFScW6yXn52bs39o75a5eSbUBoxenoZGxiamZqblZEJBpYmBgbGhoVrOC6T8MMAIADTpBdA==",
    "accessId": "A48B73F694C4C8EE6306",
    "requestSignature": "S0lH/SLAhuKF+jspNLiMYK1IWAM="
  }
}
```

**SDK Code**

```python Basic Deferred Example
import requests

url = "https://sandbox.trustly.one/api/v1/establish"

payload = {
    "merchantId": "110005514",
    "accessId": "A48B73F694C4C8EE6306",
    "currency": "USD",
    "returnUrl": "http://yourdomain.com/return",
    "cancelUrl": "http://yourdomain.com/cancel",
    "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
    "merchantReference": "ABCDE12345",
    "amount": "0.00",
    "description": "Merchant order description",
    "notificationUrl": "http://yourdomain.com/notification?",
    "paymentType": "Deferred",
    "customer": None
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript Basic Deferred Example
const url = 'https://sandbox.trustly.one/api/v1/establish';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"merchantId":"110005514","accessId":"A48B73F694C4C8EE6306","currency":"USD","returnUrl":"http://yourdomain.com/return","cancelUrl":"http://yourdomain.com/cancel","requestSignature":"a/n62XqfgQA31xmFnCxNEOjd7g=","merchantReference":"ABCDE12345","amount":"0.00","description":"Merchant order description","notificationUrl":"http://yourdomain.com/notification?","paymentType":"Deferred","customer":null}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Basic Deferred Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox.trustly.one/api/v1/establish"

	payload := strings.NewReader("{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"0.00\",\n  \"description\": \"Merchant order description\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Deferred\",\n  \"customer\": null\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<username>", "<password>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Basic Deferred Example
require 'uri'
require 'net/http'

url = URI("https://sandbox.trustly.one/api/v1/establish")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"0.00\",\n  \"description\": \"Merchant order description\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Deferred\",\n  \"customer\": null\n}"

response = http.request(request)
puts response.read_body
```

```java Basic Deferred Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox.trustly.one/api/v1/establish")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"0.00\",\n  \"description\": \"Merchant order description\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Deferred\",\n  \"customer\": null\n}")
  .asString();
```

```php Basic Deferred Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox.trustly.one/api/v1/establish', [
  'body' => '{
  "merchantId": "110005514",
  "accessId": "A48B73F694C4C8EE6306",
  "currency": "USD",
  "returnUrl": "http://yourdomain.com/return",
  "cancelUrl": "http://yourdomain.com/cancel",
  "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
  "merchantReference": "ABCDE12345",
  "amount": "0.00",
  "description": "Merchant order description",
  "notificationUrl": "http://yourdomain.com/notification?",
  "paymentType": "Deferred",
  "customer": null
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp Basic Deferred Example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://sandbox.trustly.one/api/v1/establish");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"0.00\",\n  \"description\": \"Merchant order description\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Deferred\",\n  \"customer\": null\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Basic Deferred Example
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "merchantId": "110005514",
  "accessId": "A48B73F694C4C8EE6306",
  "currency": "USD",
  "returnUrl": "http://yourdomain.com/return",
  "cancelUrl": "http://yourdomain.com/cancel",
  "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
  "merchantReference": "ABCDE12345",
  "amount": "0.00",
  "description": "Merchant order description",
  "notificationUrl": "http://yourdomain.com/notification?",
  "paymentType": "Deferred",
  "customer": 
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.trustly.one/api/v1/establish")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Instant Money Transfer

**Request**

```json
{
  "merchantId": "110005514",
  "accessId": "A48B73F694C4C8EE6306",
  "currency": "USD",
  "returnUrl": "http://yourdomain.com/return",
  "cancelUrl": "http://yourdomain.com/cancel",
  "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
  "merchantReference": "ABCDE12345",
  "amount": "0.00",
  "description": "Merchant order description",
  "notificationUrl": "http://yourdomain.com/notification?",
  "paymentType": "Instant",
  "customer": null,
  "beneficiary": {
    "name": "Johan Olen",
    "taxId": "756.9217.0769.85",
    "address": {
      "country": "CH",
      "address1": "Untere Bahnhofstrasse 90",
      "city": "Castiel",
      "state": "Graubünden",
      "zip": "7027"
    },
    "dateOfBirth": "08/08/1998"
  },
  "beneficiaryAccount": {
    "accountNumber": 762011623852957,
    "paymentProvider": {
      "name": "Swiss National Bank",
      "swift": "SNBZCHZZXXX",
      "country": "US"
    }
  }
}
```

**Response**

```json
{
  "url": "https://sandbox.trustly.one/start/establish?accessId=A48B73F694C4C8EE6306&token=1apuAbZyvZQRUM2ZB8UYMg7stPYC2v%2Fvu5UzY%2FScstZPbW6C264dkrywUI2ddPPqcjpwX1Ldaai8b%2FECcAi%2BR1StkxSRAmpE6Ct1fwfLxULVq6L%2BtbHlmK6r4%2BjHi11RbWF%2FtdC9TDy1fyS43nmH2VkAG3bmRNTl3rtIJilChcbakzdLuUDXi2yrv9vEimzkV882Wdzp5%2Bg63gBKFGcJQVq6KbyAL9HpfmJRKz2DBGWUXpZzgopB%2BiblkpY0gwy5FKBvEUyO7GU9jlVON8ynCl2QG6HqCAYFStqTqOj%2FFcqoOGqf5v5eN6SsB5%2BCJPmUYbeay7p%2BuEsMU9q4gG0AF%2FVDDxdHbQVxw60mYc0KTw2BfFg6lQFrihlyhy5N9rrvsWNmy7Ni995NyQ9ODHGkSFM1I%2FOKUG00GzRXzBJv6diQsITZkgf6acXdTLOeTcXglNwj23ouQRWckIK6Q8omYg%3D%3D",
  "establishData": {
    "merchantId": "110005514",
    "description": "Merchant order description",
    "currency": "USD",
    "amount": "0.00",
    "paymentType": 2,
    "returnUrl": "http://yourdomain.com/return?",
    "cancelUrl": "http://yourdomain.com/cancel?",
    "notificationUrl": "http://yourdomain.com/notification?",
    "data": "eNoT4jQ0NDAwMDU1NJFiD/APDvF19FOSSi0uSUzKySzOUEgqzcwpUcjMU4DKaTGHBrsYsRjoGRhYMDkJZJSUFFjp6+fkJyfmZOQXl3hhiGTnFCtxeeVn5CkE52aWZFgbMYUG2zjxahsqWFpaKliaWphbWHoJZwEV6BWDFDhkFScW6yXn52bs39o75a5eSbUBoxenoZGxiamZqblZEJBpYmBgbGhoVrOC6T8MMAIADTpBdA==",
    "accessId": "A48B73F694C4C8EE6306",
    "requestSignature": "S0lH/SLAhuKF+jspNLiMYK1IWAM="
  }
}
```

**SDK Code**

```python Instant Money Transfer
import requests

url = "https://sandbox.trustly.one/api/v1/establish"

payload = {
    "merchantId": "110005514",
    "accessId": "A48B73F694C4C8EE6306",
    "currency": "USD",
    "returnUrl": "http://yourdomain.com/return",
    "cancelUrl": "http://yourdomain.com/cancel",
    "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
    "merchantReference": "ABCDE12345",
    "amount": "0.00",
    "description": "Merchant order description",
    "notificationUrl": "http://yourdomain.com/notification?",
    "paymentType": "Instant",
    "customer": None,
    "beneficiary": {
        "name": "Johan Olen",
        "taxId": "756.9217.0769.85",
        "address": {
            "country": "CH",
            "address1": "Untere Bahnhofstrasse 90",
            "city": "Castiel",
            "state": "Graubünden",
            "zip": "7027"
        },
        "dateOfBirth": "08/08/1998"
    },
    "beneficiaryAccount": {
        "accountNumber": 762011623852957,
        "paymentProvider": {
            "name": "Swiss National Bank",
            "swift": "SNBZCHZZXXX",
            "country": "US"
        }
    }
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript Instant Money Transfer
const url = 'https://sandbox.trustly.one/api/v1/establish';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"merchantId":"110005514","accessId":"A48B73F694C4C8EE6306","currency":"USD","returnUrl":"http://yourdomain.com/return","cancelUrl":"http://yourdomain.com/cancel","requestSignature":"a/n62XqfgQA31xmFnCxNEOjd7g=","merchantReference":"ABCDE12345","amount":"0.00","description":"Merchant order description","notificationUrl":"http://yourdomain.com/notification?","paymentType":"Instant","customer":null,"beneficiary":{"name":"Johan Olen","taxId":"756.9217.0769.85","address":{"country":"CH","address1":"Untere Bahnhofstrasse 90","city":"Castiel","state":"Graubünden","zip":"7027"},"dateOfBirth":"08/08/1998"},"beneficiaryAccount":{"accountNumber":762011623852957,"paymentProvider":{"name":"Swiss National Bank","swift":"SNBZCHZZXXX","country":"US"}}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Instant Money Transfer
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox.trustly.one/api/v1/establish"

	payload := strings.NewReader("{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"0.00\",\n  \"description\": \"Merchant order description\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Instant\",\n  \"customer\": null,\n  \"beneficiary\": {\n    \"name\": \"Johan Olen\",\n    \"taxId\": \"756.9217.0769.85\",\n    \"address\": {\n      \"country\": \"CH\",\n      \"address1\": \"Untere Bahnhofstrasse 90\",\n      \"city\": \"Castiel\",\n      \"state\": \"Graubünden\",\n      \"zip\": \"7027\"\n    },\n    \"dateOfBirth\": \"08/08/1998\"\n  },\n  \"beneficiaryAccount\": {\n    \"accountNumber\": 762011623852957,\n    \"paymentProvider\": {\n      \"name\": \"Swiss National Bank\",\n      \"swift\": \"SNBZCHZZXXX\",\n      \"country\": \"US\"\n    }\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<username>", "<password>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Instant Money Transfer
require 'uri'
require 'net/http'

url = URI("https://sandbox.trustly.one/api/v1/establish")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"0.00\",\n  \"description\": \"Merchant order description\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Instant\",\n  \"customer\": null,\n  \"beneficiary\": {\n    \"name\": \"Johan Olen\",\n    \"taxId\": \"756.9217.0769.85\",\n    \"address\": {\n      \"country\": \"CH\",\n      \"address1\": \"Untere Bahnhofstrasse 90\",\n      \"city\": \"Castiel\",\n      \"state\": \"Graubünden\",\n      \"zip\": \"7027\"\n    },\n    \"dateOfBirth\": \"08/08/1998\"\n  },\n  \"beneficiaryAccount\": {\n    \"accountNumber\": 762011623852957,\n    \"paymentProvider\": {\n      \"name\": \"Swiss National Bank\",\n      \"swift\": \"SNBZCHZZXXX\",\n      \"country\": \"US\"\n    }\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Instant Money Transfer
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox.trustly.one/api/v1/establish")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"0.00\",\n  \"description\": \"Merchant order description\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Instant\",\n  \"customer\": null,\n  \"beneficiary\": {\n    \"name\": \"Johan Olen\",\n    \"taxId\": \"756.9217.0769.85\",\n    \"address\": {\n      \"country\": \"CH\",\n      \"address1\": \"Untere Bahnhofstrasse 90\",\n      \"city\": \"Castiel\",\n      \"state\": \"Graubünden\",\n      \"zip\": \"7027\"\n    },\n    \"dateOfBirth\": \"08/08/1998\"\n  },\n  \"beneficiaryAccount\": {\n    \"accountNumber\": 762011623852957,\n    \"paymentProvider\": {\n      \"name\": \"Swiss National Bank\",\n      \"swift\": \"SNBZCHZZXXX\",\n      \"country\": \"US\"\n    }\n  }\n}")
  .asString();
```

```php Instant Money Transfer
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox.trustly.one/api/v1/establish', [
  'body' => '{
  "merchantId": "110005514",
  "accessId": "A48B73F694C4C8EE6306",
  "currency": "USD",
  "returnUrl": "http://yourdomain.com/return",
  "cancelUrl": "http://yourdomain.com/cancel",
  "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
  "merchantReference": "ABCDE12345",
  "amount": "0.00",
  "description": "Merchant order description",
  "notificationUrl": "http://yourdomain.com/notification?",
  "paymentType": "Instant",
  "customer": null,
  "beneficiary": {
    "name": "Johan Olen",
    "taxId": "756.9217.0769.85",
    "address": {
      "country": "CH",
      "address1": "Untere Bahnhofstrasse 90",
      "city": "Castiel",
      "state": "Graubünden",
      "zip": "7027"
    },
    "dateOfBirth": "08/08/1998"
  },
  "beneficiaryAccount": {
    "accountNumber": 762011623852957,
    "paymentProvider": {
      "name": "Swiss National Bank",
      "swift": "SNBZCHZZXXX",
      "country": "US"
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp Instant Money Transfer
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://sandbox.trustly.one/api/v1/establish");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"merchantId\": \"110005514\",\n  \"accessId\": \"A48B73F694C4C8EE6306\",\n  \"currency\": \"USD\",\n  \"returnUrl\": \"http://yourdomain.com/return\",\n  \"cancelUrl\": \"http://yourdomain.com/cancel\",\n  \"requestSignature\": \"a/n62XqfgQA31xmFnCxNEOjd7g=\",\n  \"merchantReference\": \"ABCDE12345\",\n  \"amount\": \"0.00\",\n  \"description\": \"Merchant order description\",\n  \"notificationUrl\": \"http://yourdomain.com/notification?\",\n  \"paymentType\": \"Instant\",\n  \"customer\": null,\n  \"beneficiary\": {\n    \"name\": \"Johan Olen\",\n    \"taxId\": \"756.9217.0769.85\",\n    \"address\": {\n      \"country\": \"CH\",\n      \"address1\": \"Untere Bahnhofstrasse 90\",\n      \"city\": \"Castiel\",\n      \"state\": \"Graubünden\",\n      \"zip\": \"7027\"\n    },\n    \"dateOfBirth\": \"08/08/1998\"\n  },\n  \"beneficiaryAccount\": {\n    \"accountNumber\": 762011623852957,\n    \"paymentProvider\": {\n      \"name\": \"Swiss National Bank\",\n      \"swift\": \"SNBZCHZZXXX\",\n      \"country\": \"US\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Instant Money Transfer
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "merchantId": "110005514",
  "accessId": "A48B73F694C4C8EE6306",
  "currency": "USD",
  "returnUrl": "http://yourdomain.com/return",
  "cancelUrl": "http://yourdomain.com/cancel",
  "requestSignature": "a/n62XqfgQA31xmFnCxNEOjd7g=",
  "merchantReference": "ABCDE12345",
  "amount": "0.00",
  "description": "Merchant order description",
  "notificationUrl": "http://yourdomain.com/notification?",
  "paymentType": "Instant",
  "customer": ,
  "beneficiary": [
    "name": "Johan Olen",
    "taxId": "756.9217.0769.85",
    "address": [
      "country": "CH",
      "address1": "Untere Bahnhofstrasse 90",
      "city": "Castiel",
      "state": "Graubünden",
      "zip": "7027"
    ],
    "dateOfBirth": "08/08/1998"
  ],
  "beneficiaryAccount": [
    "accountNumber": 762011623852957,
    "paymentProvider": [
      "name": "Swiss National Bank",
      "swift": "SNBZCHZZXXX",
      "country": "US"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.trustly.one/api/v1/establish")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```