Perform a Payment with stored card


1. Show the card entry form

Create an Intent for the PurchaseActivity with the required Intent extras:

public void onPayWithCardBtnClick(View view) {
	...
Intent intent = new Intent(this, PurchaseActivity.class);
intent.putExtra(MyPos.INTENT_EXTRA_CART_ITEMS,      mIPCCartItems);
intent.putExtra(MyPos.INTENT_EXTRA_ORDER_ID,        
                      String.valueOf(System.currentTimeMillis()));
intent.putExtra(MyPos.INTENT_EXTRA_CARD_TOKEN,      cardToken);
startActivityForResult(intent, MyPos.REQUEST_CODE_PURCHASE);
	...
}

Note: Please make sure that you are using a unique Reference ID for each different consumer.

 

2. Check the payment result

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