payplug / payplug-php
一个简单的PHP库,用于PayPlug公共API。
Requires
- php: >=5.3.0
- ext-curl: *
- ext-openssl: *
Requires (Dev)
- phpdocumentor/phpdocumentor: 2.*
- phpunit/phpunit: 5.7.*
- dev-master
- 3.5.6
- 3.5.5
- 3.5.4
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.1
- 3.4.0.x-dev
- 3.4.0
- 3.3.3
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.7.0
- 2.6.0
- 2.5.1
- 2.4.0
- 2.3.0
- 2.2.1
- 2.2.0
- 2.0.0
- dev-Mock-MPDC
- dev-PRE-1935-fix-send-mock
- dev-PRE-1935-save-data-on-MPDC
- dev-PRE-2007-add-bearer-token-mpdc
- dev-PRE-2117-add-php-8.x-compatibility
- dev-PRE-2258-implement-applepay-method
- dev-PRE-2607-check-secret-key
- dev-PRE-299-automate-tag
- dev-PRE-342-get-publishable-keys
- dev-PRE-test
- dev-PRE-test-sonar
- dev-accountingreports
- dev-action-phpunit
- dev-add-matrix-php-version
- dev-deferred-payment
- dev-demo-test
- dev-develop
- dev-dotenv
- dev-dsp2-release
- dev-fbureau-readme
- dev-fix-composer
- dev-fix-getpubKeys
- dev-fix-lib-version
- dev-fix-phpdoc
- dev-fix-pubkeys
- dev-fix-retrieve-payment
- dev-get-oney-simulations
- dev-installment-plan
- dev-installment-plan-notification
- dev-patch-release
- dev-payplug-addresses
- dev-release-3.4.1
- dev-release-3.5.0
- dev-release-3.5.1
- dev-release-3.5.3
- dev-release-3.5.4
- dev-release-3.5.5
- dev-release-3.5.6
- dev-release-3.6.0
- dev-set-apiRoutes-fromPlugins
- dev-test-tag
- dev-typo-fix
- dev-update-cacert
- dev-update-cacert-1
- dev-update-cacert-2023
- dev-update-cacert-2024
- dev-update-lib-version
- dev-update-php-lib
- dev-update-readme
- dev-wip-bancontact
This package is auto-updated.
Last update: 2024-09-20 11:50:56 UTC
README
Payplug API的PHP库
这是Payplug PHP库的文档。它旨在帮助开发人员以简单、稳健的方式将Payplug用作支付解决方案。
您可以在https://www.payplug.com/创建Payplug账户。
维护
CA证书(cacert.pem)应每年在12月的第一周更新。请访问https://curl.se/docs/caextract.html获取最新的证书。
先决条件
Payplug的库依赖于cURL
执行HTTP请求,并需要OpenSSL (1.0.1或更新版本)
来确保交易的安全。您还需要PHP 5.3
或更新版本用于Payplug PHP V2。
对于PHP 5.2
或更早版本,您必须参考Payplug PHP V1。
文档
请参阅https://docs.payplug.com/api获取最新的文档。
安装
选项1 - 强烈推荐) 通过composer
- 从composer网站获取composer。
- 确保您已初始化您的composer.json。
- 在您的项目目录中运行composer require payplug/payplug-php。
选项2- 克隆仓库
git clone https://github.com/payplug/payplug-php.git
选项3) 下载tar包
要开始,请将以下内容添加到您的PHP脚本中(如果您没有运行框架)
<?php require_once("PATH_TO_PAYPLUG/payplug_php/lib/init.php");
项目Git工作流程
此仓库遵循特定的Git工作流程以确保协作顺利和版本控制。请按照以下步骤参与此项目。
Git工作流程步骤
创建功能或修复分支
在做出任何更改之前,从develop分支创建一个新的分支
git checkout develop git pull origin develop git checkout -b <feature-name>
对于修复错误,使用
git checkout develop git pull origin develop git checkout -b <fix-name>
工作于您的功能或修复
进行代码更改并将它们提交到您的功能或修复分支。
创建合并请求
一旦您的功能或修复准备就绪,从您的分支创建到develop分支的合并请求。请您的同伴对您的更改进行审查。
发布准备
在发布时间,从develop分支创建一个名为release-
的中间分支 git checkout develop git pull origin develop git checkout -b release-<version-number>
完成发布
在release-
分支上彻底测试代码。修复出现的任何错误或问题。 合并到master
一旦发布经过测试且稳定,从release-
分支创建到master分支的合并请求。这表示发布成功。 标记发布
合并到master后,创建一个新的标签来标记发布版本
git checkout master git pull origin master git tag -a v<version-number> -m "Release <version-number>" git push origin master --tags
用法
创建付款请求就这么简单
<?php require_once("PATH_TO_PAYPLUG/payplug_php/lib/init.php"); // If not using a framework // Loads your account's parameters that you've previously downloaded and saved Payplug\Payplug::init(array( 'secretKey' => 'sk_live_YOUR_PRIVATE_KEY', 'apiVersion' => 'THE_API_VERSION_YOU_WANT', )); // Create a payment request of €9.99. The payment confirmation (IPN) will be sent to "'https://example.net/notifications?id='.$customer_id". // Note that all amounts must be expressed in centimes as positive whole numbers (€9.99 = 999 centimes). // Metadata allow you to include additional information when processing payments or refunds. $customer_id = '42710'; $payment = Payplug\Payment::create(array( 'amount' => 999, 'currency' => 'EUR', 'billing' => array( 'title' => 'mr', 'first_name' => 'John', 'last_name' => 'Watson', 'email' => 'john.watson@example.net', 'address1' => '221B Baker Street', 'postcode' => 'NW16XE', 'city' => 'London', 'country' => 'GB', 'language' => 'en' ), 'shipping' => array( 'title' => 'mr', 'first_name' => 'John', 'last_name' => 'Watson', 'email' => 'john.watson@example.net', 'address1' => '221B Baker Street', 'postcode' => 'NW16XE', 'city' => 'London', 'country' => 'GB', 'language' => 'en', 'delivery_type' => 'BILLING' ), 'hosted_payment' => array( 'return_url' => 'https://example.net/return?id='.$customer_id, 'cancel_url' => 'https://example.net/cancel?id='.$customer_id ), 'notification_url' => 'https://example.net/notifications?id='.$customer_id, 'metadata' => array( 'customer_id' => $customer_id ) )); // You will be able to find how the payment object is built in the documentation. // For instance, if you want to get a URL to the payment page, you can do: $paymentUrl = $payment->hosted_payment->payment_url; // Then, you can redirect the user to the payment page header("Location: $paymentUrl");
更进一步
测试
查看tests/README.rst。
项目负责人
本项目由以下人员维护:
- [[Imène Lajili](https://github.com/ilajili)](
- [[Manuel Mesquita](https://github.com/PPmmesquita)](
关于工作流程的任何问题或担忧,请随时联系项目负责人。