GenesisGateway.NET 2.0.3

dotnet add package GenesisGateway.NET --version 2.0.3
NuGet\Install-Package GenesisGateway.NET -Version 2.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GenesisGateway.NET" Version="2.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GenesisGateway.NET --version 2.0.3
#r "nuget: GenesisGateway.NET, 2.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GenesisGateway.NET as a Cake Addin
#addin nuget:?package=GenesisGateway.NET&version=2.0.3

// Install GenesisGateway.NET as a Cake Tool
#tool nuget:?package=GenesisGateway.NET&version=2.0.3

Genesis .net

Software License

Overview

Client Library for processing payments through Genesis Payment Processing Gateway. Its highly recommended to checkout "Genesis Payment Gateway API Documentation" first, you can discover it here, in order to get an overview of Genesis's Payment Gateway API and functionality.

Requirements

  • .NET framework 4.5 or later

Installation

  • clone this repo / download the archive
git clone https://github.com/GenesisGateway/genesis_dotnet.git genesis_dotnet && cd genesis_dotnet

Request types

You can use the following request types to initialize various transactions supported by Genesis.

Genesis.NetCore.Entities.Requests.Initial:
* AccountVerification
* Authorize
* Authorize3d
* Avs
* InitRecurringSale
* InitRecurringSale3d
* Payout
* Sale
* Sale3d
* WpfCreate
* GooglePay
* ApplePay

Genesis.NetCore.Entities.Requests.Initial.Threedsv2:
* ContinueRequest

Genesis.NetCore.Entities.Requests.Query:
* Blacklist
* SingleChargeback
* MultiChargeback
* SingleReconcile
* MultiReconcile
* SingleRetrievalRequest
* MultiRetrievalRequest

Genesis.NetCore.Entities.Requests.Referential:
* Capture
* Credit
* RecurringSale
* Refund
* VoidRequest
* WpfReconcile

Example code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Diagnostics;
using System.Reflection;
using Genesis.NetCore;

