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
20 REPLIES 20

Yes, I did

It seems to work when I post to https://test.authorize.net/gateway/transact.dll :

***********

2|4|37|The credit card number is invalid.||P|5505041257|||1.23|CC|auth_only||||||||||||||||||||||||||C0F4C840CFC67DE4F613B9EE6B911C90|||||||||||||XXXX2222|Visa||||||||||||||||

***********

 

However, as I'm using XML, I need to post to "https://api.authorize.net/xml/v1/request.api", right?

That a test credit card should work for test.authorize.net/  . Did you change it to secure.authorize.net ?

 

However, as I'm using XML, I need to post to "https://api.authorize.net/xml/v1/request.api", right?

Yes, for xml, just using AIM to see if your loginID, transactionKey is correct.

> That a test credit card should work for test.authorize.net/  . Did you change it to secure.authorize.net ?

Yes, I posted it to https://secure.authorize.net/gateway/transact.dll

 

> Yes, for xml, just using AIM to see if your loginID, transactionKey is correct.


Thanks for the hint. It turns out the URL was being overwritten half way in another method before a connection was made. So it was printing out correct URL, but was connecting to a different one. The call to create a customerProfile works great now. 

 

However, I'm getting the following error when trying to add a new account in that customerProfile:

 

************
[E00027] There is one or more missing or invalid required fields.

************

Any ideas what those missing/invalid fields might be? (I'm keeping the address fields empty - could this be a problem?)

 

Here's my xml:


***********

<?xml version="1.0" encoding="utf-8"?>
<createCustomerPaymentProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>****</name>
<transactionKey>****</transactionKey> 
</merchantAuthentication>
<customerProfileId>***</customerProfileId>
<paymentProfile>
<billTo>
<firstName>John</firstName>
<lastName>Doe</lastName>
<address></address>
<city></city>
<state></state>
<zip></zip>
<country></country>
<phoneNumber></phoneNumber>
<faxNumber></faxNumber>
</billTo>
<payment>
<creditCard>
<cardNumber>4111111111111111</cardNumber>
<expirationDate>2023-12</expirationDate>
</creditCard>
</payment>
</paymentProfile>
<validationMode>liveMode</validationMode>

</createCustomerPaymentProfileRequest>

**************

 

Thanks a lot,

Roman

 

You can check that if you can login to the merchant account -

under Settings, Payment Form, Form Fields

 

Or just populate the bill to address.

Thanks. I checked the Form Fields under Settings, Payment Form and none of them are set to "required". 

 

However, it only works if I fill out a correct billing address for the card. 

 

Is there any way to store the card without the billing address?

 

Thanks again,

Roman

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.

Thanks. I guess it doesn't make much sense to store the card that's not valid. 

 

On the other hand, there is a 1 cent charge the card - any way to avoid it and still authenticate?

It an auth_only transaction, it get void right after the validation. It depend of the card type that some required the $.01 to get process correctly. FYI, every validation create a transaction, that mean a transaction fee.

Thanks for the quick reply. It turns out it's possible to store a credit card without a billing address when the "validationMode" is set to "testOnly" and then charging that card (profileTransAuthCapture) without a problem.

 

This seems odd, since it doesn't let adding a card without a billing address when validationMode is set to "liveMode". 

 

A few specific questions:

1) What is the point of using validationMode "testOnly" (vs "none")? From what I understand, it only checks if the CC number is not mistyped (which I can do with JavaScript on the front end)

 

2) Are there any disadvantages of storing the credit card without a billing address (using CIM)? Will it affect the transaction fees or make it difficult to protect oneself in a potential charge dispute?

3) What is the value of providing a CVC code when storing a credit card (with CIM)?

 

4) How do I change the "from" name/email on the receipt emails that get sent to the customer when their credit card gets charged using the API?

 

Thanks again,

Roman