PHPackages                             rasedi/php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. rasedi/php-sdk

ActiveLibrary[Payment Processing](/categories/payments)

rasedi/php-sdk
==============

Unofficial PHP SDK for Rasedi payment services

v1.0.8(1mo ago)791MITPHPPHP &gt;=8.1

Since Jul 13Pushed 1mo agoCompare

[ Source](https://github.com/MirotechTeam/rasedi-php-sdk)[ Packagist](https://packagist.org/packages/rasedi/php-sdk)[ RSS](/packages/rasedi-php-sdk/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (6)Versions (13)Used By (0)

Rasedi PHP SDK
==============

[](#rasedi-php-sdk)

Unofficial PHP SDK for integrating with Rasedi Payment Services. This library provides a simple, strongly-typed interface for creating payments, checking status, cancelling transitions, and verifying webhooks.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- `guzzlehttp/guzzle` ^7.7
- `ext-openssl`
- `ext-json`

Installation
------------

[](#installation)

Install via Composer:

```
composer require rasedi/php-sdk
```

Configuration
-------------

[](#configuration)

You need your **Private Key** (PEM format) and **Secret Key** provided by the Rasedi dashboard.

### Environment Variables

[](#environment-variables)

It is recommended to load credentials from environment variables or a `.env` file.

Important

When using a `.env` file, the `PRIVATE_KEY` must be provided as a **single line**. Replace all actual newlines in the PEM file with the literal characters `\n`. Do **not** use actual line breaks (Enter) within the double quotes.

```
# .env
PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2Vw...if4+rx\n-----END PRIVATE KEY-----"
SECRET_KEY="test_..."
BASE_URL="https://api.rasedi.com"
```

Usage
-----

[](#usage)

### 1. Initialize the Client

[](#1-initialize-the-client)

```
use Rasedi\Sdk\PaymentClient;

$privateKey = "your_private_key_content"; // Or getenv('PRIVATE_KEY')
$secretKey = 'your_secret_key';

$client = new PaymentClient(
    privateKey: $privateKey,
    secretKey: $secretKey
);
```

### 2. Create a Payment

[](#2-create-a-payment)

```
use Rasedi\Sdk\Interfaces\ICreatePayment;
use Rasedi\Sdk\Enum\Gateway;

$payload = new ICreatePayment(
    amount: '10000', // Amount in smallest unit (e.g., cents/dinars)
    gateways: [Gateway::FIB, Gateway::ZAIN],
    title: 'Order #1234',
    description: 'Payment for digital goods',
    redirectUrl: 'https://your-site.com/return',
    callbackUrl: 'https://your-site.com/webhook',
    collectFeeFromCustomer: true,
    collectCustomerEmail: true,
    collectCustomerPhoneNumber: false
);

try {
    $response = $client->createPayment($payload);

    echo "Payment Created:\n";
    echo "Reference: " . $response->body->referenceCode . "\n";
    echo "Redirect URL: " . $response->body->redirectUrl . "\n";

    // Redirect user to $response->body->redirectUrl
} catch (\Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

### 3. Get Payment Details

[](#3-get-payment-details)

Retrieve the current status of a payment using its reference code.

```
$referenceCode = 'cf002d99-40e0-4dd3-9dd7-19e78333739f';
$details = $client->getPaymentByReferenceCode($referenceCode);

echo "Status: " . $details->body->status->value . "\n"; // e.g., PENDING, SUCCESS, FAILED
```

### 4. Cancel a Payment

[](#4-cancel-a-payment)

```
$referenceCode = 'cf002d99-40e0-4dd3-9dd7-19e78333739f';
$cancelResponse = $client->cancelPayment($referenceCode);

echo "New Status: " . $cancelResponse->body->status->value . "\n"; // CANCELLED
```

### 5. Verify Webhook Signature (Depricated)

[](#5-verify-webhook-signature-depricated)

The SDK can verify the `X-Signature` or payload signature sent by Rasedi webhooks to ensure authenticity.

```
use Rasedi\Sdk\Interfaces\IVerifyPayload;

// Assuming you receive the payload as a JSON object or array
$payloadData = [
    'keyId' => '...',
    'content' => '...' // JWT-like signed content
];

try {
    // This will fetch public keys automatically if needed and verify the signature
    $verification = $client->verify($payloadData);

    // $verification->body contains the decoded payment update info
    $param = $verification->body;

    echo "Verified Update for: " . $param['referenceCode'] . "\n";
    echo "New Status: " . $param['status'] . "\n";

} catch (\Exception $e) {
    // Signature verification failed
    http_response_code(400);
    echo "Invalid signature";
}
```

Enum Reference
--------------

[](#enum-reference)

### Gateway

[](#gateway)

- `Gateway::FIB` - First Iraqi Bank
- `Gateway::ZAIN` - ZainCash
- `Gateway::ASIA_PAY` - Asia Pay
- `Gateway::FAST_PAY` - Fast Pay
- `Gateway::NASS_WALLET` - Nass Wallet
- `Gateway::CREDIT_CARD` - Credit Card

### PaymentStatus

[](#paymentstatus)

- `PENDING`
- `SUCCESS`
- `FAILED`
- `CANCELLED`
- `EXPIRED`

License
-------

[](#license)

MIT

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance89

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Total

10

Last Release

55d ago

Major Versions

0.0.1-alpha → v1.0.02026-01-18

PHP version history (2 changes)0.0.1-alphaPHP &gt;=7.4

v1.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/56789240?v=4)[Maziar Daraei](/maintainers/maziarit)[@maziarit](https://github.com/maziarit)

---

Top Contributors

[![duniyalr](https://avatars.githubusercontent.com/u/72468517?v=4)](https://github.com/duniyalr "duniyalr (1 commits)")

---

Tags

iraqkurdistanpayment-gatewaypayment-integrationpaymentsphprasedisdksdk-phpphpsdkpaymentrasedi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rasedi-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/rasedi-php-sdk/health.svg)](https://phpackages.com/packages/rasedi-php-sdk)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M13](/packages/checkout-checkout-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
