Android Swift Objective-C

Connect a Card Reader

Payload's CardReader.Manager API provides an abstracted API for connecting with card-reader devices from the host device.

The CardReader.Manager API also provides events related to the host platform's connectivity.

Start Card Reader Monitor

You need to initialize the CardReader.Manager in your application to begin interfacing with any card-reader. Once the card reader manager is running, you can use the event api to begin monitoring for available card-reader devices.


new CardReader.Manager(this){
    public void detected(CardReader reader) {
        if ( CardReader.connected_reader == null )

    public void connected(CardReader reader) { /* handle event */ }

    public void disconnected(CardReader reader) { /* handle event */ }

    public void connectionError(CardReader reader, CardReader.Error errorno) { /* handle event */ }
import UIKit
import PayloadAPI
import PayloadCardReader

class ViewController: UIViewController, PayloadCardReaderManagerDelegate {
    var manager:Payload.CardReader.Manager!;

    override func viewDidLoad() {
        self.manager = Payload.CardReader.Manager(self);

    func detected(_ reader:Payload.CardReader){
        if ( self.manager.connectedReader() == nil ) {

    func connected(_ reader:Payload.CardReader) { /* handle event */ }
    func disconnected(_ reader: Payload.CardReader) { /* handle event */ }
    func connectionError(_ reader:Payload.CardReader, _ error:Payload.CardReader.Error) { /* handle event */ }

#import <UIKit/UIKit.h>
#import <Payload/Payload-Swift.h>

@interface ViewController : UIViewController<PayloadCardReaderManagerDelegate>
@interface ViewController ()
@property Manager *manager;

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.manager = [[Manager alloc] init:self];
    [self.manager monitor];

- (void)detected:(CardReader * _Nonnull)reader {
    if ( [self.manager connectedReader] == nil ) {
        [reader connect];

- (void)connected:(CardReader * _Nonnull)reader { /* handle event */ }
- (void)disconnected:(CardReader * _Nonnull)reader { /* handle event */ }
- (void)connectionError:(CardReader * _Nonnull)reader :(enum Error)error { /* handle event */ }



The detected event is fired if a supported card-reader device is found in proximity to the mobile device running the Payload SDK. Once a card reader is detected, you can initiate a connection by calling the connect() method of the reader instance.


If a detected card reader's connect() method is called and a successful connection is made, the connected event will be triggered. Once the connected event is triggered for a card reader device, the card reader is ready to accept payment requests.


If a card-reader device is disconnected from the host device, the disconnected event will be triggered.

Connection Error

If an attempt to connect to a card reader fails, the connectionError event will be triggered.

Connections fail primarily due to Bluetooth connection problems. The most common solution to connection issues is either to set the bluetooth card reader to discover mode first or to reenter the pairing passcode correctly.

Card Reader Object


Method Description
reader.connect() Connect to the card reader
reader.disconnect() Disconnect from the card reader
reader.getBatteryLevel() Get the current battery level of the card reader
reader.isTransactionStarted() Check if a payment request has been started
reader.isTransactionProcessing() Check if the payment is processing
reader.cancelTransaction() Cancel a payment request The name of the card reader
reader.conn_type Either usb or bluetooth