Phoenix.AlQaseh 1.0.2

dotnet add package Phoenix.AlQaseh --version 1.0.2
                    
NuGet\Install-Package Phoenix.AlQaseh -Version 1.0.2
                    
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="Phoenix.AlQaseh" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Phoenix.AlQaseh" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Phoenix.AlQaseh" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Phoenix.AlQaseh --version 1.0.2
                    
#r "nuget: Phoenix.AlQaseh, 1.0.2"
                    
#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.
#:package Phoenix.AlQaseh@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Phoenix.AlQaseh&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Phoenix.AlQaseh&version=1.0.2
                    
Install as a Cake Tool

Phoenix.AlQaseh

A lightweight, DI-friendly .NET 9 SDK for the AlQaseh payment gateway.
This single README shows configuration and how to use the client to create a payment.


Install

dotnet add package Phoenix.AlQaseh

(If you’re consuming from GitHub Packages instead of NuGet.org, add the GPR source first.)


Configuration

appsettings.json

{
  "Phoenix": {
    "AlQaseh": {
      "BaseUrl": "https://api-test.alqaseh.com/v1",
      "ClientId": "public_test",
      "ClientSecret": "set-in-user-secrets",
      "PaymentPath": "egw/payments/create"
    }
  }
}

Fields

  • BaseUrl — AlQaseh API base URL (sandbox or production)
  • ClientId / ClientSecret — credentials issued by AlQaseh
  • PaymentPath — relative path for Create Payment, e.g., egw/payments/create

Register the SDK (Dependency Injection)

Option A — Bind from configuration

using Phoenix.AlQaseh.Extensions;

builder.Services.AddAlQaseh(builder.Configuration, "Phoenix:AlQaseh");

Option B — Provide values explicitly (no IConfiguration)

using Phoenix.AlQaseh.Extensions;

builder.Services.AddAlQaseh(
    baseUrl: "https://api.alqaseh.com/v1",
    clientId: "<client-id>",
    clientSecret: "<client-secret>",
    paymentPath: "egw/payments/create");

Option C — Sandbox with sensible defaults (fills missing values)

using Phoenix.AlQaseh.Extensions;

builder.Services.AddAlQasehSandbox();

Under the hood, a named HttpClient "AlQasehClient" is registered with:

  • BaseAddress = BaseUrl
  • Authorization: Basic base64(clientId:clientSecret)
  • Accept: application/json

How to Use

Interface

namespace Phoenix.AlQaseh.Abstractions
{
    public interface IAlQasehHttpClient
    {
        Task<AlQasehPaymentResponse> CreatePayment(CreatePaymentRequest request, CancellationToken cancellationToken);
    }
}

Create a payment

using Phoenix.AlQaseh.Abstractions;
using Phoenix.AlQaseh.Models.Requests;

var client = app.Services.GetRequiredService<IAlQasehHttpClient>();

var request = new CreatePaymentRequest
{
    Amount = 1m,
    Country = "IQ",                   // ISO 3166-1 alpha-2
    Currency = "IQD",                 // ISO 4217
    Description = "Testing",
    Email = "",
    OrderId = Guid.NewGuid().ToString("N"),  // exactly 32 chars (GUID without dashes)
    RedirectUrl = "https://google.com",
    TransactionType = "Retail",
    WebhookUrl = "",
    CustomData = new()
    {
        ["invoiceId"] = "INV-12345",
        ["meta"] = new { any = "thing" }
    }
};

var resp = await client.CreatePayment(request, CancellationToken.None);

if (resp.IsSuccess)
{
    Console.WriteLine($"payment_id={resp.PaymentId}, token={resp.Token}");
    // If your checkout page is token-based, construct the pay URL per AlQaseh docs, e.g.:
    // var payUrl = $"https://pay.alqaseh.com/{resp.Token}";
    // Console.WriteLine($"Pay URL: {payUrl}");
}
else
{
    Console.WriteLine($"Error: code={resp.ErrorCode}, msg={resp.Err}, ref={resp.ReferenceCode}");
}

Success (HTTP 200) response shape

{ "payment_id": "string", "token": "string" }

Error (HTTP 400/401) response shape

{ "err": "string", "error_code": "string", "reference_code": "string" }

License

MIT

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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
1.0.2 147 8/29/2025