namespace ExampleConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            Program.SendRequest();
            Console.ReadKey();
        }

        public static void SendRequest()
        {
            // Set connection settings
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            ServicePointManager.CheckCertificateRevocationList = true;

            // Set merchant credentials
            string username = "YOUR_USERNAME";
            string password = "YOUR_PASSWORD";
            string token    = "YOUR_TOKEN";

            // Initialize configuration - endpoint and env
            Configuration configuration = new Configuration(
                Environments.Staging,
                token,
                username,
                password,
                Endpoints.eMerchantPay
            );

            // Initialize Genesis Client
            var genesis = Genesis.NetCore.GenesisClientFactory.Create(configuration);

            // Create Authorize request
            var request = new Genesis.NetCore.Entities.Requests.Initial.Authorize();

            // Set request info
            var random = new Random();
            request.Id = random.Next(1000000, 9000000).ToString();
            request.Usage = "Test Genesis.NET SDK";
            request.RemoteIp = "192.168.0.11";

            // Set amount & currency
            request.Amount = 3.14M;
            request.Currency = Genesis.NetCore.Common.Iso4217CurrencyCodes.EUR;

            // Set card info
            request.CardHolder = "John Smith";
            request.CardNumber = "4200000000000000";
            request.ExpirationMonth = "6";
            request.ExpirationYear = "2029";
            request.Cvv = "888";
            request.Moto = false;

            // Set customer info
            request.CustomerEmail = "john.smith@example.com";
            request.CustomerPhone = "888888888";

            // Set Billing Address
            request.BillingAddress = new Genesis.NetCore.Entities.Address
            {
                Country = Genesis.NetCore.Common.Iso3166CountryCodes.BG,
                City = "Sofia",
                State = "Sofia",
                Address1 = "Street 1",
                ZipCode = "1407",
                FirstName = "John",
                LastName = "Smith"
            };

            // Set Shipping Address
            request.ShippingAddress = new Genesis.NetCore.Entities.Address
            {
                Country = Genesis.NetCore.Common.Iso3166CountryCodes.BG,
                City = "Sofia",
                State = "Sofia",
                Address1 = "Street 1",
                ZipCode = "1407",
                FirstName = "John",
                LastName = "Smith"
            };

            // Business Attributes
            request.BusinessAttributes = new Genesis.NetCore.Entities.Attributes.Request.Financial.Business.BusinessAttributes
            {
                // Business Airlines Air Carriers
                FlightArrivalDate = "23-12-2030",
                FlightDepartureDate = "23-12-2030",
                AirlineCode = "C0D3",
                AirlineFlightNumber = "FLIGHT_NUMBER",
                FlightTicketNumber = "TICKET_NUMBER",
                FlightOriginCity = "ORIGIN_CITY",
                FlightDestinationCity = "DESTINATION_CITY",
                AirlineTourOperatorName = "TOUR_OPERATOR",

                // Event Management
                EventStartDate = "23-12-2030",
                EventEndDate = "24-12-2030",
                EventOrganizerId = "ORGANIZER_ID",
                EventId = "EVENT_ID",

                // Furniture
                DateOfOrder = "23-12-2030",
                DeliveryDate = "24-12-2030",
                NameOfTheSupplier = "SUPPLIER_NAME",

                // Hotels and Real estate rentals
                CheckInDate = "23-12-2030",
                CheckOutDate = "24-12-2030",
                TravelAgencyName = "TRAVEL_AGENCY",

                // Car, Plane and Boat Rentals
                VehiclePickUpDate = "23-12-2030",
                VehicleReturnDate = "24-12-2030",
                SupplierName = "SUPPLIER_NAME",

                // Cruise Lines
                CruiseStartDate = "23-12-2030",
                CruiseEndDate = "23-12-2030",

                // Travel Agencies
                ArrivalDate = "23-12-2030",
                DepartureDate = "24-12-2030",
                CarrierCode = "CARRIER_CODE",
                FlightNumber = "FLIGHT_NUMBER",
                TicketNumber = "TICKET_NUMBER",
                OriginCity = "ORIGIN_CITY",
                DestinationCity = "DESTINATION_CITY",
                TravelAgency = "TRAVEL_AGENCY",
                ContractorName = "CONTRACTOR_NAME",
                AtolCertificate = "ATOL_CERTIFICATE",
                PickUpDate = "22-12-2030",
                ReturnDate = "25-12-2030",

                // Payment Type
                PaymentType = "deposit"
            };

            Result<
                Genesis.NetCore.Entities.Responses.Successful.CardTransactionSuccessResponse,
                Genesis.NetCore.Entities.Responses.Error.CardTransactionErrorResponse> result = genesis.Execute(request);
           
            Console.WriteLine($"{nameof(result.IsSuccessful)}: {result.IsSuccessful}");
            if (result.IsSuccessful)
            {
                Console.WriteLine($"{nameof(result.SuccessResponse.Status)}: {result.SuccessResponse.Status}");
                Console.WriteLine($"{nameof(result.SuccessResponse.TransactionId)}: {result.SuccessResponse.TransactionId}");
                Console.WriteLine($"{nameof(result.SuccessResponse.UniqueId)}: {result.SuccessResponse.UniqueId}");
            }
            else
            {
                Console.WriteLine($"{nameof(result.ErrorResponse.Status)}: {result.ErrorResponse.Status}");
                Console.WriteLine($"{nameof(result.ErrorResponse.TransactionId)}: {result.ErrorResponse.TransactionId}");
                Console.WriteLine($"{nameof(result.ErrorResponse.UniqueId)}: {result.ErrorResponse.UniqueId}");
                Console.WriteLine($"{nameof(result.ErrorResponse.Message)}: {result.ErrorResponse.Message}");
                Console.WriteLine($"{nameof(result.ErrorResponse.TechnicalMessage)}: {result.ErrorResponse.TechnicalMessage}");
            }
        }
    }
}

