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
- Add the Trustly Plugin
cordova plugin add https://github.com/cordova-plugin-trustly-checkout
- 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 name | Description | Type | Example |
---|---|---|---|
URLScheme | The URL scheme used to redirect users back to your app | Text | yourCustomURLScheme:// |
Example:
{
...
"params": {
...
"Data": {
...
"Attributes": {
...
"URLScheme": "myapp://"
...