Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Contributor
Posts: 19
Registered: ‎10-14-2012
Accepted Solution

Basic CIM workflow in java

Dear all,

I'm trying to implement the functionality to store the credit card details, charge a credit card and refund the charges, but cannot get a good overview of the process. 

 

From what I was able to deduct from code samples and forums, the approximate steps are (I'm using XML):

1) Create a customer profile (name, email, etc) with createCustomerProfileRequest

 

2) Get back the "customerProfileId" and create paymentProfile (createCustomerPaymentProfileRequest, updateCustomerPaymentProfileRequest) - only CC number and expiration - what about the card type (MC, Visa, etc)?


3) Get back the "customerPaymentProfileId" and use it to charge the stored credit card with createCustomerProfileTransactionRequest (profileTransAuthCapture)

 

4) refund with createCustomerProfileTransactionRequest (profileTransRefund)

 

Are the above steps correct and is there a simpler/faster/better way?

 

Could somebody point me in the direction of some simple java/jsp code for the above features?

 

Thanks a lot,

Roman


Accepted Solutions
Solution
Accepted by topic author romanlutsk37
‎08-21-2015 01:58 AM
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Basic CIM workflow in java

You could set validationMode to testMode <validationMode>testMode</validationMode>

But if you do that, it will not validate(run a auth_only transaction) the card before saving.

View solution in original post


All Replies
Posts: 1,609
Topics: 15
Kudos: 209
Solutions: 121
Registered: ‎06-23-2011

Re: Basic CIM workflow in java

Sounds accurate. There is no credit card type, by the way, because card numbers have the type encoded inside them, so a type field is superfluous. I'm afraid I can't help with Java sample code, but the following -may- help:

http://developer.authorize.net/downloads/samplecode/

Contributor
Posts: 19
Registered: ‎10-14-2012

Re: Basic CIM workflow in java

[ Edited ]

Thanks for the quick reply. I was finally able to integrate the code from XML samples (java_cim/XML/CreateProfilesTest.java) into our system.

 

When I try to create the customerProfile, I get the "The merchant login ID or password is invalid or the account is inactive." error. 

I'm posting to  https://apitest.authorize.net/xml/v1/request.api and have double-checked the "name" and "transactionKey" in "merchantAuthentication below, everything is correct:

 

***********

<?xml version="1.0" encoding="utf-8"?>
<createCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>***</name>
<transactionKey>***</transactionKey>
</merchantAuthentication>
<profile>
<merchantCustomerId>custId1</merchantCustomerId>
<description>test</description>
<email>***</email>
</profile>
</createCustomerProfileRequest>

*********

 

Any ideas what else could be wrong?

 

BTW, there is also a parsing error in the HTML they return:

******

<HTML><BODY><H3>The following errors have occurred.</H3>(13) The merchant login
ID or password is invalid or the account is inactive.<BR></BODY></HTML>

******

So, it causes the "sendRequest()" method in "java_cim/XML/APIUtilities.java to return the following error:

[Fatal Error] :1:140: The element type "BR" must be terminated by the matching e
nd-tag "</BR>".
sendRequest: org.xml.sax.SAXParseException: The element type "BR" must be termin
ated by the matching end-tag "</BR>".

 

Should I bring this to their attention somehow?

 

Thanks,

Roman

 

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Basic CIM workflow in java

It this a test account or production account?

Contributor
Posts: 19
Registered: ‎10-14-2012

Re: Basic CIM workflow in java

The account is in test mode currently, but I should still be able to use CIM features, right?

Contributor
Posts: 19
Registered: ‎10-14-2012

Re: Basic CIM workflow in java

I turned the test mode off, but still getting the same error. 

Posts: 2,765
Topics: 57
Kudos: 270
Blog Posts: 67
Registered: ‎12-05-2011

Re: Basic CIM workflow in java

If you are testing in the sandbox, then be certain that you are using the API Login ID and Transaction Key from your sandbox account and not your live production credentials.

 

You can obtain a new transaction key by logging into the sandbox at https://sandbox.authorize.net

 

Richard

Contributor
Posts: 19
Registered: ‎10-14-2012

Re: Basic CIM workflow in java

Thanks, but I've tried with a live URL (https://api.authorize.net/xml/v1/request.api), still the same error. 

 

Any other ideas?

 

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Basic CIM workflow in java

[ Edited ]

So it is a production account? have you try regenerating the transaction Key?

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Basic CIM workflow in java

copy the link and replace the loginID and transactionKey, if you are using production account change the url to secure.authorize.net .

 

https://test.authorize.net/gateway/transact.dll?x_version=3.1&x_type=AUTH_ONLY&x_amount=1.23&x_delim...