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 https://github.com/AuthorizeNet/sdk-dotnet 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.
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!