Documentation

 Back to top

Tapbuy SDK for Android, version 1.0.0-beta1

Download

Tapbuy SDK for Android is the easiest way to use Tapbuy on your Android app : Sell your products through the Tapbuy express checkout solution.

Conditions: Android Studio and Android min sdk 15 (4.0.3) or later.

Installation

1. Create a Tapbuy app

If your app is not yet registered to Tapbuy and has an app ID, you have to create it. You can share an app ID between several platforms.

Connect on the Tapbuy backend and access to the Home > Apps section.

Simply click on Add an app and give it a name to create a new app ID.

2. Android Studio Setup

To use Tapbuy SDK in our project, add it as a build dependency and import it.

  1. Open your main project build.gradle file (project:myProjetName) and add jcenter () in deposits supported if not already done.

gradle1

allprojects {
    repositories {
        jcenter()
    }
}
  1. Open your main app module build.gradle file (Module:app).

gradle2

  1. Your App minSdkVersion must be at least API 15 : Android 4.0.3 or greater
defaultConfig {
   minSdkVersion 15
}
  1. Add the compile dependency with the latest version of the Tapbuy SDK in the build.gradle file.

Alternatively you can download the latest Tapbuy android sdk .aar module and import it manually in Android Studio > file > New Module > Import .JAR/.AAR Package.

Download

dependencies {
   compile ‘com.tapbuy.sdk:tapbuy-android-sdk:1.0.0’
}
  1. Open your strings.xml file. Example path: /app/src/main/res/values/strings.xml.

  2. Add a new string with the name com_tapbuy_sdk_app_id and value as your Tapbuy App ID

<string name="com_tapbuy_sdk_app_id" translatable="false">1234</string>
  1. Add another string with the name com_tapbuy_sdk_redirect_scheme and append your app id to the end of the tapbuy value. For example if your Tapbuy app id is 1234, the declaration looks like :
<string name="com_tapbuy_sdk_redirect_scheme" translatable="false">tapbuy1234</string>
  1. Open your project AndroidManifest.xml

  2. Add a uses-permission element to the manifest :

<uses-permission android:name="android.permission.INTERNET"/>
  1. Add a meta-data element to the application element :
<application android:label="@string/app_name" ...>
    ...
        <meta-data
            android:name="com.tapbuy.sdk.ApplicationId"
            android:value="@string/com_tapbuy_sdk_app_id" />
    ...
</application>

3. Using the SDK with ProGuard

You don’t have to perform any additional steps to use ProGuard for the Tapbuy Android SDK. For instructions on Proguard, see Android Tools Project Site, Running ProGuard.

Usage

1. Tapbuy SDK Initialization

  1. The Tapbuy SDK should be initialized as early as possible. You should subclass Application and call TapbuySdk.sdkInitialize() method in onCreate.
public class SampleApplication extends Application {

  @Override
  public void onCreate() {
      super.onCreate();
      TapbuySdk.sdkInitialize(this);
  }

}
  1. Remember to update the application name in the manifest
<application
    android:name=".SampleApplication" ...>
...
</application>

Connect on the Tapbuy backend and access to the Link builder section.

Paste a target product URL of your website, activate the SDK option and click on Generate link.

Then you should obtain a Tapbuy direct link that you can use to launch the Tapbuy checkout process on the selected product.

3. Start a new Tapbuy checkout process

  1. Get a new checkout Intent from the TapbuySdk instance :
String productUri = "https://shop-test.tapbuy.io/8";
Intent checkoutIntent = TapbuySdk.getCheckoutIntent(this, productUri);
  1. Start a new android Activity :
startActivity(checkoutIntent);
  1. that’s all!

4. Start a new custom Tapbuy checkout process

For a seamless user experience, and if you already know some details about your user, you can provide some of this information to fill the pre checkout form.

  1. Buid a new CheckoutParams object (none of that fields are mandatory) :
final CheckoutParams params = CheckoutParams.builder()
        .userAddress("user address 01")
        .userAddress2("user Address 02")
        .userCity("Marly-Le-Roy")
        .userCountry("fr")
        .userEmail("user@test.fr")
        .userFirstname("User first name")
        .userLastname("User last name")
        .userPhone("023112345678").userZipcode("14000")
        .displayOptions(CheckoutParams.COMPLEMENTARY, CheckoutParams.SIMILAR)
        .skipProductView()
        .build();
  1. Get a new checkout Intent from the TapbuySdk instance with :
String productUri = "https://shop-test.tapbuy.io/8";
Intent checkoutIntent = TapbuySdk.getCheckoutIntent(this, productUri, params);
  1. Start a new android Activity:
startActivity(checkoutIntent);
  1. That’s all!

Customize checkout UI

Change Tapbuy Toolbar backgroud color

You can customize the checkout activity Toolbar backgroud color.

  1. Open or create colors.xml file (path exemple : /app/src/main/res/values/colors.xml)

  2. Add a new color with the name com_tapbuy_sdk_checkout_toolbar_color and value as your custom color:

<color name="com_tapbuy_sdk_checkout_toolbar_color">#3F51B5</color>

Help

Changelog

Check the SDK repository Changelog file for changes and updates.

Testing and Debugging

Sandbox

In this mode, Tapbuy will be executed in sandbox mode. In this mode you can use your own product links. No payment or purchases will be effectively executed.

TapbuySDK.setModeSandbox(true);

Debug

You can enable the Tapbuy test and debug mode :

TapbuySDK.setModeDebug(true);

Technical reference

For a detailed SDK reference, you can check the Tapbuy Android SDK Javadoc.

Sample Application

A sample application (the source is in the repository) is available to check how the Tapbuy SDK can be implemented.

Bugs & feedback

For more details, bug feedback, or support contact us at support@tapbuy.io.

License

Copyright (c) 2016. Tapbuy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Login
Request a new password

Votre formulaire a été soumis. Nous revenons vers vous dans les plus brefs délais. N'hésitez pas à nous contacter si vous avez des questions, nous serons ravis d'y répondre !
L'équipe Tapbuy

Best,

The Tapbuy Team

Close

Best,

The Tapbuy Team

Close