Example WPF request

Random random = new Random();
Genesis.NetCore.Entities.Requests.Initial.WpfCreate request = new Genesis.NetCore.Entities.Requests.Initial.WpfCreate()
{
    TransactionId = random.Next(1000000, 9000000).ToString(),
    Usage = "Genesis.NET test",
    Amount = 1,
    Currency = Iso4217CurrencyCodes.EUR,
    ConsumerId = "123456", // only avaialable with enabled Tokenization, contact your Account Manager
    RememberCard = "true", // only avaialable with enabled Tokenization, contact your Account Manager
    CustomerEmail = "hello@world.com",
    CustomerPhone = "3598888888888",
    Description = "description",
    TransactionTypes = new Composite[] {
        new Composite() { { "name", TransactionTypes.Sale.ToString() } },
        new Composite() { { "name", TransactionTypes.Authorize.ToString() } }
    },
    ReturnCancelUrl = "http://test.com/cancel",
    ReturnFailureUrl = "http://test.com/fail",
    ReturnSuccessUrl = "http://test.com/success",
    NotificationUrl = "https://example.com/notify",
    BillingAddress = new Address()
    {
        Address1 = "billing address1",
        Address2 = "billing address2",
        City = "billing city",
        Country = Iso3166CountryCodes.BG,
        FirstName = "billing first name",
        LastName = "billing last name",
        State = "BS",
        ZipCode = "1000"
    },
    ShippingAddress = new Address()
    {
        Address1 = "shipping address1",
        Address2 = "shipping address2",
        City = "shipping city",
        Country = Iso3166CountryCodes.BG,
        FirstName = "shipping first name",
        LastName = "shipping last name",
        State = "BS",
        ZipCode = "1000"
    },
    BusinessAttributes = new Genesis.NetCore.Entities.Attributes.Request.Financial.Business.BusinessAttributes()
    {
        // Business Airlines Air Carriers
        FlightArrivalDate = "23-12-2030",
        FlightDepartureDate = "23-12-2030",
        AirlineCode = "C0D3",
        AirlineFlightNumber = "FLIGHT_NUMBER",
        FlightTicketNumber = "TICKET_NUMBER",
        FlightOriginCity = "ORIGIN_CITY",
        FlightDestinationCity = "DESTINATION_CITY",
        AirlineTourOperatorName = "TOUR_OPERATOR",

        // Event Management
        EventStartDate = "23-12-2030",
        EventEndDate = "24-12-2030",
        EventOrganizerId = "ORGANIZER_ID",
        EventId = "EVENT_ID",

        // Furniture
        DateOfOrder = "23-12-2030",
        DeliveryDate = "24-12-2030",
        NameOfTheSupplier = "SUPPLIER_NAME",

        // Hotels and Real estate rentals
        CheckInDate = "23-12-2030",
        CheckOutDate = "24-12-2030",
        TravelAgencyName = "TRAVEL_AGENCY",

        // Car, Plane and Boat Rentals
        VehiclePickUpDate = "23-12-2030",
        VehicleReturnDate = "24-12-2030",
        SupplierName = "SUPPLIER_NAME",

        // Cruise Lines
        CruiseStartDate = "23-12-2030",
        CruiseEndDate = "23-12-2030",

        // Travel Agencies
        ArrivalDate = "23-12-2030",
        DepartureDate = "24-12-2030",
        CarrierCode = "CARRIER_CODE",
        FlightNumber = "FLIGHT_NUMBER",
        TicketNumber = "TICKET_NUMBER",
        OriginCity = "ORIGIN_CITY",
        DestinationCity = "DESTINATION_CITY",
        TravelAgency = "TRAVEL_AGENCY",
        ContractorName = "CONTRACTOR_NAME",
        AtolCertificate = "ATOL_CERTIFICATE",
        PickUpDate = "22-12-2030",
        ReturnDate = "25-12-2030",

        // Payment Type
        PaymentType = "deposit"
    },
    PayLater = "true",
    ReminderLanguage = WpfLocales.EN,
	Reminders = new List<Reminder>
    {
        new Reminder
        {
            After = 40,
            Channel = "email"
        },
        new Reminder
        {
            After = 10,
            Channel = "sms"
        }
    },
    Sca = new Sca
    {
        Exemption = ScaExemptions.LowValue
    },
    WebPaymentFormId = "1"
};

