Android Swift Objective-C

Installation & Setup


Installation

Android

// Project build.gradle
buildscript {
    repositories {
        flatDir { dirs "libs" }
    }
}
// App build.gradle
dependencies {
    implementation fileTree(include: ["*.jar", "*.aar"], dir: "libs")
}

Manual Install

To include Payload's Android SDK in your project, follow these steps:

  1. Add the payload_android-latest.aar file to your app/libs directory.

  2. Modify the project level build.gradle file to recognize the libs directory.

  3. Modify the app level build.gradle file to include both *.jar and *.aar files.


iOS

CocoaPod Install

To include Payload's iOS SDK in your project, follow these steps:


Setup

import co.payload.pl;
import co.payload.android.Payload;

public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        pl.api_key = "test_client_key_3bezxdVdCLpYP9yJ5odpg";
    }
}
import PayloadAPI
import PayloadCardReader

class ViewController: UIViewController {
    override func viewDidLoad() {
        Payload.api_key = "test_client_key_3bezxdVdCLpYP9yJ5odpg"
    }
}
// ViewController.h
#import <PayloadAPI/Payload-Swift.h>
// ViewController.m
@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    Payload.api_key = @"test_client_key_3bezxdVdCLpYP9yJ5odpg"
}

Once the SDK is installed, you can import the library and set the client key to be able to interact with your Payload account. Because these are client-side libraries, they require the client key, not the api key.

Your client key can be found from your dashboard under Settings > API Keys where you'll find both a testing and a production key.


Options

new Device.Manager(this, new Payload.Opts(){{
       this.autoconnect = true;
       this.emv_default = "emv";
       this.offline_enabled = Payload.Opts.SWIPE_ONLY;
       this.offline_payment_limit = 100;
}});

Payload.auto_connect = true;
Payload.default_source = "emv";
Payload.emv_default_quickchip = true;
Payload.offline_enabled = true;
Payload.manual_keyed_view_dismissal = true;
Payload.auto_connect = true;
Payload.default_source = @"emv";
Payload.emv_default_quickchip = true;
Payload.offline_enabled = true;
Payload.manual_keyed_view_dismissal = true;

You can control a few global options.

Option Description Default
auto_connect Autoconnect once a device is detected false
default_source Set a default source for transactions. emv, emv_quickchip, swipe, keyed, nfc nil
emv_default_quickchip Toggle emv type between standard and quickchip modes false
offline_enabled Enable offline payments if connection is lost true
manual_keyed_view_dismissal Allow manual dismissal of the keyed view false