Skip to content

payapi/payapi-sdk-android

Repository files navigation

PayApi SDK for Android

Android implementation of PayApi Secure Form.

Contents

Includes an easy-to-use PayApi SDK for any Android application. In order to use the SDK, please register for a free PayApi user account

Installation

1 - Add the repository url to your project level build.gradle

allprojects {
    repositories {        
        maven {
            url "https://raw.githubusercontent.com/payapi/payapi-sdk-android/releases"
        }
    }
}

2 - Add the library as a dependency in your app module level build.gradle

dependencies {
    ...
    compile 'io.payapi.payapisdk:payapi-sdk-android:1.0'
}

Usage

import io.payapi.payapisdk.SecureForm;

Initialization

Initialize SDK with your credentials (Public Id and PayApi key)

SecureForm secureForm =  new SecureForm(activity, "SHOP_PUBLIC_ID", "PROVIDED_API_KEY");

Building a product data dictionary

String message = "{" +
                "\"order\": {" +
                    "\"sumInCentsIncVat\": 122," +
                    "\"sumInCentsExcVat\": 100," +
                    "\"vatInCents\": 22," +
                    "\"currency\": \"EUR\"," +
                    "\"referenceId\": \"ref123\"" +
                "}," +
                "\"products\": [" +
                    "{" +
                        "\"quantity\": 1," +
                        "\"title\": \"Black bling cap\"," +
                        "\"priceInCentsIncVat\": 122," +
                        "\"priceInCentsExcVat\": 100," +
                        "\"vatInCents\": 22," +
                        "\"vatPercentage\": 22" +
                    "}" +
                "]," +
                "\"consumer\": {" +
                    "\"email\": \"support@payapi.io\"" +
                "}" +
        "}";

Adding functionality to a button

Method to open the Secure Form on any View or Button click event

secureForm.addSecureFormToButton(myButton, productData);

Questions?

Please contact support@payapi.io for any questions.

About

PayApi SDK for Android

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages