Once the SDK is added to your project, using the Payment API can be done with the provided helper classes.


Receive POS info

Here you can find simple info about myPOS terminal like TID, currency name, currency code, merchant info, etc.

MyPOSAPI.registerPOSInfo(MainActivity.this, new OnPOSInfoListener() {
            public void onReceive(POSInfo info) {
                //info is received

Make the payment

1. Make the payment

// Build the payment call
 MyPOSPayment payment = MyPOSPayment.builder()
         // Mandatory parameters
         // Foreign transaction ID. Maximum length: 128 characters
	 // Optional parameters
	 // Enable tipping mode
	 // Operator code. Maximum length: 4 characters
	 // Reference number. Maximum length: 20 alpha numeric characters
	 .reference("asd123asd", ReferenceType.REFERENCE_NUMBER)
	 // Set print receipt mode

// If you want to initiate a moto transaction:

// Or you want to initiate a giftcard transaction:

// Start the transaction
MyPOSAPI.openPaymentActivity(MainActivity.this, payment, 1);

2. Handle the result

In your calling Activity, override the onActivityResult method to handle the result of the payment:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // The same request code as when calling MyPOSAPI.openPaymentActivity
    if (requestCode == 1) {
        // The transaction was processed, handle the response
        if (resultCode == RESULT_OK) {
            // Something went wrong in the Payment core app and the result couldn't be returned properly
            if (data == null) {
                Toast.makeText(this, "Transaction cancelled", Toast.LENGTH_SHORT).show();
            int transactionResult = data.getIntExtra("status", TransactionProcessingResult.TRANSACTION_FAILED);

            Toast.makeText(this, "Payment transaction has completed. Result: " + transactionResult, Toast.LENGTH_SHORT).show();

            // TODO: handle each transaction response accordingly
            if (transactionResult == TransactionProcessingResult.TRANSACTION_SUCCESS) {
                // Transaction is successful
        } else {
            // The user cancelled the transaction
            Toast.makeText(this, "Transaction cancelled", Toast.LENGTH_SHORT).show();

Checking if the transaction is approved can be done by reading the transaction_approved boolean extra from the response:

boolean transaction_approved = data.getBooleanExtra("transaction_approved", false);

if (transaction_approved) {
    // Transaction is approved
} else {
    // Transaction was not approved
    // The response code is in the "response_code" string extra