Genesis.NetCore.Result<
    Genesis.NetCore.Entities.Responses.Successful.WpfCreateSuccessResponse,
    Genesis.NetCore.Entities.Responses.Error.WpfCreateErrorResponse
> res = genesis.Execute(request);

Example Sale3D v2 request with "Continue" request

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using Genesis.NetCore;
using Genesis.NetCore.Common;
using Genesis.NetCore.Entities;
using Genesis.NetCore.Entities.Attributes.Request.Financial.Cards.ThreedsV2;
using Genesis.NetCore.Entities.Attributes.Request.Financial.Cards.ThreedsV2.Enums;
using Genesis.NetCore.Entities.Enums;
using Genesis.NetCore.Entities.Requests.Initial;
using Genesis.NetCore.Entities.Requests.Initial.Threedsv2;

namespace ConsoleTest3dv2Requests
{
    class Program
    {
        static void Main(string[] args)
        {
            TestSale3d();
            Console.WriteLine("End. Press any key...");
            Console.ReadKey();
        }

		static void TestSale3d()
        {
            // Set connection settings
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            ServicePointManager.CheckCertificateRevocationList = true;

            // Set merchant credentials
            string username = "YOUR_USERNAME";
            string password = "YOUR_PASSWORD";
            string token    = "YOUR_TOKEN";

            // Initialize configuration - endpoint and env
            var configuration = new Configuration(
                Environments.Staging,
                token,
                username,
                password,
                Endpoints.eMerchantPay
            );

            // Initialize Genesis Client
            var client = GenesisClientFactory.Create(configuration);

            Random random = new Random();
            var request = new Sale3d()
            {
                Id = random.Next(1000000, 9000000).ToString(),
                Usage = "40208 concert tickets",
                RemoteIp = "192.168.2.12",
                Amount = 50,
                Currency = Genesis.NetCore.Common.Iso4217CurrencyCodes.USD,
                CardHolder = "FirstName LastName",
                CustomerEmail = "jhonny@example.com",
                CustomerPhone = "+1678678678678",

                // Test Cases
                CardNumber = "4012000000060085", // Test Case: Synchronous 3DSv2 Request with Frictionless flow
                // CardNumber = "4066330000000004", // Test Case: Asynchronous 3DSv2 Request with 3DS-Method and Frictionless flow
                // CardNumber = "4918190000000002", // Test Case: Asynchronous 3DSv2 Request with Challenge flow
                // CardNumber = "4938730000000001", // Test Case: Asynchronous 3DSv2 Request with 3DS-Method Challenge flow
                // CardNumber = "4901170000000003", // Test Case: Asynchronous 3DSv2 Request with Fallback flow
                // CardNumber = "4901164281364345", // Test Case: Asynchronous 3DSv2 Request with 3DS-Method Fallback flow

                ExpirationMonth = "1",
                ExpirationYear = "2029",
                Cvv = "888",
                BillingAddress = new Address()
                {
                    Address1 = "Muster Str. 18",
                    City = "Los Angeles",
                    Country = Iso3166CountryCodes.US,
                    FirstName = "John",
                    LastName = "Smith",
                    State = "CA",
                    ZipCode = "10178"
                },
                ShippingAddress = new Address()
                {
                    Address1 = "Muster Str. 18",
                    City = "Los Angeles",
                    Country = Iso3166CountryCodes.US,
                    FirstName = "John",
                    LastName = "Smith",
                    State = "CA",
                    ZipCode = "10178"
                },
                NotificationUrl = "https://www.example.com/notification",
                ReturnSuccessUrl = "http://www.example.com/success",
                ReturnFailureUrl = "http://www.example.com/failure",
                ThreeDSv2 = new ThreeDSv2
                {
                    ThreedsMethod = new ThreedsMethod()
                    {
                        CallbackUrl = "https://www.example.com/threeds/threeds_method/callback",
                    },
                    Control = new Control()
                    {
                        DeviceType = DeviceTypes.Browser,
                        ChallengeWindowSize = ChallengeWindowSizes.FullScreen,
                        ChallengeIndicator = ChallengeIndicators.Preference
                    },
                    Purchase = new Purchase()
                    {
                        Category = PurchaseCategories.Service
                    },
                    MerchantRisk = new MerchantRisk()
                    {
                        ShippingIndicator = ShippingIndicators.VerifiedAddress,
                        DeliveryTimeframe = DeliveryTimeframes.Electronic,
                        ReorderItemsIndicator = ReorderItemsIndicators.Reordered,
                        PreOrderPurchaseIndicator = PreOrderPurchaseIndicators.MerchandiseAvailable,
                        PreOrderDate = new DateTime(2030, 12, 31).Date,
                        GiftCard = true,
                        GiftCardCount = 99
                    },
                    CardHolderAccount = new CardHolderAccount()
                    {
                        CreationDate = new DateTime(2020, 05, 25).Date,
                        UpdateIndicator = UpdateIndicators.MoreThan60Days,
                        LastChangeDate = new DateTime(2021, 02, 25).Date,
                        PasswordChangeIndicator = PasswordChangeIndicators.NoChange,
                        PasswordChangeDate = new DateTime(2021, 05, 10).Date,
                        ShippingAddressUsageIndicator = ShippingAddressUsageIndicators.CurrentTransaction,
                        ShippingAddressDateFirstUsed = new DateTime(2021, 05, 20).Date,
                        TransactionsActivityLast24Hours = 2,
                        TransactionsActivityPreviousYear = 10,
                        ProvisionAttemptsLast24Hours = 1,
                        PurchasesCountLast6Months = 5,
                        SuspiciousActivityIndicator = SuspiciousActivityIndicators.NoSuspiciousObserved,
                        RegistrationIndicator = RegistrationIndicators.From30To60Days,
                        RegistrationDate = new DateTime(2020, 05, 25).Date,
                    },
                    Browser = new Browser()
                    {
                        AcceptHeader = "*/*",
                        JavaEnabled = false,
                        Language = "en-GB",
                        ColorDepth = 24,
                        ScreenHeight = 900,
                        ScreenWidth = 1440,
                        TimeZoneOffset = -120,
                        UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36",
                    },
                    Sdk = new Sdk()
                    {
                        Interface = Interfaces.Native,
                        UiTypes = new List<UiTypes>
                    {
                        UiTypes.SingleSelect,
                        UiTypes.MultiSelect,
                        UiTypes.Text
                    },
                    ApplicationId = Guid.Parse("fc1650c0-5778-0138-8205-2cbc32a32d65"),
                    EncryptedData = "encrypted-data-here",
                    EphemeralPublicKeyPair = "public-key-pair",
                        MaxTimeout = 10,
                        ReferenceNumber = "sdk-reference-number-here"
                    },
                    //Recurring = new Recurring()
                    //{
                    //    ExpirationDate = new DateTime(2022, 11, 25).Date,
                    //    Frequency = 30,
                    //}
                },
                //Sca = new Sca()
                //{
                //    Exemption = ScaExemptions.LowRisk
                //}
            };

            try
            {
                var response = client.Execute(request);
                if (response.IsSuccessful)
                {
                    Console.WriteLine("--- Response is successful.");
                    Console.WriteLine($"Unique id:\t\t{response.SuccessResponse.UniqueId}");

                    if (response.SuccessResponse.Status.HasValue)
                    {
                        Console.WriteLine($"Status: \t\t{response.SuccessResponse.Status}");

                        switch (response.SuccessResponse.Status.Value)
                        {
                            case Genesis.NetCore.Entities.Enums.TransactionStates.Approved:
                                Console.WriteLine("--- --- Transaction is Approved.");
                                Console.WriteLine("--- Test Case: Synchronous 3DSv2 Request with Frictionless flow");
                                break;

                             case Genesis.NetCore.Entities.Enums.TransactionStates.PendingAsync:
                                Console.WriteLine("--- Transaction is pending - interaction between consumer and issuer is required.");

                                if (!string.IsNullOrEmpty(response.SuccessResponse.RedirectUrl))
                                {
                                    Console.WriteLine("--- 3DSv2 Challenge");
                                    Console.WriteLine("--- Test Case: Asynchronous 3DSv2 Request with Challenge flow or Fallback flow");
                                    Console.WriteLine($"Redirect type:\t{response.SuccessResponse.RedirectUrlType}");
                                    Console.WriteLine($"Redirect url:\t{response.SuccessResponse.RedirectUrl}");
                                    Console.WriteLine();
                                }

                                if (!string.IsNullOrEmpty(response.SuccessResponse.ThreedsMethodUrl))
                                {
                                    Console.WriteLine($"ThreedsMethodContinueUrl:\t{response.SuccessResponse.ThreedsMethodContinueUrl}");
                                    Console.WriteLine($"ThreedsMethodUrl:\t{response.SuccessResponse.ThreedsMethodUrl}");
                                    Console.WriteLine($"Time: \t{response.SuccessResponse.Time.ToString("o", CultureInfo.InvariantCulture)}");
                                    Console.WriteLine($"ProxyAmount: \t{response.SuccessResponse.ProxyAmount}");

                                    var signature = response.SuccessResponse.GenerateSignature(configuration);
                                    Console.WriteLine($"Signature: \t{signature}");

                                    var continueRequest = new Genesis.NetCore.Entities.Requests.Initial.Threedsv2.ContinueRequest(response.SuccessResponse, configuration);
                                    var continueResponse = client.Execute(continueRequest);

                                        if (continueResponse.IsSuccessful)
                                        {
                                            Console.WriteLine("--- --- Continue request successful.");
                                            Console.WriteLine($"UniqueId: \t\t{continueResponse.SuccessResponse.UniqueId}");
                                            Console.WriteLine($"TransactionId: \t\t{continueResponse.SuccessResponse.TransactionId}");
                                            Console.WriteLine($"Amount: \t\t{continueResponse.SuccessResponse.Amount}");
                                            Console.WriteLine($"Status: \t\t{continueResponse.SuccessResponse.Status}");

                                            if (continueResponse.SuccessResponse.Status == TransactionStates.Approved)
                                            {
                                                Console.WriteLine("--- --- Transaction is Approved.");
                                                Console.WriteLine("--- Test Case: Asynchronous 3DSv2 Request with 3DS-Method and Frictionless flow.");
                                                break;
                                            }

                                            if (continueResponse.SuccessResponse.Status == TransactionStates.PendingAsync)
                                            {
                                                Console.WriteLine("--- --- Status is pending async!");
                                                Console.WriteLine("--- Test Case: Asynchronous 3DSv2 Request with 3DS-Method Challenge flow or 3DS-Method Fallback flow");
                                                Console.WriteLine($"RedirectUrlType: \t{continueResponse.SuccessResponse.RedirectUrlType}");
                                                Console.WriteLine($"RedirectUrl: \t\t{continueResponse.SuccessResponse.RedirectUrl}");
                                            }
                                        }
                                        else
                                        {
                                            Console.WriteLine("--- --- Continue request error.");
                                            Console.WriteLine($"Status: \t\t{continueResponse.ErrorResponse.Status}");
                                            Console.WriteLine($"UniqueId: \t\t{continueResponse.ErrorResponse.UniqueId}");
                                            Console.WriteLine($"Message: \t\t{continueResponse.ErrorResponse.Message}");
                                            Console.WriteLine($"TechnicalMessage: \t{continueResponse.ErrorResponse.TechnicalMessage}");
                                        }

                                        Console.WriteLine();
                                    }

                                    break;
                                case TransactionStates.Declined:
                                    Console.WriteLine("--- --- Transaction is Declined.");
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                else
                {
                    Console.WriteLine("--- Response not successful (error).");
                    Console.WriteLine($"Unique id:\t\t{response.ErrorResponse.UniqueId}");
                    Console.WriteLine($"Status:   \t\t{response.ErrorResponse.Status}");
                    Console.WriteLine($"Message:   \t\t{response.ErrorResponse.Message}");
                    Console.WriteLine($"TechnicalMessage:\t{response.ErrorResponse.TechnicalMessage}");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("--- Exception!");
                var x = ex;
                Console.WriteLine(x.Message);

                while (x.InnerException != null)
                {
                    x = x.InnerException;
                    Console.WriteLine(x.Message);
                }

                if (!string.IsNullOrEmpty(ex.StackTrace))
                {
                    Console.WriteLine("--- Stack trace:");
                    Console.WriteLine(ex.StackTrace);
                }
            }
        }
    }
}

Gateway Notification

With the asynchronous payment flows like Web Payment Form the Gateway sends the transaction events upon status change on the defined notification_url. The library contains a Notification module that helps handle the received gateway notification and can provide easy reconciliation execution.

// Set merchant credentials
string username = "YOUR_USERNAME";
string password = "YOUR_PASSWORD";
string token    = "YOUR_TOKEN";

// Initialize configuration - endpoint and env
Configuration configuration = new Configuration(
    Environments.Staging,
    token,
    username,
    password,
    Endpoints.eMerchantPay
);

var notificationData = string.Format("transaction_id={0}&unique_id={1}&transaction_type={2}&terminal_token={3}&status={4}&signature={5}",
    "transaction_id",
    "unique_id",
    "transaction_type",
    "terminal_token",
    "status",
    "signature");

Notification notification = Notification.Parse(notificationData);

// Validate the Notification
Console.WriteLine(notification.IsAuthentic(configuration));

// Process the notification

// Output the expected response from the Gateway
Console.WriteLine(Encoding.UTF8.GetString(notification.GetEchoResponseBody()));

Managed Recurring

Managed Recurring provides the option to automatically schedule recurring transactions for a specific day and time. Managed Recurring is available after additional configuration.

In order to suit the gateway requirements of sending the amount or max_amount as an integer we are providing an option of doing such minor currency conversion with the help of the library's internal tools.

You can do it in the following way:

ManagedRecurring = new ManagedRecurring()
                {
                    Mode = Mode.Automatic,
                    Interval = Interval.Days,
                    FirstDate = "2040-12-18",
                    TimeOfDay = 5,
                    Period = 22,
                    Amount = new Money(Iso4217CurrencyCodes.USD, 5.5M).MinorAmount,
                    MaxCount = 10
                },

More example requests can be found in the library's specs class Genesis.NETCore.Specs.Mocks.RequestMocksFactory.

More information about each one of the request types can be found in the Genesis API Documentation

License

This software is licensed under the MIT license, quoted <a href="LICENSE" target="_blank">here</a>.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.3 102 1/31/2024
2.0.2 164 6/26/2023
2.0.1 125 5/25/2023
2.0.0 168 1/19/2023

2.0.3
-----
**Features**:

* Improved documentation
* Added support for the following Web Payment Form locales:
 * `NL`, Dutch
 * `IS`, Icelandic
 * `ID`, Indonesian
 * `MS`, Malay
 * `TH`, Thai
 * `CS`, Czech
 * `HR`, Croatian
 * `SL`, Slovenian
 * `FI`, Finnish
 * `NO`, Norwegian
 * `DA`, Danish
 * `SV`, Swedish

2.0.2
-----
**Features**:

* Added Recurring Type attribute support to the following transaction requests: Authorize, Authorize 3D, Sale, Sale 3D, Web Payment Form
* Added Managed Recurring attributes support to the following transaction requests: Authorize, Authorize 3D, Sale, Sale 3D, Init Recurring Sale, Init Recurring Sale 3D
* Added Manager Recurring attributes support to the Web Payment Form Transaction Types Composite object
* Added Reference Id attributes support to the following transaction requests: Authorize, Sale

2.0.1
-----
**Features**:

* Updated project README by adding a reference to the official Gateway API Documentation
* Added Release Notes to the NuGet Package configuration

2.0.0
-----
**Features**:

* Updated the library to `.Net Standard 2.0`  in order to support .NET Core, 5, 6 and 7.  The older compatibility remains. .Net 4.5 and 4.6 are supported with the same codebase and realized by "multi-targeting".
* Replaced the `Genesis.NET` namespace with `Genesis.NETCore`
* Added **Client-Side Encryption** support by adding a boolean parameter `ClientSideEncryption` to the following transaction requests:
 * Authorize
 * Authorize 3D
 * Sale
 * Sale 3D
 * Init Recurring Sale
 * Init Recurring Sale 3D
 * Payout
 * Account Verification
* Removed obsolete `Sale3dAsync`, `Authorize3dAsync`, `InitiRecurringSale3dAsync` transaction requests

1.2.1
-----
**Features**:

* Updated Web Payment Form attributes by extending support with:
 * **Reminder Language**
 * **Reminders**
 * **Pay Later**
 * **Tokenization**
   * **Consumer Id**
   * **Remember Card**
 * **Web Payment Form Id**

1.2.0
-----
**Features**:

* Added 3DSv2 parameters support to the following transaction requests:
   * **Sale 3D**
   * **Authorize 3D**
   * **Initi Recurring Sale 3D**
   * **Web Payment Form**
* Added new Sale 3D, Authorize 3D and Init Recurring Sale 3D classes under `Genesis.Net.Entities.Requests.Initial` namespace. The old Async classes are still available and will be removed in future versions.
* Updated `remote_ip` attribute by marking it as optional.
* Added **SCA** parameters support.
* Updated response parameters - 3DSv2 and more.

**Fixes**:

* Fixed notification response generation

1.1.9
-----
**Features**:

* Added Apple Pay support
* Added Google Pay support

**Fixes**:

* Fixed error upon empty Billing/Shipping Country inside the response

1.1.8
-----
**Features**:

* Added Business Attributes support to the following transaction request:
 * **Authorize**
 * **Authorize 3D**
 * **Sale**
 * **Sale 3D**
 * **Init Recurring Sale**
 * **Init Recurring Sale 3D**
 * **Capture**
 * **Recurring Sale**
 * **Web Payment Form**

1.1.7
-----
**Features**:

* Removed requirement for Certificate usage

1.1.6
-----
**Fixes:**

* Fixed bug with the building of requests' URLs

1.1.5
-----
**Fixes:**

* Updated conditionally required fields in requests
* Removed leftover files after updating filenames

1.1.3
-----
**Features:**

* Added new fields to WPF Create request
 * Card Holder
 * Lifetime
 * Dynamic Descriptor Params
* Added example code to README

**Fixes:**

* Fixed WPF Reconcile request's API URL

1.1.2
-----

**Features:**

* Extended library’s tests to include checking connectivity to the gateways

**Fixes:**

* Fixed issue with SSL certificate’s path in library tests
* Fixed issues with library’s tests - filenames and configs

1.1.1
----

**Fixes**:

* Fixed issue with the conversion from major to minor units based on regional settings
* Fixed syntax error in specs