Pairing API
When calling YocoSDK.pairTerminal()
, this will start the pairing/connecting to terminal/card machine flow. This will allow being able to connect/pair to a terminal without having to do this in the YocoSDK.charge()
flow.
Parameters
context: Context
- The calling Activity/Fragment initiating the paymentresult: ActivityResultLauncher
- (Optional) Activity result launcher to receive results from pairing activityuserInfo: Map<String, Any>?
- (Optional) Map of key-value pairs, providing additional info
danger
The context
that is passed as a parameter MUST be calling activity/fragment's context and NOT the application context.
Usage
To initiate the pairing/connecting to a terminal/card machine you will need to call the SDK pairTerminal()
method.
import com.yoco.payments.sdk.YocoSDK
\\Sample result callback
private val pairingResult: ActivityResultLauncher<Intent> = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
System.err.println("Pairing Activity: Result Code: ${result.resultCode}") // PaymentSDK.Response.ResultCode
}
...
YocoSDK.pairTerminal(context = context, result = pairingResult)
note
This is the same initial flow as the `Charge API** before it initiates a payment.