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.
Please review the following documents:
- Charge
- Validate Charge
- Tokenization
- Preauthorization
- Transactions
- Transfers
- Virtual Cards
- Virtual Accounts
- Collection Subaccounts
- Payout Subaacounts
- Subscriptions
- Payment Plans
- Bill Payments
- Banks
- Settlements
- OTP
- Charge Backs
- Misc
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.
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:
You must create an flutterWave account with the following link: Click here
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.
Once you've created a FlutterWave account. Now, go ahead and get an API key from the following link: Click here
Once you've completed the aforementioned steps, let's write our very first program with Standard.AI.OpenAI as follows:
The following example demonstrate how you can write your first direct card charge program.
PCI Compliance is required for direct charge. Check documentation
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"));
}
}
}
The following implementation shows how to accept payments directly from customers in the US and South Africa.
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);
}
}
}
The following implementation shows how to initiate a direct bank charge.
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);
}
}
}
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. |
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.