Getnet DocsGetnet Docs

Manage Bluetooth Reader

The Get Mini framework manages communication with physical PIN pad devices through the RedsysPinpadManager. This guide explains how to initialize the manager, scan for Bluetooth accessories, and establish a connection.

Requirements

  • Permissions: Add “Supported external accessory protocols” to your Info.plist with the specific protocols for your hardware (e.g., com.datecs.pinpad, com.ingenico.easypayemv.spm-transaction, or com.verifone.pmr.xpi).
  • Hardware: Use a physical iOS device and a certified PIN pad.
  • Delegates: Your class must implement RedsysDelegateGeneric and RedsysBTPinpadInitDelegate.

Step 1: Initialize the Manager

Unlike a singleton, you must instantiate the manager and specify the Bluetooth technology type. For almost all devices except FlyPOS, use pinpadBluetooth.

// Swift implementation
import Redsys_SDK // Ensure headers are in your bridging header

let pinpadManager = RedsysPinpadManager(bluetoothTech: .pinpadBluetooth)

Step 2: Scan for Devices

The SDK leverages the iOS External Accessory framework. To find nearby PIN pads, use findBluetoothDevices. The results are returned via the onProcessOK callback as an array of EAAccessory objects.

func scanForReaders() {
    // This triggers the discovery process
    pinpadManager.findBluetoothDevices(self)
}

// Delegate Callback
func onProcessOK(_ result: Any!) {
    if let devices = result as? [EAAccessory], !devices.isEmpty {
        self.availableDevices = devices
        // Update your UI list with device.name
    }
}

func onProcessError(_ error: Error!) {
    print("Error scanning: \(error.localizedDescription)")
}

Step 3: Connect and Configure

Connecting is a combined step where you link the selected hardware to your merchant credentials. You must provide a MerchanDTO object containing your FUC, Terminal, and Merchant Key.

func connectToDevice(device: EAAccessory) {
    let merchant = MerchanDTO()
    merchant.fuc = "999008881"
    merchant.terminal = "1"
    merchant.claveComercio = "your_key"
    merchant.nombreComercio = "My Store"

    // Connects and starts the initialization process
    pinpadManager.connectAndConfigureDevice(
        device,
        merchan: merchant,
        withDelegate: self
    )
}

Step 4: Monitor Initialization Status

Since PIN pads require internal configuration (keys, parameters), the SDK provides specific callbacks to monitor this progress.

// Called during different phases of setup
func onInitProcess(_ result: Any!) {
    print("Setup Progress: \(result as? String ?? "")")
}

// Final result of the connection/configuration
func onInitFinished(_ result: PinpadConfig!, orError error: Error!) {
    if let config = result {
        print("Pinpad ready for payments")
        self.activeConfig = config // Store this for payWithPinpadBluetooth calls
    } else {
        print("Initialization failed: \(error.localizedDescription)")
    }
}

Troubleshooting

Device Not Appearing in List

  1. System Pairing: Ensure the PIN pad is paired in the iOS System Bluetooth Settings first. The SDK only “sees” devices that the system has authorized.
  2. Protocols: Double-check your Info.plist. If the protocol string (e.g., com.datecs.pinpad) is missing or misspelled, the SDK will ignore the device.
  3. PPID: When submitting to the App Store, you must inform Apple of the PPID (Product Plan ID) provided by Get Mini or the hardware manufacturer.

Connection Errors

  • In Use: Ensure no other app is currently connected to the PIN pad.
  • Merchant Key: A “STATUS KO” error during onInitFinished usually indicates an incorrect claveComercio or FUC/Terminal mismatch in the MerchanDTO.

Next Steps