cancel
Showing results for 
Search instead for 
Did you mean: 

Not Getting Payment Nonce

I'm new to authorize.net.

 

I'm using this link : https://github.com/AuthorizeNet/inperson-sdk-android.
Now at this link code is provided for NON-EMV cards transaction which works for IdTech devices(as i'm able to understand) and code for EMV cards transaction is only works for EMV/Chip Reader/AnyWhereCommerce device.
Now i'm using code for EMVTransactionListener given in above link(https://github.com/AuthorizeNet/inperson-sdk-android).
My confusion is, at above link(https://github.com/AuthorizeNet/inperson-sdk-android) given code is not passing any details of credit/debit card then how transaction will be occurred successfully.In more when should i pass GOODS, SERVICES and PAYMENT(in emvTransaction.setEmvTransactionType(EMVTransactionType.GOODS);).
If i need to pass credit card details(encrypted) then how will I get those details EMV and NON-EMV for both.
I also want to know that how can I get response in JSON format using In inperson-sdk-android
It will be my pleasure if you can provide complete working code for EMV and NON-EMV for both.

Additionally is there different coding for AnywahereCommerce and Other(IdTech)(as this api supports only this 2 devices) devices. Please guide me.

When user clicks on pay button in my app following code runs.

 

This is my code :

 

private class CreateTransaction extends AsyncTask{

//String cardNumber = "", expirationMonth = "", expirationYear = "", cvv = "";

ProgressDialog progressDialog = null;

net.authorize.mobile.Result loginResult;

Order order = null;
Merchant testMerchant = null;
Customer customer = null;

//net.authorize.aim.Result authCaptureResult = null;

@Override
protected void onPreExecute() {
super.onPreExecute();
/*cardNumber = tietCreditCardNo.getText().toString();
expirationMonth = tietValidUpToMonth.getText().toString();
expirationYear = tietValidUpToYear.getText().toString();
cvv = tietCvv.getText().toString();*/

progressDialog = new ProgressDialog(activity);
progressDialog.setCancelable(false);
progressDialog.setMessage("Requesting for payment...");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.show();
}

@Override
protected Integer doInBackground(Integer... params) {
try {
//first we need to login and Create authentication method based on login, password and device ID
PasswordAuthentication passAuth = PasswordAuthentication.createMerchantAuthentication(getString(R.string.userName), getString(R.string.password), "InpersonSDK-Android-test");

//Create merchant object using authentication method
testMerchant = Merchant.createMerchant(Environment.SANDBOX, passAuth);
testMerchant.setDeviceType(DeviceType.WIRELESS_POS);
testMerchant.setMarketType(MarketType.RETAIL);

//Create login request and populate mobile device field
net.authorize.mobile.Transaction loginTransaction = testMerchant.createMobileTransaction(net.authorize.mobile.TransactionType.MOBILE_DEVICE_LOGIN);
net.authorize.data.mobile.MobileDevice mobileDevice = net.authorize.data.mobile.MobileDevice.createMobileDevice("InpersonSDK-Android-test", "Device description", "425-555-0000", "Android");
loginTransaction.setMobileDevice(mobileDevice);
//post login request to Authorize.net Gateway
loginResult = (net.authorize.mobile.Result) testMerchant.postTransaction(loginTransaction);

if (loginResult.isOk()) {
System.out.println("TAG --> Login Successful");
//if login succeeded, populate session token in the Merchant object
SessionTokenAuthentication sessionTokenAuthentication = SessionTokenAuthentication.createMerchantAuthentication(testMerchant.getMerchantAuthentication().getName(), loginResult.getSessionToken(), "InpersonSDK-Android-test");
if ((loginResult.getSessionToken() != null) && (sessionTokenAuthentication != null)) {
testMerchant.setMerchantAuthentication(sessionTokenAuthentication);
}

publishProgress(50);

//create order item and add to transaction object
order = Order.createOrder();
OrderItem oi = OrderItem.createOrderItem();
oi.setItemId("2");
oi.setItemName("This is sparta");
oi.setItemDescription("Goods");
oi.setItemPrice(new BigDecimal(200.0)); //itemPrice/quantity
oi.setItemQuantity("2");
oi.setItemTaxable(false);
order.addOrderItem(oi);
order.setTotalAmount(new BigDecimal(1.00));

customer = Customer.createCustomer();
customer.setId("12"); //Login user id
customer.setCustomerId("12"); //Login user id
customer.setAddress("Raj Wold Mall, Paalanpur");
customer.setCompany("Narola Infotech PVT. LTD.");
customer.setCity("Surat");
customer.setCustomerType(CustomerType.INDIVIDUAL);
customer.setCountry("India");
customer.setState("Gujarat");
customer.setFirstName("Harshal");
customer.setLastName("Bhatt");
customer.setEmail("omish.mehta@gmail.com");
customer.setZipPostalCode("395008");

Address address = Address.createAddress();
address.setAddress("Narola Infotech, D-Mart Adajan, Surat");
address.setPhoneNumber("1234567890");
address.setZipPostalCode("395008");
address.setCompany("Narola Infotech");
address.setCountry("India");
address.setState("Gujarat");
address.setCity("Surat");
address.setFirstName("Harshal");
address.setLastName("Bhatt");

customer.setShipTo(address);

publishProgress(75);
} else {
//handle login errors in here
}
} catch (Exception e) {
System.out.println("TAG Exception --> " + e.getMessage());
}
return 0;
}

@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
if (values[0] == 50) {
if (progressDialog != null) {
progressDialog.setMessage("Getting customer details...");
}
} else if (values[0] == 75) {
if (progressDialog != null) {
progressDialog.setMessage("Please wait ... making transaction");
}
}
}

@Override
protected void onPostExecute(Integer response) {
super.onPostExecute(response);
try {
startEMVTransaction(customer, order, testMerchant);

if (progressDialog != null) {
progressDialog.dismiss();
}
} catch (Exception e) {
System.out.println("TAG Exception --> " + e.getMessage());
}
}
}

//Called from on onPostExecute
private void startEMVTransaction(Customer customer, Order order, Merchant merchant) {
EMVTransaction emvTransaction = EMVTransactionManager.createEMVTransaction(merchant,
order.getTotalAmount());
emvTransaction.setCustomer(customer);
emvTransaction.setOrder(order);
emvTransaction.setEmvTransactionType(EMVTransactionType.GOODS);
EMVTransactionManager.startEMVTransaction(emvTransaction, this, activity);
}

omimehta
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Hi omimetha,

 

The Authorize.net Android in-person SDK has EMV end-to-end transaction flow that is supposed to work with AnywhereCommerce EMV device, in that case you just need to use EMVTransactionManager to post the transaction to Authorize.net gateway;

 

If you want to use IDTech Shuttle swipe only reader, you would need to get the swiper data using IDTech SDK and then construct the request per Authorize.net gateway requirements, please find more details in the readme: https://github.com/AuthorizeNet/inperson-sdk-android/tree/QuickChip#code-sample-for-non-emv-transact...

 

Please let me know if that solves your problem.

 

Thanks,

Alex

View solution in original post

alex_w
Member
3 REPLIES 3

I think there is no one able to anwswer my question even after i posted my code also...

 

 

omimehta
Member

Hi omimetha,

 

The Authorize.net Android in-person SDK has EMV end-to-end transaction flow that is supposed to work with AnywhereCommerce EMV device, in that case you just need to use EMVTransactionManager to post the transaction to Authorize.net gateway;

 

If you want to use IDTech Shuttle swipe only reader, you would need to get the swiper data using IDTech SDK and then construct the request per Authorize.net gateway requirements, please find more details in the readme: https://github.com/AuthorizeNet/inperson-sdk-android/tree/QuickChip#code-sample-for-non-emv-transact...

 

Please let me know if that solves your problem.

 

Thanks,

Alex

alex_w
Member

Hey...

 

Thanks.. for your help