deedee2025 / placetoplay
PlaceToPay 集成的 PHP 包装器。
1.0.0
2016-09-26 21:29 UTC
Requires
- php: ^5.3.3 || ^7.0
This package is not auto-updated.
Last update: 2024-09-18 20:54:16 UTC
README
PlaceToPay API 集成的 PHP 包装器。
安装
- 确保将
composer.json
文件添加到项目根目录 - 运行安装 composer 命令
composer require deedee2025/placetoplay
- 根据您喜欢的项目加载 composer 自动加载文件。例如
include_once __DIR__ . '/vendor/autoload.php';
使用方法
认证
在开始使用包装器的各种方法之前,您需要通过 API 进行认证
PlaceToPay::authenticate( $yourLogin, $yourTransactionKey );
搜索
您可以通过以下方法在认证后获取交易信息
$transaction = PlaceToPay::getTransactionInformation($transactionID);
此外,如果您之前已经发送过任何请求,您可以使用以下方法获取所有最新请求的信息
$info = PlaceToPay::getStoredTransactionsInfo();
注意:最后一个方法使用 PHP 会话来获取最近创建的请求 ID。
请求
您可以使用以下方法向 PSE API 生成新的交易
$request = new PSETransactionRequest( $param ); $storeIds = true; $result = PlaceToPay::createTransaction( $request, $storeIds );
此外,您还可以调用 PlaceToPay::printRequestForm( '/' )
方法来打印一个自动表单以进行请求,并用 $_POST 替换 $params
参数以将表单值传递到请求中。