Skip to content

shift4developer/shift4-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shift4 .NET Library

Build

If you don't already have Shift4 account you can create it here.

Installation

NuGet

To install Shift4, run the following command in the Package Manager Console

PM> Install-Package Shift4 

More info here

Manual

You can download the latest release from here.

Quick start example

Shift4Gateway gateway = new Shift4Gateway("sk_test_[YOUR_SECRET_KEY]");

ChargeRequest request = new ChargeRequest()
{
    Amount = 499,
    Currency = "EUR",
    Card = new CardRequest()
    {
        Number = "4242424242424242",
        ExpMonth = "11",
        ExpYear = "2022"
    }
};

try
{
    Charge charge = await gateway.CreateCharge(request);

    // do something with charge object - see https://dev.shift4.com/docs/api#charge-object
    string chargeId = charge.Id;

}
catch (Shift4Exception e)
{
    // handle error response - see https://dev.shift4.com/docs/api#error-object
    ErrorType errorType = e.Error.Type;
    ErrorCode? errorCode = e.Error.Code;
    string errorMessage = e.Error.Message;
}

Documentation

For further information, please refer to our official documentation at https://dev.shift4.com/docs.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages