cancel
Showing results for 
Search instead for 
Did you mean: 

How to validate createCustomerPaymentProfileRequest without writing data to CIM if successful

Hi,

I'm having trouble figuring out how to validate a customer payment profile prior to submitting the data for storage within CIM.

 

Today, I am using the "createCustomerPaymentProfileRequest" method. My process is to look and see if the parsedResponse->messages->resultCode != 'Ok'. If the response resultCode does not equal 'Ok', then I map the errors back into the UI and have the user try again after changing their input (fix their CC number or whatever).

 

If the user inputs all the data correctly, I want to know that WITHOUT having submitted the data to CIM for storage, yet.

 

The thing is, my payment profile HTML inputs are part of a larger form and just because they get their payment profile data right, it doesn't mean they filled out the entire form correclty... I don't want to be creating the customer payment profile within CIM unless they've filled out the entire form correctly, not just the payment profile portion.

 

Is there a validate payment profile method of some sort that I can use, rather than trying to write the data to CIM and only knowing that their data was correct if it writes successfully? If anybody knows, please let me know.

 

The only other thing I can think of is to work outside of the CIM functions and simply submit their CC info as an "authorize" transaction (as opposed to an "authorize and capture" transaction) as a method of validation.

 

Any ideas, suggestions, etc. are welcome. Thanks.

 

Best,

-jre

 

erck0006@gmail.com

johnerck
Member
1 ACCEPTED SOLUTION

Accepted Solutions

You can use AIM and do an AUTH_ONLY for $0 or 1¢ depending on what your processor supports (then VOID that transaction). You'll find out if the card is good and get AVS and CVV results. 


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post

View solution in original post

4 REPLIES 4

I'm not understanding the problem. It sounds like you're using regular CIM, not hosted CIM, which means you process the transaction internally and can choose whether to do the profile first or second. Why not just do a basic check to see if all the fields have something in them, enter the non-CIM part of the transaction in your database with a "completed" flag set to false, do the CIM part, then go back and update the transaction to set completed to true and add the profile ID? Assuming of course it worked - if it didn't, you either delete the transaction on your side or have some automated process clean out the uncompleted transactions every so often.

 

Why do you need more than a success/fail on the CIM end of things?

TJPride
Expert

Hmmm, all I'm really looking for is an AuthNet API method designed to simply validate submitted credit card information. I'm looking for something that will take as input:

<billTo>
    <firstName></firstName>
    <lastName></lastName>
    <address></address>
    <city></city>
    <state></state>
    <zip></zip>
    <country></country>
</billTo>
<payment>
    <creditCard>
        <cardNumber></cardNumber>
        <expirationDate></expirationDate>
        <cardCode></cardCode>
    </creditCard>
</payment>

and produce as output either a list of errors - OR - return "true" to indicate that the submitted credit card information was valid.

Do you know of an AuthNet API method that has these characteristics? If so, LMK. Thanks.

You can use AIM and do an AUTH_ONLY for $0 or 1¢ depending on what your processor supports (then VOID that transaction). You'll find out if the card is good and get AVS and CVV results. 


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post

stymiee's solution will work, though if there's any chance you might want to charge the card at some future point, CIM would probably still be a good idea. From the documentation:

 

Input Elements for validateCustomerPaymentProfileRequest
This function is used to verify an existing customer payment profile by generating a test transaction. No customer receipt emails are sent when calling validateCustomerPaymentProfileRequest.

 

<?xml version="1.0" encoding="utf-8"?> 
<validateCustomerPaymentProfileRequest 
xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> 
  <merchantAuthentication> 
    <name>YourUserLogin</name> 
    <transactionKey>YourTranKey</transactionKey> 
  </merchantAuthentication> 
  <customerProfileId>10000</customerProfileId> 
  <customerPaymentProfileId>20000</customerPaymentProfileId> 
  <customerShippingAddressId>30000</customerShippingAddressId> 
  <validationMode>liveMode</validationMode> 
</validateCustomerPaymentProfileRequest>

 Also from the documentation:

 

The validationMode parameter allows you to generate a test transaction at the time you create or  update a customer profile. The functions createCustomerProfileRequest,  createCustomerPaymentProfileRequest, updateCustomerPaymentProfileRequest and  validateCustomerPaymentProfileRequest all include a validationMode element, which can have  one of the following values:

testMode - performs field validation only. During field validation, all fields are checked.  However, fields with unrestricted field definitions (such as telephone number) do not  generate errors.  If you select testMode, a $1.00 test  transaction is submitted to verify that the credit card  number is in a valid format using the Luhn MOD 10 algorithm. This test transaction does  not appear on the customer's credit card statement, but it will generate a transaction receipt  e-mail to the merchant.

 

liveMode - generates a transaction to the processor in the amount of $0.01 or $0.00. If  successful, the transaction is immediately voided. Visa authorization transactions are being  switched from $0.01 to $0.00 for all processors. All other credit card types use $0.01. We  recommend you consult your Merchant Account Provider before switcAuthorizations for Visa, because you may be subject to fees. 

 

For Visa transactions using $0.00, the billTo address and billTo zip fields are required.