Perform a Payment

Create an intent for the Purchase Activity with the required:

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);
...
}

 

Note: Please make sure that you are using a unique Order ID.

In your calling Activity, override the onActivityResult method to receive a reference of the payment card, customer ID and transaction reference from Performing a Payment:

@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);
      }
}