GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - trustly/TrustlyAndroidSdk

BranchesTags
Open more actions menu

Latest commit

 

History

42 Commits
42 Commits

Folders and files

NameName
Last commit message
Last commit date
TrustlyAndroidSdk
TrustlyAndroidSdk
 
 
.gitignore
.gitignore
 
 
Changelog.md
Changelog.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Trustly Android SDK

The Trustly Android SDK provides an easy way to implement the Trustly Checkout in your Android app. The SDK handles communication with the Web View and exposes Checkout events that allows you to customize your Checkout flow.

Integration

Integrate the Trustly Android SDK through Maven Central. Add the following to your Project level build.gradle file:

repositories {
  ...
  mavenCentral()
  ...
}

Add Trustly SDK as dependency in your Module level the build.gradle file like so

dependencies {
  ...
  //replace x.x.x with the current version
  implementation 'com.trustly:trustly-android-library:x.x.x'
  ...
}

You also need to add the INTERNET permission to your AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET"/>

Usage

Add a WebView to the activity you wish to launch the Trustly Checkout from.

Example usage:

<WebView
   android:id="@+id/webview"
   android:layout_width="match_parent"
   android:layout_height="match_parent"/>

Instantiate a TrustlyWebView by passing the CheckouURL as a parameter from the activity. Assign the TrustlyWebView to the WebView.

WebView main = findViewById(R.id.webview);
TrustlyWebView trustlyView = new TrustlyWebView(this, trustlyCheckoutUrl);
main.addView(trustlyView);

Receiving Checkout Events

If you want more control of your Checkout flow you can choose to provide custom handlers.

Provide successHandler, abortHandler and errorHandler lambdas. In case no custom functionality is provided, the webview will load the SuccessURL in case of a success event, or the FailURL in case of a error or an abort event. Read more

 trustlyView = new TrustlyWebView(this, trustlyCheckoutUrl);

    trustlyView.successHandler = () -> {
      // your custom implementation here.
    };

    trustlyView.errorHandler = () -> {
      // your custom implementation here.
    };

    trustlyView.abortHandler = () -> {
      // your custom implementation here.
    };

Automatic re-directs back to your application

It can happen that during the order flow, the user needs to be redirected outside of your application, to a third party application or website (in external stand alone browser). This could be part of the authentication and authorisation process. To enable automatic re-directs back to your native application, you can pass a link as an attribute to the order initiation request. You can pass your link (web, app link or deep link) value by including it in the ReturnToAppURL attribute when making an API call to Trustly. You can read more about it here.

⚠️ It's important that the Activity hosting the checkout doesn't reload when the intent is received. Otherwise the Trustly checkout session will be lost. When defining you intent filters make sure to set android:launchMode="singleTop" parameter in your manifest file.

Below is an example intent filter setup in the manifest xml.

<activity
            android:name=".YOUR_TRUSTLY_WEB_VIEW_ACTIVITY"
            android:exported="true"
            android:launchMode="singleTop">
 <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="@string/scheme_host_sdk"
                    android:scheme="@string/scheme" />
</intent-filter>

About

No description, website, or topics provided.

Resources

Readme
MIT license
Activity
Custom properties

Stars

3 stars

Watchers

3 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.