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, 0.05f);
        startActivityForResult(intent, MyPos.REQUEST_CODE_STORE_CARD);
	...
}

 

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

 

* MyPos.INTENT_EXTRA_VERIFICATION_AMOUNT is used to store a card with a verification amount that will be charged in the process. This is used as some card issuers do not allow a card to be tokenized with a 0 (zero) amount transaction.

After the card has been stored you can refund the amount you have used for the tokenization. Please, refer to the "Automatic refund" section below.

 

2. Automatic refund

 If you would like to automatically issue a refund for the verification amount you have used while tokenizing the card, you can do that by simply setting one more parameter like so:

intent.putExtra(MyPos.INTENT_EXTRA_AUTO_REVERSE, true);

 

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