rarashed/payplus-sdk
Composer 安装命令:
composer require rarashed/payplus-sdk
包简介
payplus gateway sdk for payment pages
README 文档
README
This PHP SDK allows you to integrate Payplus payment gateway easily, enabling payment link generation and payment processing.
Installation
Prerequisites
Make sure that you have PHP 7.4 or higher installed on your system, along with Composer for dependency management.
-
Install Composer if you haven't already:
Follow the official Composer installation guide for your system.
-
Install the SDK:
In your project directory, run the following command to install the SDK via Composer:
composer require rarashed/payplus-sdk
#OR
composer require rarashed/payplus-sdk --no-plugins
#To configure the SDK, provide your Payplus API credentials and set the appropriate URLs for testing or production environments.
use RaRashed\PayplusSdk\Payplus;
#Define constants for currency and URLs
const CURRENCY = "ILS"; // Payment currency const TEST = "https://restapidev.payplus.co.il/api/v1.0/PaymentPages/generateLink"; // Test URL const PRODUCTION = "https://restapi.payplus.co.il/api/v1.0/PaymentPages/generateLink"; // Production URL
Configuration array
$config = [ 'payment_page_uid' => 'your_payment_page_uid', # Your unique Payment Page ID 'api_key' => 'your_api_key', # Your Payplus API Key 'secret_key' => 'your_secret_key', # Your Payplus Secret Key 'payment_url' => PRODUCTION # API Endpoint URL (use TEST for sandbox environment) ];
Instantiate the Payplus SDK with the configuration
$payplus = new Payplus($config);
#After configuring the SDK, you can send payment data to the Payplus API to generate a payment link. Here's an example:
$paymentData = [ "payment_page_uid" => $config['payment_page_uid'], // Required: Payment Page UID "expiry_datetime" => "30", // Payment link expiry time (in minutes) "refURL_success" => "https://webhook.site", // Redirect URL upon successful payment "refURL_failure" => "https://webhook.site", // Redirect URL upon failed payment "refURL_callback" => "https://webhook.site", // Callback URL for payment status updates "customer" => [ "customer_name" => "John Doe", // Customer's full name "email" => "john.doe@example.com", // Customer's email address "phone" => "1234567890" // Customer's phone number ], "items" => [ [ "name" => "Transaction Item", // Item description "quantity" => 1, // Quantity of the item "price" => 100, // Item price "vat_type" => 0 // VAT type (0 = no VAT) ] ], "amount" => 100, // Total transaction amount "payments" => 1, // Number of payments to be processed "currency_code" => CURRENCY, // Payment currency (e.g., ILS for Israeli Shekel) "sendEmailApproval" => true, // Whether to send an approval email "sendEmailFailure" => false // Whether to send a failure email ];
#Process the payment request and receive a response
$response = $payplus->processPayment($paymentData);
Handle the response
if (is_string($response)) { // Redirect the user to the generated payment page link header("Location: " . $response); exit; } elseif (is_array($response) && $response['status'] === 'error') { // Handle error (e.g., display or log the error) echo json_encode($response); }
#success and callback url will pass status and transaction id
rarashed/payplus-sdk 适用场景与选型建议
rarashed/payplus-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 11 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rarashed/payplus-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rarashed/payplus-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-11-21