Enterprise-Grade Payment Gateway SDK for OnePay Platform
One Pay RESTful Web API Reference (1.1.0) one-pay.info/documentation
OnePay-API-SDK is an official PHP package for rapid integration with the OnePay payment system.
It provides core payment operations:
- ✔ Account Auth Information
- ✔ Create Payment Order
- ✔ Check Order Status
- ✔ Retrieve Invoices
Built on:
- PHP 7.4+
- GuzzleHTTP
- PSR-4 Autoloading
- Environment-based configuration
- Enterprise-level structure
- Fully built on Guzzle HTTP Client
- Supports Internal Validation for all parameters
- Supports Sandbox + Live mode
- Ready to use as REST Proxy
- Easy integration with any PHP app, Laravel, Symfony, or internal systems
- Includes Complete Postman Collection
- Full documentation in
docs/
- PHP >= 7.4
- Composer
- cURL extension enabled
- Valid OnePay API Token
- Merchant ID
composer require onepay-ye/onepay-api-php-sdkThen set your OnePay token:
ONEPAY_TOKEN=YOUR_JWT_TOKEN
ONEPAY_SANDBOX=1
onepay-php-sdk/
├── src/
│ ├── OnePayClient.php
│ ├── Handlers/
│ │ └── ApiHandler.php
│ ├── Validation/
│ │ └── OrderValidator.php
│ └── Exceptions/
│ └── OnePayException.php
├── examples/
│ └── proxy_router.php
├── composer.json
└── README.md
use OnePay\OnePayClient;
$token = "YOUR_ONEPAY_API_TOKEN";
// Live Mode
$onePay = new OnePayClient($token, false);
// Sandbox Mode
$sandboxOnePay = new OnePayClient($token, true);$res = $client->accountInfo("cashpay");
print_r($res);$res = $client->createOrder([
"payment_name"=>"cashpay",
"currency_id"=>"USD",
"payerPhone"=>"967770000000",
"payerEmail"=>"buyer@example.com",
"beneficiaryList"=>[
["amount"=>100,"itemName"=>"ساعة","quantity"=>2]
],
"des"=>"شراء ساعة"
]);
print_r($res);$res = $client->checkOrder([
"payment_name"=>"cashpay",
"payerPhone"=>"967770000000",
"payerEmail"=>"buyer@example.com",
"requestIdRes"=>"66ae540d9736d",
"orderID"=>"order.pay-379-5825"
]);
print_r($res);$res = $client->invoiceList("cashpay","buyer@example.com");
print_r($res);Internal Order Validation (OrderValidator)
You can use OrderValidator to check payload integrity before sending requests:
use OnePay\Validation\OrderValidator;
$payload = [ ... ]; // order payload
if (!OrderValidator::validateCreateOrder($payload, $errors)) {
print_r($errors); // Array of validation errors
}The SDK includes a ready-to-run REST Proxy located in examples/proxy_router.php. It automatically maps incoming HTTP requests to ApiHandler and handles validation out of the box.
Located in:
postman/OnePay-FULL.postman_collection.json
- Do not upload .env
- Use HTTPS
- Do not share your token
Essam Dev
https://essam-art.com
GitHub: https://github.com/onepay-ye