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


Receive POS information

Add this to your AndroidManifest.xml file:

	<package android:name="com.mypos.top" />


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

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


Make a payment

1. Make a 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)
	 // card scheme brandnig
         // Set receipt mode if printer is paired
	 .printMerchantReceipt(MyPOSUtil.RECEIPT_ON) // possible options RECEIPT_ON, RECEIPT_OFF
	 .printCustomerReceipt(MyPOSUtil.RECEIPT_ON) // possible options RECEIPT_ON, RECEIPT_OFF, RECEIPT_AFTER_CONFIRMATION,       
	 //set email or phone e-receipt receiver, works with customer receipt configuration RECEIPT_E_RECEIPT or 

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


2. Handle the payment 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