Chargily.EpayGateway.NET
1.0.4
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Chargily.EpayGateway.NET --version 1.0.4
NuGet\Install-Package Chargily.EpayGateway.NET -Version 1.0.4
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="Chargily.EpayGateway.NET" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chargily.EpayGateway.NET --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Chargily.EpayGateway.NET, 1.0.4"
#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 Chargily.EpayGateway.NET as a Cake Addin #addin nuget:?package=Chargily.EpayGateway.NET&version=1.0.4 // Install Chargily.EpayGateway.NET as a Cake Tool #tool nuget:?package=Chargily.EpayGateway.NET&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
<img src="https://raw.githubusercontent.com/rainxh11/Chargily.EpayGateway.NET/master/assets/chargily.svg" width="300">
Chargily ePay Gateway C#.NET Plugin, supports ASP.NET Core, Xamarin, .NET MAUI
Integrate ePayment gateway with Chargily easily.
- Currently support payment by CIB / EDAHABIA cards and soon by Visa / Mastercard
- This is a C#.NET Nuget Package, If you are using another programing language Browse here or look to API documentation
Installation
First, install the Chargily.EpayGateway.NET
NuGet package into your app
PM> Install-Package Chargily.EpayGateway.NET
Requirements
- Get your API Key/Secret from ePay by Chargily dashboard for free
The package needs to be configured with your account's secret key, which is available in the ePay Dashboard.
How to use
this package provide ChargilyEpayClient
client, to create payment request use:
using Chargily.EpayGateway.NET;
var client = ChagilyEpay.CreateClient("[API_KEY]");
var payment = new PaymentRequest()
{
InvoiceNumber = "[SOME_INVOICE_NUMER]"
Name = "Ahmed",
Email = "rainxh11@gmail.com",
Amount = 1500,
DiscountPercentage = 5.0,
PaymentMethod = PaymentMethod.EDAHABIA,
RedirectBackTo = "https://example.com/",
CameFrom = "https://shop.com/purchase",
ExtraInfo = "Product Purchase"
};
var response = await client.CreatePayment(payment);
Usage with ASP.NET Core Minimal API
using Chargily.EpayGateway.NET;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddChargilyEpayGateway("[API_KEY]");
var app = builder.Build();
app.MapPost("/invoice",
async ([FromBody] EpayPaymentRequest request,
[FromServices] IChargilyEpayClient<EpayPaymentResponse, EpayPaymentRequest> chargilyClient) =>
{
return await chargilyClient.CreatePayment(request.Adapt<EpayPaymentRequest>());
});
app.Run();
Request:
{
"invoice_number" : "321616",
"client" : "Ahmed",
"client_email" : "rainxh11@gmail.com",
"amount" : 1500,
"discount" : 5.0,
"mode" : "EDAHABIA",
"back_url" : "https://example.com/",
"webhook_url" : "https://shop.com/purchase",
"comment" : "Product Purchase"
}
Response:
{
"httpStatusCode": 201,
"responseMessage": {
"Message": "Success"
},
"isSuccessful": true,
"isRequestValid": true,
"body": {
"checkout_url": "https://epay.chargily.com.dz/checkout/d00c1e652200798bbc35f688b2910fa9bc6c4c30d38b51e3f4142e407fa7c141"
},
"createdOn": "2022-05-06T03:55:49.6527862+01:00"
}
Usage with .NET MAUI
using Microsoft.Maui;
using Microsoft.Maui.Hosting;
using Microsoft.Maui.Controls.Compatibility;
using Microsoft.Maui.Controls.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace MyApp
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp<App>();
builder.Services.AddChargilyEpayGateway("[API_KEY]");
return builder.Build();
}
}
}
then you can add in ViewModels
:
public class MainViewModel : ViewModelBase
{
private ChargilyEpayClient _chargilyClient;
public MainViewModel(ChargilyEpayClient chargilyClient)
{
_chargilyClient = chargilyClient;
}
...
}
This package is using Microsoft.Extensions.DependencyInjection
dependancy injection, so it can be used with application or framework using it.
Product | Versions 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 | 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.
-
.NETStandard 2.0
- FluentValidation (>= 11.0.0)
- FluentValidation.DependencyInjectionExtensions (>= 11.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.1)
- Refit (>= 6.3.2)
- Refit.HttpClientFactory (>= 6.3.2)
- System.Text.Json (>= 6.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.