Example Code
This collection of code examples is designed to provide you with practical, step-by-step instructions on how to seamlessly incorporate Trustly into your mobile applications, enhancing the user experience and streamlining your Open Banking processes. Happy coding! 🚀
Native Mobile Apps
For native mobile apps, Trustly recommends using the native Android and iOS SDKs. These example code bases demonstrate integrating the Trustly UI to enable mobile users to create authorized transactions for use with Trustly APIs. They can be used along side the getting started tutorials for Androidand iOS.
iOS Example
A simple SwiftUI iOS app using the Trustly iOS SDK to demonstrate a client-side integration for creating authorization sessions.
Android Example
A simple Android app written in Kotlin and using the Trustly Android SDK to demonstrate a client-side integration for creating authorization sessions.
React Native Example
A simple React Native app which demonstrates how to integrate the Trustly Javascript library into a React Native app to enable creating authorization sessions.
Web Apps and Mobile Webviews
Web apps and mobile apps which embed web content through webviews can use the Trustly Javascript library to integrate the Trustly UI. However, integrations of this nature must take additional care to address OAuth Bank user flows. See the OAuth guide for more details.
React Web App
A simple React web app using the Trustly Javascript library to demonstrate use of the Select Bank Widget and the Lightbox components of a Trustly UI integration.
Mobile Webviews
This codebase also includes examples of native iOS and Android apps using Webview components to render the above web app example in order to demonstrate a hybrid-platform application use case.
iOS Webview | Android Webview |
---|---|
SwiftUI iOS app that renders the linked React web app through a webview component. | Kotlin Android app that renders the linked React web app through a webview component. |
See source code | See source code |
Server Example
Both native mobile apps and web apps integrating Trustly require server-side integration as well. The example provided here demonstrates how to secure Trustly transactions by creating the requestSignature
parameters required by Trustly's production APIs and how to handle incoming Event Notifications.
NestJS Example |
---|
A simple application backend using the popular NodeJS library, NestJS. This example can be integrated with any of the client apps listed above. See the "Request Signature" section in each examples' ReadMe for integration instructions. |
See source code |