- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have my test system setup using the C# SDK for AIM , and due to our company's ordering process, we need to do an Authorization first, then capture the authorization separately. I initially did this using the Capture transaction type, but that obviously isn't correct, because it creates a new transaction. I can't find anything in the SDK about doing a PriorAuthCapture transaction type.
Am I missing something, or is there another way to do the PriorAuthCapture using the C# SDK?
Solved! Go to Solution.
04-16-2012 03:07 PM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is missing from the SDK. You can modify the source.
04-17-2012 04:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the heads-up on the source download RaynorC1emen7, I didn't notice that those were two separate links. I downloaded the source and added a PriorAuthCaptureRequest class in AuthorizeNET/AIM/Requests/ (I just copied and modified the CaptureRequest class. Here is the source:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AuthorizeNet {
/// <summary>
/// A request representing a PriorAuthCaptureRequest - the final transfer of funds that happens after an AuthorizationRequest.
/// </summary>
public class PriorAuthCaptureRequest:GatewayRequest {
/// <summary>
/// Initializes a new instance of the <see cref="PriorAuthCaptureRequest"/> class.
/// </summary>
/// <param name="amount">The amount.</param>
/// <param name="transactionId">The transaction id.</param>
/// <param name="authCode">The auth code.</param>
public PriorAuthCaptureRequest(decimal amount, string transactionId, string authCode)
{
this.SetApiAction(RequestAction.PriorAuthCapture);
this.Queue(ApiFields.Amount, amount.ToString());
this.Queue(ApiFields.TransactionID, transactionId);
this.Queue(ApiFields.AuthorizationCode, authCode);
}
}
}
04-17-2012 04:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is missing from the SDK. You can modify the source.
04-17-2012 04:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How would we modify the source to perform a Prior Authorization Capture?
The class library is pre-compiled into the AuthorizeNet.dll. Can you send a working sample? I'm having the exact same issue. Thanks!
04-17-2012 11:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How did you get this working? If you don't mind, can you share a C# sample?
04-17-2012 11:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I haven't done this yet, but my plan is to write a class that extends GatewayRequest and submits the raw XML request. I will post code when I have done this so that others can use it.
04-17-2012 11:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found a solution using System.Reflection. I downloaded .Net Reflector and found the hidden mothod names inside the GatewayRequest class.
I then found a hidden method named "SetApiAction". This internal method takes the RequestAction Enum as a parameter.
Here's the VB.net code:
'Decalre your CaptureRequest class
Dim auth As CaptureRequest = New AuthorizeNet.CaptureRequest(ord.OrderTotal, ord.ResponseTransactionID, ord.ResponseAuthorizationCode)
'Modify the SDK using System.Reflection, so you can make a prior_auth_capture request
Dim mi As MethodInfo = GetType(CaptureRequest).GetMethod("SetApiAction", BindingFlags.NonPublic Or BindingFlags.Instance)
mi.Invoke(auth, New Object() {RequestAction.PriorAuthCapture})
Let me know if it works for you!
04-17-2012 12:10 PM - edited 04-17-2012 12:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
C# SDKs have two different download, dll or source. Source on the left, dll(binary) on the right.
04-17-2012 01:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the heads-up on the source download RaynorC1emen7, I didn't notice that those were two separate links. I downloaded the source and added a PriorAuthCaptureRequest class in AuthorizeNET/AIM/Requests/ (I just copied and modified the CaptureRequest class. Here is the source:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AuthorizeNet {
/// <summary>
/// A request representing a PriorAuthCaptureRequest - the final transfer of funds that happens after an AuthorizationRequest.
/// </summary>
public class PriorAuthCaptureRequest:GatewayRequest {
/// <summary>
/// Initializes a new instance of the <see cref="PriorAuthCaptureRequest"/> class.
/// </summary>
/// <param name="amount">The amount.</param>
/// <param name="transactionId">The transaction id.</param>
/// <param name="authCode">The auth code.</param>
public PriorAuthCaptureRequest(decimal amount, string transactionId, string authCode)
{
this.SetApiAction(RequestAction.PriorAuthCapture);
this.Queue(ApiFields.Amount, amount.ToString());
this.Queue(ApiFields.TransactionID, transactionId);
this.Queue(ApiFields.AuthorizationCode, authCode);
}
}
}
04-17-2012 04:20 PM
