credopay/paymentgateway
最新稳定版本:v1.0.0
Composer 安装命令:
composer require credopay/paymentgateway
包简介
A PHP library for integrating with the CredoPay payment gateway to process online payments.
关键字:
README 文档
README
CredoPay Payment Gateway is a PHP library that provides an easy-to-use interface for interacting with the CredoPay 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 credopay/paymentgateway
Features
- Order Management: Create and manage orders through CredoPay.
- 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
- CredoPay API credentials (Client ID and Client Secret)
Usage
Initialization
require 'vendor/autoload.php'; use CredoPay\CredoPayPaymentGateway; use CredoPay\Resources\OrderAPI; // Initialize the payment gateway $clientId = 'your-client-id'; $clientSecret = 'your-client-secret'; $gateway = new CredoPayPaymentGateway($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(); }
API Endpoints
- Create Order: POST https://api.thecenterfirst.com/nac/api/v1/pg/orders/create-checkout
- Check Order Status: GET https://api.thecenterfirst.com/nac/api/v1/pg/orders/check-status
Project Structure
src/ ├── Config.php # Contains API endpoints and configurations ├── CredoPayPaymentGateway.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.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-03