ipay / paymentgateway
A PHP library for the IPay payment gateway.
v1.0.0
2026-11-18 12:07 UTC
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^9.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
IPay Payment Gateway is a PHP library that provides an easy-to-use interface for interacting with the IPay payment gateway API. This library allows you to create checkout orders and check order statuses securely and efficiently.
Installation
You can install the package via Composer. Run the following command:
composer require ipay/paymentgateway
Features
- Order Management: Create and manage orders through IPay.
- Transaction Management: Transaction API support is planned for future enhancements.
- Secure Authentication: Uses secure basic authentication for API requests.
- System Information: Attaches system and server information to each request for better tracking and security.
Requirements
- PHP 7.4 or higher
- Composer
- cURL extension enabled
- IPay API credentials (Client ID and Client Secret)
Usage
Initialization
require_once __DIR__ . '/vendor/autoload.php'; use IPay\IPayPaymentGateway; // Initialize the payment gateway $clientId = 'your-client-id'; $clientSecret = 'your-client-secret'; $gateway = new IPayPaymentGateway($clientId, $clientSecret); // Initialize the OrderAPI $orderAPI = $gateway->order;
Creating an Order
$orderData = [ 'receiptId' => 'RE_YOURRECEIPT123', 'amount' => 1, 'currency' => 'QAR', 'description' => 'Test Payment', 'customerFields' => [ 'name' => 'John Doe', 'email' => 'john@example.com', 'phone' => '90000000' ], 'uiMode' => 'checkout', 'redirectType' => 'redirect' ]; try { $orderResponse = $orderAPI->createOrder($orderData); echo "Order Response: " . $orderResponse; } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
Checking Order Status
try { $orderId = 'your-order-id'; // Replace with an actual order ID $statusResponse = $orderAPI->checkStatus($orderId); echo "Order Status: " . $statusResponse; } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
API Endpoints
- Create Order: POST https://pgw-api-uat.ipay.com.qa/nac/api/v1/pg/orders/create-checkout
- Check Order Status: GET https://pgw-api-uat.ipay.com.qa/nac/api/v1/pg/orders/check-status
Project Structure
src/ ├── Config.php # Contains API endpoints and configurations ├── IPayPaymentGateway.php # Handles HTTP requests └── resources/ ├── OrderAPI.php # Methods for order operations └── TransactionAPI.php # Placeholder for future enhancements
Contributing
Contributions are welcome! Feel free to submit issues or pull requests to enhance the library.