Skip to content

FlutterWave.Core is a Standard-Compliant .NET library built on top of FlutterWave API RESTful endpoints to enable software engineers to develop FinTech solutions in .NET.

License

Notifications You must be signed in to change notification settings

SlimAhmad/FlutterWave.Core

Repository files navigation

FlutterWave.Core

FlutterWave.Core

.NET Nuget Nuget The Standard - COMPLIANT

Introduction

FlutterWave.Core is a Standard-Compliant .NET library built on top of FlutterWave API RESTful endpoints to enable software engineers to develop FinTech solutions in .NET.

This library implements the following section

Please review the following documents:

Standard-Compliance

This library was built according to The Standard. The library follows engineering principles, patterns and tooling as recommended by The Standard.

This library is also a community effort which involved many nights of pair-programming, test-driven development and in-depth exploration research and design discussions.

How to use this library?

In order to use this library there are prerequisites that you must complete before you can write your first C#.NET program. These steps are as follows:

FlutterWave Account

You must create an flutterWave account with the following link: Click here

Nuget Package

Install the FlutterWave.Core library in your project. Use the method best suited for your development preference listed at the Nuget Link above or below.

Nuget

API Keys

Once you've created a FlutterWave account. Now, go ahead and get an API key from the following link: Click here

Hello, World!

Once you've completed the aforementioned steps, let's write our very first program with Standard.AI.OpenAI as follows:

Direct Charge

The following example demonstrate how you can write your first direct card charge program.

PCI Compliance is required for direct charge. Check documentation

Program.cs

using System;
using System.Threading.Tasks;
using FlutterWave.Core;
using FlutterWave.Core.Models.Services.Foundations.FlutterWave.Charge;

namespace ExampleFlutterWaveNet
{
    internal class Program
    {
        static async Task Main(string[] args)
        {

            var apiConfigurations = new ApiConfigurations
            {
                
                ApiKey = Environment.GetEnvironmentVariable("ApiKey"),

            };

            this.flutterWaveClient = new FlutterWaveClient(apiConfigurations);

            // given
            var request = new CardCharge
            {
                Request = new CardChargeRequest
                {
                    CardNumber = "5531886652142950",
                    Cvv = "564",
                    ExpiryMonth = 09,
                    ExpiryYear = 32,
                    Currency = "NGN",
                    Amount = 100,
                    FullName = "Yolande Aglaé Colbert",
                    Email = "[email protected]",
                    TxRef = "MC-3243e",
                    RedirectUrl = "https://www,flutterwave.ng",
                    Authorization = new CardChargeRequest.AuthorizationData
                    {
                        Address = "3563 Huntertown Rd, Allison park, PA",
                        Pin = 3310,
                        City = "San Francisco",
                        Country = "US",
                        State = "California",
                        Mode = "pin",
                        ZipCode = "94105"

                    },
                    Preauthorize = true,
                    Meta = new CardChargeRequest.CardMeta
                    {
                        FlightId = "",
                        SideNote = ""
                    },
                    PaymentPlan = "",
                    DeviceFingerprint = "",
                    ClientIp = "127.0.0.1"

                }
            };

           

            // . when
            CardCharge responseFlutterWaveModels =
                await this.flutterWaveClient.Charge.ChargeCardAsync(
                request, Environment.GetEnvironmentVariable("EncryptionKey"));

          
        }
    }
}

ACH Charge

The following implementation shows how to accept payments directly from customers in the US and South Africa.

Program.cs

using System;
using System.Threading.Tasks;
using FlutterWave.Core;
using FlutterWave.Core.Models.Services.Foundations.FlutterWave.Charge;

namespace ExampleFlutterWaveNet
{
    internal class Program
    {
        static async Task Main(string[] args)
        {

            var apiConfigurations = new ApiConfigurations
            {
                
                ApiKey = Environment.GetEnvironmentVariable("ApiKey"),

            };

            this.flutterWaveClient = new FlutterWaveClient(apiConfigurations);

           // given
            var request = new ACHPayments
            {
                Request = new ACHPaymentsRequest
                {
                    TxRef = "MC-1585230ew9v5050e8",
                    Amount = 100,
                    Currency = "USD",
                    Country = "US",
                    Email = "[email protected]",
                    PhoneNumber = "0902620185",
                    FullName = "Yolande Aglaé Colbert",
                    ClientIp = "154.123.220.1",
                    RedirectUrl = "https://www.flutterwave.com/us/",
                    DeviceFingerprint = "62wd23423rq324323qew1",

                    Meta = new ACHPaymentsRequest.ACHPaymentsMeta
                    {
                        FlightID = "123949494DC",
                    },


                }
            };

            // . when
            ACHPayments responseFlutterWaveModels =
                await this.flutterWaveClient.Charge.ChargeACHPaymentsAsync(request);
        }
    }
}

NGBank Account Charge

The following implementation shows how to initiate a direct bank charge.

Program.cs

using System;
using System.Threading.Tasks;
using FlutterWave.Core;
using FlutterWave.Core.Models.Services.Foundations.FlutterWave.Charge;

namespace ExampleFlutterWaveNet
{
    internal class Program
    {
        static async Task Main(string[] args)
        {

            var apiConfigurations = new ApiConfigurations
            {
                
                ApiKey = Environment.GetEnvironmentVariable("ApiKey"),

            };

            this.flutterWaveClient = new FlutterWaveClient(apiConfigurations);

            // given
            var request = new NGBankAccounts
            {
                Request = new NGBankAccountsRequest
                {
                    TxRef = "MC-1585230ew9v5050e8",
                    Amount = 100,
                    AccountBank = "044",
                    AccountNumber = "0690000032",
                    Currency = "NGN",
                    Email = "[email protected]",
                    PhoneNumber = "0902620185",
                    FullName = "Yolande Aglaé Colbert"
                }
            };

            // . when
            NGBankAccounts responseFlutterWaveModels =
                await this.flutterWaveClient.Charge.ChargeNGBankAccountAsync(request);
        }
    }
}

Exceptions

FlutterWave.Core may throw following exceptions:

Exception Name When it will be thrown
BankClientValidationException This exception is thrown when a validation error occurs while using the bank client. For example, if required data is missing or invalid.
BankClientDependencyException This exception is thrown when a dependency error occurs while using the bank client. For example, if a required dependency is unavailable or incompatible.
BankClientServiceException This exception is thrown when a service error occurs while using the bank client. For example, if there is a problem with the server or any other service failure.
BillPaymentsClientValidationException This exception is thrown when a validation error occurs while using the bill payments client. For example, if required data is missing or invalid.
BillPaymentsClientDependencyException This exception is thrown when a dependency error occurs while using the bill payments client. For example, if a required dependency is unavailable or incompatible.
BIllPaymentsClientDependencyException This exception is thrown when a service error occurs while using the bill payments client. For example, if there is a problem with the server or any other service failure.

How to Contribute

If you want to contribute to this project please review the following documents:

If you have a question make sure you either open an issue or join our Ahmad Salim discord server.

About

FlutterWave.Core is a Standard-Compliant .NET library built on top of FlutterWave API RESTful endpoints to enable software engineers to develop FinTech solutions in .NET.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages