Skip to content
This repository was archived by the owner on Jul 10, 2020. It is now read-only.

SDK for Android of cryptocurrencies transfer protocol - Crypttp

Notifications You must be signed in to change notification settings

Crypttp/crypttp-android-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypttp-android

Environment

Java 1.6+
min SDK - 16, target 29

Installation

1. In the end of root build.gradle add the following code

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

2. In the app/build.gradle file add dependency

implementation 'com.github.Crypttp:crypttp-android-sdk:v0.0.1-alpha01'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"

The latest version you can find at project GitHub

3. Register deeplink schema in AndroidManifest.xml

Add the following code between <activity> tags

<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="crypttp"
        android:pathPrefix=""
        android:scheme="crypttp"
        tools:ignore="AppLinkUrlError" />
    <data
        android:host="crypttp.com"
        android:pathPrefix="/crypttp"
        android:scheme="http" />
    <data
        android:host="crypttp.com"
        android:pathPrefix="/crypttp"
        android:scheme="https" />

    <!-- register your app deeplink -->
    <data
        android:host="crypttp"
        android:pathPrefix=""
        android:scheme="yourappname" />
</intent-filter>

Or if you already have <intent-filter> that handle your personal App deeplink add only new handlers

<data
    android:host="crypttp"
    android:pathPrefix=""
    android:scheme="crypttp"
    tools:ignore="AppLinkUrlError" />
<data
    android:host="crypttp.com"
    android:pathPrefix="/crypttp"
    android:scheme="http" />
<data
    android:host="crypttp.com"
    android:pathPrefix="/crypttp"
    android:scheme="https" />

<!-- register your app deeplink -->
<data
    android:host="crypttp"
    android:pathPrefix=""
    android:scheme="yourappname" />

3. Register your app link in Crypttp system

Signup at Dashboard

Navigate to Settings/Wallet App

Set:

  • Name

  • Deeplink

  • Discription

  • Icon

  • Available currencies

  • Urls to AppStore

In addition this configuration will help us promote your wallet app.

Every user that has no wallet installed while paying at Crypttp merchants will be redirected to a special page where user can find featured wallets

4. Register first install handler

Get your merchant id in dashboard

val openURL = Intent(android.content.Intent.ACTION_VIEW)
    openURL.data = Uri.parse("https://api.crypttp.com/track/installation?id=<your merchant id>")
startActivity(openURL)

Usage

1.

SDK methods are called through the Crypttp class.

Example of deeplink parsing method

Crypttp.parseCrypttpDeepLink(intent) { params: CrypttpTransactions? ->
   if (params != null) {
       //TODO handle params
   }
}

returned value

data class CrypttpTransactions(
    val transactionId: String,
    val transactions: List<CrypttpTransactionInfo>
)

data class CrypttpTransactionInfo(
    val coin: String,
    val amount: String,
    val to: String,
    val payload: String,
    val memo: String,
    val onSuccessUrl: String,
    val onFailureUrl: String
)

2.

In your successfull transaction handler add the following code:

Crypttp.sendTransactionHashAsync(
   "transactionId",
   "transactionHash"
) {
   if (it is Response.Success) {

   }
}

This method help us track paid transactions and provide statistics to our merchants.

Which in turn helps attract new merchants.

3.

After step 2. add code to return user to the webpage or app from where user was routed to wallet.

That is important to provide good UX and to let merchant know that transaction was successfully made or failed.

val openURL = Intent(android.content.Intent.ACTION_VIEW)
    openURL.data = Uri.parse(onSuccessUrl)
startActivity(openURL)

val openURL = Intent(android.content.Intent.ACTION_VIEW)
    openURL.data = Uri.parse(onFailureUrl)
startActivity(openURL)

About

SDK for Android of cryptocurrencies transfer protocol - Crypttp

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages