MiroPaySDK 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MiroPaySDK --version 1.0.0
                    
NuGet\Install-Package MiroPaySDK -Version 1.0.0
                    
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="MiroPaySDK" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MiroPaySDK" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MiroPaySDK" />
                    
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 MiroPaySDK --version 1.0.0
                    
#r "nuget: MiroPaySDK, 1.0.0"
                    
#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 MiroPaySDK@1.0.0
                    
#: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=MiroPaySDK&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MiroPaySDK&version=1.0.0
                    
Install as a Cake Tool

C#.NET SDK

A lightweight SDK for interacting with the Miropay Payment API, built on top of [HttpClient in System.Net.Http and System.Net.Http.Headers] for fast, native HTTP calls and private key-based request signing.


๐Ÿ“ฆ Installation

dotnet add package MiroPaySDK --version x.x.x

๐Ÿš€ Usage

using MiroPaySDK.Rest;
using MiroPaySDK.Rest.Enums;
using MiroPaySDK.Rest.Interfaces;

var client = new PaymentRestClient(privateKey, secretKey, isTest);

Note:
The switch between sandbox and production mode will be manually throw the isTest boolean value (true = sandbox, false = production mode).


๐Ÿ” Authentication

The SDK uses a private key and a secret to sign every request with HMAC. Signature logic is handled internally.


๐Ÿงช Example

string privateKey = `-----BEGIN ENCRYPTED PRIVATE KEY-----
...
-----END ENCRYPTED PRIVATE KEY-----`;

string secretKey = "live_xxx..."; // or "test_xxx..."

bool isTest = false // or true.

var client = new PaymentRestClient(privateKey, secretKey, isTest);

๐Ÿ“˜ API Reference

new PaymentRestClient(string privateKey, string secretKey)

Creates a new client instance.


async Task<ICreatePaymentResponse> CreatePaymentAsync(ICreatePayment payload)

Creates a new payment session.

Hint: The amount parameter cannot be a decimal value.

Parameters:

{
    string amount; // e.g. "1000"
    GATEWAY[] gateways; // e.g. [GATEWAY.ZAIN, GATEWAY.FIB]
    string title;
    string description;
    string callbackUrl;
    bool collectFeeFromCustomer;
    bool collectCustomerEmail;
    bool collectCustomerPhoneNumber;
}

Returns:

<CreatePaymentResponseBody>(Body:
  {
    string ReferenceCode,
    string Amount,
    string? PaidVia,
    string? PaidAt,
    string? CallbackUrl,
    PAYMENT_STATUS Status, 
    string? PayoutAmount
  });
  return new CreatePaymentResponse
    {
      StatusCode = response.StatusCode,
      Body = response.Body,
      Headers = response.Headers
    };

Example:

await client.CreatePaymentAsync({
  amount: "1000",
  gateways: [GATEWAY.FIB],
  title: "Test",
  description: "Desc",
  callbackUrl: "https://google.com",
  collectFeeFromCustomer: false,
  collectCustomerEmail: false,
  collectCustomerPhoneNumber: false,
});

async Task<IPaymentDetailsResponse> GetPaymentByIdAsync(string referenceCode)

Checks the status of a payment.

Returns:

<CreatePaymentResponseBody>(Body:
  {
    string ReferenceCode,
    string Amount,
    string? PaidVia,
    string? PaidAt,
    string? CallbackUrl,
    PAYMENT_STATUS Status, 
    string? PayoutAmount

  });
  return new CreatePaymentResponse
  {
    StatusCode = response.StatusCode,
    Body = response.Body,
    Headers = response.Headers
  };

Example:

var status = await client.GetPaymentByIdAsync("your-reference-code");
Console.WriteLine(status.body.status);

async Task<ICancelPaymentResponse> CancelPaymentAsync(string referenceCode)

Cancels an existing payment.

Example:

await client.CancelPaymentAsync("your-reference-code");

Returns:

<CancelPaymentResponseBody>(Body:
  {
    string ReferenceCode,
    string Amount,
    string? PaidVia,
    string? PaidAt,
    string? CallbackUrl,
    PAYMENT_STATUS Status, 
    string? PayoutAmount

  });
  return new CreatePaymentResponse
  {
    StatusCode = response.StatusCode,
    Body = response.Body,
    Headers = response.Headers
  };

๐Ÿท๏ธ Types

public enum GATEWAY
{
    [EnumMember(Value = "ZAIN")]
    ZAIN,

    [EnumMember(Value = "FIB")]
    FIB
}

public enum PAYMENT_STATUS
{
    [EnumMember(Value = "TIMED_OUT")]
    TIMED_OUT,

    [EnumMember(Value = "PENDING")]
    PENDING,

    [EnumMember(Value = "PAID")]
    PAID,

    [EnumMember(Value = "CANCELED")]
    CANCELED,

    [EnumMember(Value = "FAILED")]
    FAILED,

    [EnumMember(Value = "SETTLED")]
    SETTLED
}

๐Ÿ’ฌ Need Help?

Contact the payment provider or open an issue on the internal GitHub repo.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  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.1 204 8/6/2025
1.0.0 207 8/5/2025