Add Card

Check that you have initialized the SDK before attempting to register a card.

1. Show the card entry form

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

public void onAddCardBtnClick(View view) {
	...
		Intent intent = new Intent(this, StoreCardActivity.class);
intent.putExtra(MyPos.INTENT_EXTRA_VERIFICATION_AMOUNT, Utils.VERIFICATION_AMOUNT);
startActivityForResult(intent, MyPos.REQUEST_CODE_STORE_CARD);
	...
}

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

 

2. Check the Add Card result

In your calling Activity, override the onActivityResult method to receive a card reference for the linked card:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if( resultCode == RESULT_OK  && requestCode == MyPos.REQUEST_CODE_STORE_CARD){
    int status = data.getIntExtra(MyPos.INTENT_EXTRA_STATUS, 
                                               MyPos.STATUS_INTERNAL_API_ERROR
);
    if( status == MyPos.STATUS_SUCCESS) {
        String cardToken = data.getStringExtra(MyPos.INTENT_EXTRA_CARD_TOKEN);
        String cardCustomName = 
                     data.getStringExtra(MyPos.INTENT_EXTRA_CARD_CUSTOM_NAME);
}