Installation

Install ShopTopUp to enable real commerce for users of your Android app. ShopTopUp for Android supports API 15 and above

Getting Started

This installs the React-Native Agent Checkout feature for the plugin.

Input the following command on Command Prompt / Terminal to begin installation.

$ npm install react-native-shop-checkout --save

There are two ways to link the react native agent checkout to your native android. These are as follows:

Option 1: Mostly Automatic Installation

Follow the below steps to link shop-checkout to native android automatically

  1. Enter the following command
repositories {
    maven {
        url "https://dl.bintray.com/tradedepot/agent-checkout-sdk-android"
    }
    maven {
        url "http://download.flutter.io"
    }
}

dependencies {
    implementation('co.tradedepot.shop.sdk:checkout:1.0.0@aar') {
        transitive = true
    }    		    implementation('co.tradedepot.shop.sdk.checkout.flutter_checkout:flutter_release:1.0.0@aar') {
        transitive = true
    }
 }
$ react-native link react-native-shop-checkout
dependencies {
    implementation 'com.shoptopup.android:shoptopup-sdk:5.+'
    implementation 'com.google.firebase:firebase-messaging:17.+'}
  1. add shoptop agent sdk to app/build.gradle
implementation('co.tradedepot.shop.sdk:checkout:0.0.1+4@aar') {
     transitive = true
 }

Option 2: Manual Installation

  1. Open up android/app/src/main/java/[...]/MainActivity.java
//Add to the imports at the top of the file
import com.tradedepot.react.shopagent.RNAgentCheckoutPackage; 

//Add to the list returned by the getPackages() method
new RNAgentCheckoutPackage()
  1. Append the following lines to android/settings.gradle:
include ':react-native-shop-checkout'
project(':react-native-shop-checkout').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-agent-checkout/android')
  1. Insert the following lines inside the dependencies block in android/app/build.gradle:
implementation project(':react-native-shop-checkout')

4, add shoptop agent sdk to app/build.gradle

implementation('co.tradedepot.shop.sdk:checkout:0.0.1+4@aar') {
     transitive = true
 }

Installation for Android Native

For installing the Android Native Version of the plugin, on app/build.gradle dependencies, input below

implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation('co.tradedepot.shop.sdk:checkout:0.0.1+4@aar') {
        transitive = true
    }

Also on your app/build.gradle dependencies, add compileOptions and set minSdkVersion to 21

android {
    defaultConfig {
       // other configuation
        minSdkVersion 21
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

That’s it - now you must initialize and configure your app


What’s Next