Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Member
Posts: 4
Registered: ‎12-06-2014
Accepted Solution

Authorize then Capture in the same transaction, is it possible ?

Hi all ,

for now what i'm doing - is sending my values to a function called "CheckPayment"

where i authorize the request using the AIM as such :

 

decimal total = (decimal)_orderTotalCalculationService.GetShoppingCartTotal(cart);

 var request = new AuthorizeNet.AuthorizationRequest(cc_number, cc_date, total, "customer : " + _workContext.CurrentCustomer.Id + " verify card details", false);

var gate = new AuthorizeNet.Gateway(ConfigurationManager.AppSettings["loginId"], ConfigurationManager.AppSettings["transactionKey"]);
var response = gate.Send(request);
if (response.Approved)
{
return Json(new { Status = "success", info = response });
}

 

then i save the AuthorizationCode in a JS variable , after the user is confiming his order , and click ( after another stage ) "Submit" - i send again the card number,date and authorizationCode all over again - when i only Capture the paymentm

here is the code :

public AuthorizeNet.GatewayResponse ClearPayment(string cc_number, string cc_date, string authorizationCode, decimal amount, string cc_code = "")
{
   var capture = new AuthorizeNet.CaptureRequest(authorizationCode,   
                      cc_number, cc_date, amount);
   capture.Type = "CAPTURE_ONLY";
   var gate = new AuthorizeNet.Gateway(   
                 ConfigurationManager.AppSettings["loginId"], 
                 ConfigurationManager.AppSettings["transactionKey"]);
   var response = gate.Send(capture);

   return (AuthorizeNet.GatewayResponse)response;
}

 

the result is :

http://prntscr.com/5e5rtu 

 

that's work - but i'm sure there is a better way - can't i send the transactionId with the authorizationCode and so instead of having 2 transacions - the one that was waiting for the Capture - would change it's status ?  

can someone show me an example of how to do so ?

 

any help would be appriciated , thanks.

 

 

 

 


Accepted Solutions
Solution
Accepted by topic author barak
‎08-21-2015 01:58 AM
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Authorize then Capture in the same transaction, is it possible ?

You can use the "Prior Authorization and Capture" which only required the transactionID

http://developer.authorize.net/guides/AIM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=A_TransTypeFields.8...

 

but couldn't you confirm the order first, then do a auth_capture transaction?

View solution in original post


All Replies
Solution
Accepted by topic author barak
‎08-21-2015 01:58 AM
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Authorize then Capture in the same transaction, is it possible ?

You can use the "Prior Authorization and Capture" which only required the transactionID

http://developer.authorize.net/guides/AIM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=A_TransTypeFields.8...

 

but couldn't you confirm the order first, then do a auth_capture transaction?

Member
Posts: 4
Registered: ‎12-06-2014

Re: Authorize then Capture in the same transaction, is it possible ?

first of all thanks - i did a little manuver but it worked :) .

i've set a new CaptureRequest , then set the Type = "PRIOR_AUTH_CAPTURE" .

did the trick, i guess with a little more effort i would even maybe extend the GateWay Request...

 

i left with another Question though .

how can i "force" the card check - to validate the cvv code ?