Reply
Member
Posts: 1
Registered: ‎10-13-2015

Cannot create account using Java SDK

Hello,
here is our code which have been woking for a while but stoped on 11th of Octomber. Could You please varify it and give me any suggestions. The problem is when we try to post the create account cim transaction. It just blocks in retry attemps to submit the request.

AuthorizenetCreateAccountRequest request = (AuthorizenetCreateAccountRequest) accountRequest;
Environment environment = getEnvironment();

String apiLoginID = request.getApiLogin();
String transactionKey = request.getTransactionKey();
Merchant merchant = Merchant.createMerchant(environment, apiLoginID, transactionKey);

CustomerProfile customerProfile = CustomerProfile.createCustomerProfile();
customerProfile.setMerchantCustomerId(request.getMerchantCustomerId());
customerProfile.setEmail(request.getEmail());
customerProfile.setDescription(request.getDescription());

net.authorize.cim.Transaction transaction = merchant.createCIMTransaction(net.authorize.cim.TransactionType.CREATE_CUSTOMER_PROFILE);
transaction.setCustomerProfile(customerProfile);

CreditCard creditCard = CreditCard.createCreditCard();
creditCard.setCreditCardNumber(request.getCardNumber());
creditCard.setExpirationMonth(request.getExpMonth());
creditCard.setExpirationYear(request.getExpYear());
creditCard.setCardCode(request.getCardCode());

net.authorize.data.xml.Payment payment = net.authorize.data.xml.Payment.createPayment(creditCard);

net.authorize.data.xml.Address address = net.authorize.data.xml.Address.createAddress();
address.setAddress(request.getAddress());
address.setCity(request.getCity());
address.setFirstName(request.getFirstName());
address.setLastName(request.getLastName());
address.setPhoneNumber(request.getPhoneNumber());
address.setState(request.getState());
address.setZipPostalCode(request.getZip());

net.authorize.data.cim.PaymentProfile paymentProfile = net.authorize.data.cim.PaymentProfile.createPaymentProfile();
paymentProfile.setCustomerType(net.authorize.data.xml.CustomerType.INDIVIDUAL);
paymentProfile.addPayment(payment);
paymentProfile.setBillTo(address);

transaction.addPaymentProfile(paymentProfile);
transaction.setValidationMode(ValidationModeType.TEST_MODE);

accountRequest.setSerialized(transaction.toXMLString());

@SuppressWarnings("unchecked")
net.authorize.cim.Result<net.authorize.cim.Transaction> result = (net.authorize.cim.Result<net.authorize.cim.Transaction>) merchant
.postTransaction(transaction);
Highlighted
Posts: 2,765
Topics: 57
Kudos: 251
Blog Posts: 67
Registered: ‎12-05-2011

Re: Cannot create account using Java SDK

Please following the instructions in the thread below to provide information to further troubleshoot this issue.

 

http://community.developer.authorize.net/t5/Integration-and-Testing/Response-returning-empty/m-p/525...

 

Richard