Skip to content
An SDK for interacting with the GivePay Gateway with .Net Core!
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
GivePay.Gateway.OAuth
GivePay.Gateway.Tests
GivePay.Gateway
GivePay.RestSharp.Newtonsoft
.gitattributes
.gitignore
GivePay.Gateway.sln
README.md
appveyor.yml

README.md

GivePay Gateway C#

Build status

A library for interacting with FlatRatePay transaction APIs with the GivePay Gateway.

Installation

Install the library with Nuget:

Package Status
GivePay.Gateway NuGet version
GivePay.Gateway.OAuth NuGet version
GivePay.RestSharp.Newtonsoft NuGet version

Usage

Simple sale transaction example:

using GivePay.Gateway.Transactions;
using GivePay.Gateway.Transactions.Client;

// 1. Configure the transaction API client. Use the values provided in the portal for the variables below.
var _client = new DefaultGatewayClientBuilder()
    .WithBaseUri(new Uri(baseUrl))
    .WithOAuthCredentials(new Uri(authority), clientId, clientSecret, scopes)
    .Build();

// 2. Create the Sale request
var saleRequest = new SaleRequest
{
    Amount = new Amount
    {
        // The transaction amount, in USD cents
        BaseAmount = 1000
    },
    Card = new Card
    {
        CardPresent = false,
        // The card's CVV/CVC/CVV2
        Cvv = "xxx",
        ExpirationMonth = "12",
        ExpirationYear = "21",
        // The card number
        Pan = "5105xxxxxxxx5100"
    },
    Mid = _merchantId,
    Terminal = new Terminal
    {
        // The method ofentry
        EntryType = EntryType.Keypad,

        // The terminal's ID
        TerminalId = _terminalId,

        // The type of terminal used
        TerminalType = TerminalType.ECommerce
    },
    Payer = new Payer
    {
        BillingAddress = new Address
        {
            // Billing information can be included
            // for extra fraud protection
            PostalCode = "76132"
        }
    }
};

// 3. Make a call to the API
var response = await _client.AuthorizeAndCaptureAmountAsync(saleRequest);
Console.WriteLine(response.TransactionId);

Voiding a transaction

using GivePay.Gateway.Transactions;
using GivePay.Gateway.Transactions.Client;

var _client = new DefaultGatewayClientBuilder()
    .WithBaseUri(new Uri(baseUrl))
    .WithOAuthCredentials(new Uri(authority), clientId, clientSecret, scopes)
    .Build();

var voidRequest = new VoidRequest
{
    Mid = _merchantId,  // Your Merchant ID
    Terminal = new Terminal
    {
        // The method of entry
        EntryType = EntryType.Keypad,

        // The terminal's ID
        TerminalId = _terminalId,

        // The type of terminal used
        TerminalType = TerminalType.ECommerce
    },

    // The transaction ID from the previous transaction
    TransactionId = "<transaction ID>"
};

var response = await _client.VoidTransactionAsync(voidRequest);
Console.WriteLine(response.TransactionId);

License

givepay/givepay-gateway is licensed under the GPLv3 license.

You can’t perform that action at this time.