Table of Contents

Interface IRemoteCapture

Namespace
Dynamicweb.Ecommerce.Orders.Gateways
Assembly
Dynamicweb.Ecommerce.dll
Implement this interface in your CheckOutHandler to support remote capture
public interface IRemoteCapture

Examples

public OrderCaptureInfo Capture(Order order)
{
OrderCaptureInfo captureInfo = new OrderCaptureInfo(OrderCaptureInfo.OrderCaptureState.Failed, "");

Create HTTP POST request to gateway API.
WebRequest request = WebRequest.Create("https://secure.gateway.com/api");

Create byte array with POST data
String httpContent =
"protocol=" + Protocol +
"&msgtype=" + MsgTypes.capture.ToString() +
"&merchant=" + Merchant +
"&amount=" + Amount(order) +
"&transaction=" + Converter.ToString(order.TransactionNumber) +
"&md5check=" + MD5SumForCapture(order);
Byte[] values = Text.Encoding.UTF8.GetBytes(httpContent);

Set headers
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = values.Length;

Get output stream and write content values
using( System.IO.Stream stream = request.GetRequestStream())
{
stream.Write(values, 0, values.Length);
}

Get response from gateway
WebResponse response = request.GetResponse();
LogEvent("Remote capture for '{0}': HttpStatusCode = {1}, HttpStatusDescription = {2}", order.Id, CType(response, HttpWebResponse).StatusCode, CType(response, HttpWebResponse).StatusDescription);
}

Methods

Capture(Order)

OrderCaptureInfo Capture(Order order)

Parameters

order Order

Returns

OrderCaptureInfo
To top