payment gateway - Performing Transaction based on previous Transactions in Authorize.NET CIM -
i new authorize.net. reference transaction possible in authorize.net. example: user comes , enters credit card details first time, payment. sec time onwards when payment details of previous transaction has used (i.e. not entering details again, first payment details has used default) , payment has done. there such alternative available in authorize.net cim service.
i using authorize.net sdk https://github.com/authorizenet/sdk-dotnet provides me functions cim, not sure how utilize above mentioned scenario. using payflow pro can (reference transaction concept), cim of authorize.net provides feature using cim.
i able authorize credit card , based on response("authorizationcode") did capture. after capture response parameters tried transaction. failed , got error message : transaction has been submitted already.
this reply specific authorize.net .net sdk, using c#.
you should locally store cim profileid (unique identifier client profile) , cim paymentprofileid(s) (unique identifier(s) each payment card added client profile). customer/user records should have way store these 2 integers.
the documentation authorize.net how utilize cim within .net sdk, abysmal @ best. tried back upwards them , said sdk doesn't back upwards cim, isn't true because methods utilize there. i'll provide few lines of code should point in right direction making utilize of powerful tool.
everything assuming writing code in class file "using authorizenet", , have latest dlls authorize.net.
first, authorizenet class has "address" type. stores address info either cim profile or cim payment profile. here's simple method built build address object:
private static address getaddressobject(string fname, string lname, string address, string city, string state, string zip, string phone) { var = new address(); a.first = fname; a.last = lname; a.street = address; a.city = city; a.state = state; a.zip = zip; a.phone = phone; homecoming a; }
use method build 1 or multiple address objects (shipping, billing, credit card specific, etc), , have them ready when interact gateway.
now, create customergateway object
customergateway cg = new customergateway(logininfo[0], logininfo[1], servicemode.live);
now create empty client object
customer cust;
at point, have 2 choices:
look see if cim profile exists using locally stored cimprofileid:
cust = cg.getcustomer(rdr["cimprofileid"].tostring());
-or-
create new cimprofile
cust = cg.createcustomer(email, description);
once have cust set, can cim profileid cust.profileid
now, create new cim payment profile using cg.addcreditcard()
. there 3 overloads this, #2 adds cvv number, , #3 has ability drop in address object avs. if string paymentprofileid = cg.addcreditcard()
, paymentprofileid becomes number should store credit card, can charge 1 time again in future. while can these up, card number cim returns formatted 'xxxx1234', can become hard match @ later time.
once have these values can utilize documented methods charge cim profile card. best of luck!
transactions payment-gateway payment authorize.net authorize.net-cim
No comments:
Post a Comment