78474

Performing Transaction based on previous Transactions in Authorize.NET CIM

Question:

I am new to Authorize.NET. Is reference transaction possible in authorize.net. For example: User A comes and enters the Credit Card details for first time, he does the payment. Now for the second time onwards when he does the payment the details of the previous transaction has to be used (i.e. he will not be entering the details again, the first payment details has to be used by default) and payment has to be done. Is there any such option available in Authorize.NET CIM service.

I am using Authorize.NET SDK from <a href="https://github.com/AuthorizeNet/sdk-dotnet" rel="nofollow">https://github.com/AuthorizeNet/sdk-dotnet</a> This provides me the functions for CIM, but not sure how to use above mentioned scenario. Using PayFlow Pro we can successfully do it (Reference Transaction Concept), Does CIM of authorize.NET provides this feature using CIM.

I am able to authorize the credit card and based on the response("AuthorizationCode") I did capture. Now after that from the capture response parameters I tried to do another transaction. But failed and got the error message : This transaction has been submitted already.

Answer1:

This answer is specific to the authorize.net .Net SDK, using C#.

You should locally store the CIM profileID (unique identifier to the customer profile) and the CIM paymentprofileID(s) (unique identifier(s) for each payment card added to the customer profile). So your customer/user records should have a way to store these two integers.

The documentation from authorize.net for how to use CIM within their .Net SDK, is abysmal at best. I tried to get support from them and they constantly said that the SDK doesn't support CIM, which isn't true because all the methods to use it are there. I'll provide a few lines of code which should point you in the right direction for making use of this powerful tool.

Everything is assuming you are writing code in a class file that is "using AuthorizeNet", and that you have the latest DLLs from authorize.net.

First, the AuthorizeNet class has an "Address" type. This stores address info for either a CIM profile or CIM payment profile. Here's a simple method I built to build an Address object:

private static Address getAddressObject(string fname, string lname, string address, string city, string state, string zip, string phone) { var a = new Address(); a.First = fname; a.Last = lname; a.Street = address; a.City = city; a.State = state; a.Zip = zip; a.Phone = phone; return a; }

Use that method to build one or multiple address objects (shipping, billing, credit card specific, etc), and have them ready for when you interact with the gateway.

Now, create a CustomerGateway object

CustomerGateway cg = new CustomerGateway(loginInfo[0], loginInfo[1], ServiceMode.Live);

Now create an empty Customer object

Customer cust;

At this point, you have two choices:

Look to see if the CIM profile exists by using your locally stored CIMprofileid:

cust = cg.GetCustomer(rdr["CIMprofileID"].ToString());

-or-

Create a new CIMprofile

cust = cg.CreateCustomer(email, description);

Once you have cust set, you can get the CIM profileID from cust.ProfileID

Now, to create a new CIM payment profile using cg.AddCreditCard(). There are 3 overloads for this, #2 adds CVV number, and #3 has the ability to drop in the Address object for AVS. If you do string paymentprofileid = cg.AddCreditCard(), paymentprofileid becomes the number you should store for that credit card, so that you can charge it again in the future. While you can look these up, the card number that CIM returns is formatted as 'XXXX1234', so it can become difficult to match up at a later time.

Once you have these values You can use documented methods to charge a CIM profile card. Best of luck!

Answer2:

What you are asking for is <em>exactly</em> what CIM does. CIM allows you to create a customer payment profile which stores the customer's credit card details on the Authorize.Net server and returns you an ID to reference it. Whenever that customer wishes to make future payments you simply reference that ID to make the payment. The customer does not need to provide you with any additional information.

The error message you are receiving indicates you are <em>not</em> using CIM but AIM (Advanced Integration Method). That is different and unrelated to CIM. To use CIM you must use the CIM API.

Recommend

  • Drive API for Android is broken, right?
  • WPF Listbox commands
  • What is the right syntax for “timeframe” in MailChimp API 3.0
  • How to get the sql state from libpq?
  • Does SmartGit support git-svn?
  • How to force Composer to download a local package?
  • GRPC and types import error in App Engine Datastore
  • end daemon processes with multiprocessing module
  • Neo4j: Filter nodes based on aggregate function
  • Command line installation of Code Signing certificates, .p12 files, and mobileprovisions
  • PHP Listener Script for Paypal Webhooks
  • Implement JwtBearer Authentication in NSwag SwaggerUi
  • Iron Router: How do I send data to the layout?
  • CodeIgniter URI Parameter is partially bypassing an “if” statement
  • Magento get URL before current
  • How Get arguments value using inline assembly in C without Glibc?
  • Clear activity stack before launching another activity
  • Bash if statement with multiple conditions
  • Adding elements to a huge XML file
  • Android application: how to use the camera and grab the image bytes?
  • Automatically associate new Sonar project with custom quality profile and quality gate
  • Create DicomImage from scratch using Dcmtk
  • How to define and use opencv mat of user type
  • Hardware Accelerated Image Scaling in windows using C++
  • Retrieving value from sql ExecuteScalar()
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Java applet as stand-alone Windows application?
  • Cassandra Data Model
  • Can I make an Android app that runs a web view in Chrome 39?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Jquery - Jquery Wysiwyg return html as a string
  • How to include full .NET prerequisite for Wix Burn installer
  • SQL merge duplicate rows and join values that are different
  • Getting Messege Twice Using IMvxMessenger
  • Turn off referential integrity in Derby? is it possible?
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • Reading document lines to the user (python)
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF