How to Perform a Payment

The myPOS SDK allows you to initiate a payment transaction by launching the PurchaseActivity. Make sure the SDK is already initialized before proceeding.

Start the Payment Flow

To start a payment, prepare your cart and launch the PurchaseActivity with the required intent extras:

ArrayList<CartItem> mIPCCartItems;
public void onPayBtnClick(View view) {
...
  Intent intent = new Intent(this, PurchaseActivity.class);
  intent.putExtra(MyPos.INTENT_EXTRA_CART_ITEMS , mIPCCartItems);
  intent.putExtra(MyPos.INTENT_EXTRA_ORDER_ID   , “12345678”);
  startActivityForResult(intent, MyPos.REQUEST_CODE_PURCHASE);
...
}

Important: Use a unique Order ID for every transaction to avoid conflicts or duplicate processing.

Handle the Payment Result

After the payment is completed (or failed), capture the result by overriding onActivityResult() in your calling activity:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if( resultCode == RESULT_OK  && requestCode == MyPos.REQUEST_CODE_PURCHASE ) {
      int status = data.getIntExtra(MyPos.INTENT_EXTRA_STATUS, MyPos.STATUS_INTERNAL_API_ERROR);
        
      if( status == MyPos.STATUS_SUCCESS) {
        String tranRef = data.getStringExtra(MyPos.INTENT_EXTRA_TRANSACTION_REFERENCE);
      }
}

This method returns key details including

  • Transaction Reference – useful for receipts or tracking
  • Customer ID (if available)
  • Payment Card Token (if stored)