Closed cmcfatter closed 3 years ago
@cmcfatter Just to verify from my end, I took your code, cleaned up little bit and wrote it inside sample app's MainActivity.java -
void processCardTransaction(){ new Thread(new Runnable() { @Override public void run() { net.authorize.aim.Transaction merchantTransaction = net.authorize.aim.Transaction.createTransaction(AppManager.merchant, net.authorize.TransactionType.AUTH_CAPTURE, new BigDecimal(1.0));
//create new credit card object with required fields
CreditCard creditCard = CreditCard.createCreditCard();
creditCard.setCreditCardNumber("4111111111111111");
creditCard.setExpirationMonth("11");
creditCard.setExpirationYear("2021");
creditCard.setCardCode("123");
//create order item and add to transaction object
Order order = Order.createOrder();
OrderItem oi = OrderItem.createOrderItem();
oi.setItemId("001");
oi.setItemName("testItem");
oi.setItemDescription("Goods");
oi.setItemPrice(new BigDecimal(1.1));
oi.setItemQuantity("1");
oi.setItemTaxable(false);
order.addOrderItem(oi);
order.setTotalAmount(new BigDecimal(1.1));
merchantTransaction.setCreditCard(creditCard);
merchantTransaction.setOrder(order);
try{
net.authorize.Result result = AppManager.merchant.postTransaction(merchantTransaction);
if (result != null){
Log.d(TAG, "processCardTransaction: "+result.toString());
}
} catch (Exception ex){
Log.i(TAG, "failed to post transaction");
Log.i(TAG, "Error message: " + ex.toString());
}
}
}).start();
}
The on the click of "Process Payment With EMV" button, instead of doing EMV transaction, i called up this method. The transaction was successful as shown in the following logcat log-
021-08-23 20:27:44.377 556-863/authorize.net.inperson_sdk_android D/MainActivity: processCardTransaction: Account Number: XXXX1111
Account Type: VISA
Auth Code: 32MWWD
Transaction ID: 40065442989
Transaction Hash: null
Transaction Type:AUTH_CAPTURE
Response Code: APPROVED
Result Code:APPROVED
XML Response:
<?xml version="1.0" encoding="utf-8"?><createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><sessionToken>ulsJbRdugzeSm2bNWnBY97uvFaLdrnfgwTzHGWoRzEi01oPkYxuhKirQB6m$cm2MWmBJBF5pRmfBoAZklMMn$qOjicwGL7SmKy1WyhHw4dGqf7V0kDEinNO_z$APbgSUSqtd0emOceDt85xG_PrZtwAA</sessionToken><transactionResponse><responseCode>1</responseCode><authCode>32MWWD</authCode><avsResultCode>Y</avsResultCode><cvvResultCode>P</cvvResultCode><cavvResultCode>2</cavvResultCode><transId>40065442989</transId><refTransID /><transHash /><testRequest>0</testRequest><accountNumber>XXXX1111</accountNumber><accountType>Visa</accountType><messages><message><code>1</code><description>This transaction has been approved.</description></message></messages><transHashSha2 /><networkTransId>VV0CU7O3LBR5PDPFV85U4OA</networkTransId></transactionResponse></createTransactionResponse>
To see this transaction in your backend, once you login to merchant interface portal, you can go to "Transaction search" tab and search for "unsettled" transaction. You should be able to see this transaction there.
Thank you for your quick answer. I copied your cleaned up code into my project and saw that it was getting error E00027 because Bill To First Name, Bill To Last Name, etc. are required. It seems like I need to change some settings in my account to fix that. Thanks for your help!
I am trying to implement a way to charge a credit card by keying in the information rather than swiping the card. I am referencing the Non-EMV Code Samples in the documentation. My code is saying that the transaction gets posted when I run it but it never shows up in Authorize.net. What am I doing wrong that is not making it show on my authorize.net merchant account? Here is my code:
Thread thread = new Thread(new Runnable() {
@Override public void run() {
} });
thread.start();