ompay/paymentgateway
最新稳定版本:v1.0.0
Composer 安装命令:
composer require ompay/paymentgateway
包简介
A PHP library for integrating with the Ompay payment gateway to process online payments.
README 文档
README
Ompay Payment Gateway is a PHP library that provides an easy-to-use interface for interacting with the Ompay payment gateway API. This library allows you to create orders, check order statuses, and manage transactions securely and efficiently.
Installation
You can install the package via Composer. Run the following command:
composer require ompay/paymentgateway
Features
- Order Management: Create and manage orders through Ompay.
- Transaction Management: Handle transactions with ease.
- 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 8.2 or higher
- Composer
- cURL extension enabled
- Ompay API credentials (Client ID and Client Secret)
Usage
Initialization
require 'vendor/autoload.php'; use Ompay\OmpayPaymentGateway; use Ompay\Resources\OrderAPI; // Initialize the payment gateway $clientId = 'your-client-id'; $clientSecret = 'your-client-secret'; $gateway = new OmpayPaymentGateway($clientId, $clientSecret); // Initialize the OrderAPI $orderAPI = new OrderAPI($gateway);
Creating an Order
$orderData = [ 'receiptId' => 'RE_YOURRECEIPT123', 'amount' => 500, // Amount in smallest currency unit 'currency' => 'INR', 'description' => 'Test Payment', 'customerFields' => [ 'name' => 'John Doe', 'email' => 'john.doe@example.com', 'phone' => '9876543210' ], 'uiMode' => 'checkout' ]; 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(); }
Project Structure
src/ ├── Config.php # Contains API endpoints and configurations ├── OmpayPaymentGateway.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.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-17