Skip to content

Simple Kotlin example app using the Trustly SDK for Android

License

Notifications You must be signed in to change notification settings

TrustlyInc/trustly-android-example

Repository files navigation

Trustly Android Example App

The purpose of this example app is to demonstrate how to implement and use the Trustly Android SDK.

Getting Started

Follow the steps below to run this example app with your own Trustly API credentials.

Prerequisites

Setup

  1. Open Android Studio
  2. File -> Open -> "trustly-android-example"
  3. Wait for project to finish building
  4. Open the Establish Data file and insert your credentials into the placeholders:
object EstablishData {

    fun getEstablishDataValues(): Map<String, String> {
        val establishDataValues: MutableMap<String, String> = HashMap()
        establishDataValues["accessId"] = "YOUR_ACCESS_ID"
        establishDataValues["requestSignature"] = "YOUR_REQUEST_SIGNATURE"
        establishDataValues["merchantId"] = "YOUR_MERCHANT_ID"
        establishDataValues["description"] = "Android SDK Demo"
        establishDataValues["currency"] = "USD"
        establishDataValues["merchantReference"] = "MERCHANT_REFERENCE"
        establishDataValues["paymentType"] = "Retrieval"
        establishDataValues["metadata.urlScheme"] = "sdkdemo://"
        establishDataValues["env"] = "sandbox"
        return establishDataValues
    }

}
  1. Setup a target device or emulator and "Run" the application

Request Signature

In order to generate dynamically the requestSignature attribute into your EstablishData object, follow the steps below:

  1. Clone and run the trustly-nestjs-example, in case you don't have a request signature server set
  2. Add or change the request signature endpoint (e.g. http://localhost:8080/api/) into BASE_URL variable of the RetrofitClient.kt file
  3. Change to true the DYNAMIC_REQUEST_SIGNATURE variable in the EstablishData.kt file
  4. Run your app

Documentation: Securing Requests

License

MIT License

Contributing

You can participate in this project by submitting bugs and feature requests in the Issues tab. Please, add @lukevance as an assignee.

If you are interested in fixing issues and contributing directly to the code base, feel free to open a Pull Request with your changes. Please, make sure to fulfill our Pull Request Template and add @lukevance as code reviewer.

About

Simple Kotlin example app using the Trustly SDK for Android

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages