Skip to content

Payment gateway client meant to be used with multiple gateways that use the same underlying system

License

Notifications You must be signed in to change notification settings

ahwm/payment-gateway-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Payment Gateway Client

nuget

There are several "smaller" merchant payment gateways that all use the same API system. This client is meant to work with all of them. Below is a list of known providers that use this system.

Original documentation: https://integratepayments.transactiongateway.com/merchants/resources/integration/integration_portal.php

https://www.integratepayments.com/payment-gateway/integrate-payments-query-api

http://status.transactiongateway.com/

Known Providers

Note: This is not an indication of endorsement and there is no guarantee of compatibility. With the exception of NMI, these providers have not been tested. Based on current experience, it may be possible to use any of these (and new) providers using the NMI API endpoint though this use case has not been tested.

If you find another gateway that uses this system, please file an issue to get this list updated.

Usage

Credit/Debit Cards

            var securityKey = "6457Thfj624V5r7WUwc5v6a68Zsd6YEm"; // test account
            var client = new GatewayClient(securityKey, GatewayProvider.NMI);
            Sale sale = new Sale
            {
                CardNumber = "4111111111111111",
                CardExpiration = "0323",
                CVV = "999",
                Amount = "5.00",
                FirstName = "John",
                LastName = "Smith",
                Address1 = "1234 Main St.",
                City = "Chicago",
                State = "IL",
                Zip = "60193",
                Payment = "creditcard"
            };

            var result = client.Sale(sale);

ACH/eCheck

            var securityKey = "6457Thfj624V5r7WUwc5v6a68Zsd6YEm"; // test account
            var client = new GatewayClient(securityKey, GatewayProvider.NMI);
            Sale sale = new Sale
            {
                CheckABA = "123123123",
                CheckAccount = "123123123",
                CheckName = "John Smith",
                StandardEntryClass = "WEB",
                Amount = "5.00",
                FirstName = "John",
                LastName = "Smith",
                Address1 = "1234 Main St.",
                City = "Chicago",
                State = "IL",
                Zip = "60193",
                Payment = "check",
                AccountHolderType = "business",
                AccountType = "checking"
            };

            var result = client.Sale(sale);

Response

public class GatewayResponse {
    public readonly GatewayResponseCode Response; // Approved, Declined, Error
    public readonly string ResponseText;
    public readonly ReadOnlyDictionary<string, string> Data;
}

Web hook Validation

.NET Framework

ctx = HttpContext.Current;
// generate/retrieve signing key from gateway portal
string key = "WEBHOOK SIGNING KEY";
string signature = ctx.Request.Headers["webhook-Signature"];
string reqBody = "";
try
{
    using (StreamReader sr = new StreamReader(ctx.Request.InputStream))
        reqBody = await sr.ReadToEndAsync();
}
catch { }
WriteLog($"------{DateTime.UtcNow:R}---------------");
WriteLog(signature);
WriteLog(reqBody);

var status = WebhookParser.ParseWebhookData(reqBody, key, signature);
if (!status.IsValid)
{
    WriteLog($"------{DateTime.UtcNow:R}---------------");
    WriteLog("Webhook validation failed!");
    return;
}
// process status.Data

.NET Core / .NET 5+

// generate/retrieve signing key from gateway portal
string key = "WEBHOOK SIGNING KEY";
string signature = Request.Headers["webhook-Signature"];
string reqBody = "";
try
{
    using (StreamReader sr = new StreamReader(Request.Body))
        reqBody = await sr.ReadToEndAsync();
}
catch { }
WriteLog($"------{DateTime.UtcNow:R}---------------");
WriteLog(signature);
WriteLog(reqBody);

var status = WebhookParser.ParseWebhookData(reqBody, key, signature);
if (!status.IsValid)
{
    WriteLog($"------{DateTime.UtcNow:R}---------------");
    WriteLog("Webhook validation failed!");
    return;
}
// process status.Data

About

Payment gateway client meant to be used with multiple gateways that use the same underlying system

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Languages