https://github.com/mirotechteam/rasedi-c-sharp-sdk
Build desktop, web, or backend integrations for Rasedi using C#. Ideal for Windows-based solutions and enterprise-level systems.
https://github.com/mirotechteam/rasedi-c-sharp-sdk
csharp iraq kurdistan netcore payment-gateway payment-integration paymetn rasedi sdk
Last synced: about 2 months ago
JSON representation
Build desktop, web, or backend integrations for Rasedi using C#. Ideal for Windows-based solutions and enterprise-level systems.
- Host: GitHub
- URL: https://github.com/mirotechteam/rasedi-c-sharp-sdk
- Owner: MirotechTeam
- Created: 2025-07-08T12:57:53.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2026-05-10T09:05:00.000Z (about 2 months ago)
- Last Synced: 2026-05-10T11:17:42.518Z (about 2 months ago)
- Topics: csharp, iraq, kurdistan, netcore, payment-gateway, payment-integration, paymetn, rasedi, sdk
- Language: C#
- Homepage: https://rasedi.com
- Size: 46.9 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
๏ปฟ# C#.NET SDK
A lightweight SDK for interacting with the Rasedi 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
```bash
dotnet add package RasediSDK --version x.x.x
```
---
## ๐ Usage
```C#
using RasediSDK.Rest;
using RasediSDK.Rest.Enums;
using RasediSDK.Rest.Interfaces;
using RasediSDK.Exceptions;
var client = new PaymentRestClient(privateKey, secretKey);
```
> **Note:**
> Switching between sandbox and production mode will be automatically based on (test) and (live) keyword inside secretKey `(test = sandbox mode, live = production mode)`.
---
## ๐ Authentication
The SDK uses a private key and a secret to sign every request with HMAC. Signature logic is handled internally.
---
## ๐งช Example
```C#
string privateKey = `-----BEGIN ENCRYPTED PRIVATE KEY-----
...
-----END ENCRYPTED PRIVATE KEY-----`;
string secretKey = "live_xxx..."; // or "test_xxx..."
var client = new PaymentRestClient(privateKey, secretKey);
```
---
## ๐ API Reference
#### `new PaymentRestClient(string privateKey, string secretKey)`
Creates a new client instance.
---
#### `async Task CreatePaymentAsync(ICreatePayment payload)`
Creates a new payment session.
**Hint:** The `amount` parameter cannot be a decimal value.
**Parameters:**
```C#
new CreatePayment
{
string amount; // e.g. "1000"
GateWays[] gateways; // e.g. [GateWays.ZAIN, GateWays.FIB]
string title;
string description;
string redirectUrl;
string callbackUrl;
bool collectFeeFromCustomer;
bool collectCustomerEmail;
bool collectCustomerPhoneNumber;
}
```
**Returns:**
```C#
new CreatePaymentResponse
{
StatusCode = response.StatusCode,
Body = response.Body,
Headers = response.Headers
};
```
**Example:**
```C#
await client.CreatePaymentAsync( new CreatePayment {
amount: "1000",
gateways: [GateWays.FIB],
title: "Test",
description: "Desc",
redirectUrl: "https://google.com",
callbackUrl: "https://google.com",
collectFeeFromCustomer: false,
collectCustomerEmail: false,
collectCustomerPhoneNumber: false,
});
```
---
#### `async Task GetPaymentByIdAsync(string referenceCode)`
Gets the details of a payment.
**Returns:**
```C#
new PaymentDetailsResponse
{
StatusCode = response.StatusCode,
Body = response.Body,
Headers = response.Headers
};
```
**Example:**
```C#
var status = await client.GetPaymentByIdAsync("your-reference-code");
Console.WriteLine(status.body.status);
```
---
#### `async Task CancelPaymentAsync(string referenceCode)`
Cancels an existing payment.
**Example:**
```C#
await client.CancelPaymentAsync("your-reference-code");
```
**Returns:**
```C#
new CancelPaymentResponse
{
StatusCode = response.StatusCode,
Body = response.Body,
Headers = response.Headers
};
```
---
#### `Using RasediSDK.Exception to catch different type of exception`
The exceptions help you to catch more specific and error-related issues.
**Example:**
```C#
try
{
// 1. Try to get a public key by ID
...................................
// 2. Validate payload content
...................................
// 3. More SDK calls...............
}
catch (PublicKeyNotFoundException ex)
{
Console.WriteLine("Handle missing key specifically: " + ex.Message);
}
catch (InvalidPayloadException ex)
{
Console.WriteLine("Handle invalid payload specifically: " + ex.Message);
}
catch (JwtValidationException ex)
{
Console.WriteLine("Handle JWT validation errors: " + ex.Message);
}
catch (PayloadDeserializationException ex)
{
Console.WriteLine("Handle deserialization errors: " + ex.Message);
}
catch (PemFormatException ex)
{
Console.WriteLine("Handle PEM format errors: " + ex.Message);
}
catch (RasediException ex)
{
// Catch any other SDK-related errors not explicitly caught above
Console.WriteLine("General Rasedi SDK error: " + ex.Message);
}
catch (Exception ex)
{
// Catch unexpected errors not related to SDK
Console.WriteLine("Unexpected error: " + ex.Message);
}
```
---
## ๐ท๏ธ Types
```C#
public enum GateWays
{
[EnumMember(Value = "FIB")]
FIB,
[EnumMember(Value = "ZAIN")]
ZAIN,
[EnumMember(Value = "ASIA_PAY")]
ASIA_PAY,
[EnumMember(Value = "FAST_PAY")]
FAST_PAY,
[EnumMember(Value = "NASS_WALLET")]
NASS_WALLET,
[EnumMember(Value = "CREDIT_CARD")]
CREDIT_CARD
}
```
```
public enum PaymentStatuses
{
[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.
---
## ๐ฏ Testing SDK
You can test the SDK [ โก๏ธ here](https://github.com/MirotechTeam/rasedi-c-sharp-sdk/blob/master/Test/TestSdk.cs).
---