cancel
Showing results for 
Search instead for 
Did you mean: 

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

romanlutsk37
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

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

20 REPLIES 20

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/

TJPride
Expert

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

 

It this a test account or production account?

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

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

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

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

 

Any other ideas?

 

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

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...