Initialization

Start using myPOS Mobile Checkout Android SDK by initializing the setup. Simply find your account’s identification token (Wallet ID) and wallet secret on the Dashboard and add them to your app's main Activity class.

protected void onCreate(Bundle savedInstanceState) {
	...
		MyPos myPos = MyPos.getInstance();
		myPos.init(
        		Utils.MYPOS_SID,
        		Utils.MYPOS_WALLET_NUMBER,
        		Utils.CURRENCY,
        		Utils.CLIENT_PRIVATE_KEY,
        		Utils.SERVER_PUBLIC_KEY
);
	...
}

The SDK allows further configuration by using the existing settings. These are the options:

  • Supported card networks – Allows you to determine the accepted card networks when using your app. The default value includes Visa, Visa Electron, MasterCard, Maestro and VPay.

Address Verification Service (AVS) – You will be able to capture the consumer’s country and postcode as an additional security layer.


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