Skip to content

Pairing

The Pairing command is for ECR to register a Device ID with the Payment Device. Future commands from ECR must contain this Device ID for the Payment Device to process the command. All other commands will be ignored.

The transaction flow is as below:

  1. ECR sends Pairing command with Device to Payment Device
  2. Payment Device to store the Device ID.
  3. Payment Device return successful status with no data to ECR.

The Pairing command will have to be sent with a different Device ID to change the existing Device ID stored in Payment Device, and to allow the Payment Device to process commands from the new Device.

import de.wirecard.ecr.EcrSdk

var ecr: EcrSdk
var ecrIp: String = "127.0.0.1" // IP address of ecr device
var ecrPort: Int = 7890         // device port

ecr = EcrSdkFactory.createTcpIp(ecrIp, ecrPort)

ecr.pairing(
    PairingRequestData(
        deviceId = "deviceId"
    ))
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe { response, throwable -> ... }
import Ecr

let device = TcpIpDevice(ip: "172.20.10.105", port: 7890)
let ecr = Ecr<TcpIpDevice, JsonWrapper>(device: device)
var cancellables = Set<AnyCancellable>()

ecr.pairing(
        EcrModel.Pairing.RequestBody(
            deviceId: "deviceId"
        )
    )
    .sink(receiveCompletion: { completion in
        switch completion {
        case.finished:
            break;
        case .failure(let error):
            print("error:\(error)")
        }
    }, receiveValue: { data in
        print("data:\(data)")
    })
    .store(in: &cancellables)