Cross platform frameworks

Trustly supports different cross platform frameworks for building native applications.

Xamarin Forms

If you have built your app using Xamarin Forms you can use this example implementation as a reference on how to integrate into your app:`

https://github.com/trustly/cross-platform-example-apps/tree/main/TrustlyXamarinExample

Cordova

If you have built your app using Cordova you can use our Trustly Checkout Plugin: https://github.com/trustly/cordova-plugin-trustly-checkout

Integrate the Plugin into your Cordova app

  1. Add the Trustly Plugin
cordova plugin add https://github.com/cordova-plugin-trustly-checkout
  1. Present the Checkout
trustly.showTrustlyCheckout('<YOUR-TRUSTLY-CHECKOUT-URL>')
  .then((successUrl) => {
    //Checkout was successful
    //The Checkout view/activity will close automatically after this.
  })
  .catch((err) => {
    //Called on Checkout error and abort, check err.type to see which.
    //The Checkout view/activity will close automatically after this.
  });

Custom URL scheme

Please note that when rendering the Trustly Checkout from a native app you are required to pass your application's URLScheme as an attribute to the order initiation request. By doing so, Trustly can redirect users back to your app after using external identification apps such as Mobile BankID.

It's a straightforward process; you can follow any Tutorial on iOS/iPhone Custom URL Schemes. The URL scheme can be registered using the following method:

  • Include it in the "URLScheme" attribute when making an API call to Trustly.
  • It's important that the "URLScheme" attribute is only sent if the order is triggered by users from within the app. For any other transaction instances (ex. desktop or interaction via mobile browser directly) the "URLScheme" attribute must not be included.
Attribute nameDescriptionTypeExample
URLSchemeThe URL scheme used to redirect users back to your appTextyourCustomURLScheme://

Example:

{
    "method": "Deposit",
    "params": {
        "Signature": "f4ThjuMqbsdG6u ... S16VbzD4h==",
        "UUID": "258a2184-2842-b485-25ca-293525152425",
        "Data": { 
            "Username": "merchant_username",
            "Password": "merchant_password",
            "Attributes": {
                "Country": "SE",
                "Locale": "sv_SE",
               ** "URLScheme":"myapp://"**
                ...