The Accept Mobile SDKs, for Android and iOS, provide secure credit card processing, using the same API fields as the Apple Pay and Android Pay secure payment data. This provides maximum flexibility for in-app payments, without the payment data touching your servers.
To obtain a public client key:
Log in to the Authorize.Net Merchant Interface using an administrator account.
Navigate to Account > Settings > Security Settings > General Settings > Manage Public Client Key.
Enter the secret answer to your secret question in the section Create New Public Client Key and click Submit. The client key is shown as a string.
build.gradle file.repositories {
jcenter()
}
dependencies {
compile 'net.authorize:accept-android-sdk:+'
}
AcceptSDKApiClient Object, which can be created as follows:
apiClient = new AcceptSDKApiClient.Builder
(getActivity(),AcceptSDKApiClient.Environment.SANDBOX)
.connectionTimeout(5000) // optional connection time out in milliseconds
.build();
EncryptTransactionObject and it can be created as follows:
EncryptTransactionObject transactionObject = TransactionObject.
createTransactionObject(TransactionType.SDK_TRANSACTION_ENCRYPTION)// type of transaction object
.cardData(prepareCardDataFromFields()) // card data to be encrypted
.merchantAuthentication(prepareMerchantAuthentication()) //Merchant authentication
.build();
EncryptTransactionObject require CardData object and it can be created as follows:
CardData cardData = new CardData.Builder
(CARD_NUMBER,
EXPIRATION_MONTH, // MM
EXPIRATION_YEAR) // YYYY
.cvvCode(CARD_CVV) // Option
.zipCode(ZIP_CODE)// Optional
.cardHolderName(CARD_HOLDER_NAME)// Optional
.build();
EncryptTransactionObject require Merchant Authentication object and it can be created as follows:
ClientKeyBasedMerchantAuthentication merchantAuthentication = ClientKeyBasedMerchantAuthentication.
createMerchantAuthentication(API_LOGIN_ID, CLIENT_KEY);
EncryptTransactionCallback interface. It has following methods.
EncryptTransactionResponse object has Data Descriptor and Data value details which will be used to perform payment transaction.
@Override
public void onEncryptionFinished(EncryptTransactionResponse response)
{
Toast.makeText(getActivity(),response.getDataDescriptor() + " : " + response.getDataValue(),Toast.LENGTH_LONG).show();
}
> Validation of information is failed.
> Network related errors.
> API error response.
ErrorTransactionResponse may contain one or more error messages.
@Override
public void onErrorReceived(ErrorTransactionResponse errorResponse)
{
Message error = errorResponse.getFirstErrorMessage();
Toast.makeText(getActivity(),error.getMessageCode() + " : " + error.getMessageText() ,Toast.LENGTH_LONG).show();
}
[av_one_full first]
There are various native e-commerce and Social Network mobile apps available in the market for example MagentoShop - Shopping App etc that use these steps to to use Authorize.Net payment gateway .
[/av_one_full]
Refrences
User Guide : Authorize.Net Mobile Application
Mobile SDK : Authorize.Net Accept Mobile SDK for Android