solidgate / ws-client
SolidGate支付网关webhook的PHP客户端
v1.0.1
2021-01-22 09:11 UTC
Requires
- php: ^7.3
- ext-json: *
- ext-openssl: *
- amphp/websocket-client: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpstan/phpstan: ^0.12.58
- phpunit/phpunit: ^9.4
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-08-31 00:26:52 UTC
README
SolidGate Websocket客户端
此库提供了接收SolidGate支付网关webhook的客户端。
文档
https://dev.solidgate.com/developers/documentation
安装
使用Composer
$ composer require solidgate/ws-client
{
"require": {
"solidgate/ws-client": "~1.0"
}
}
使用方法
<?php
use SolidGate\WebsocketClient\PrintWebhookHandler;
use SolidGate\WebsocketClient\WebhookReceiver;
$receiver = new WebhookReceiver(new PrintWebhookHandler());
$event = ''; // see full list events on https://solidgate.atlassian.net/
$merchant = ''; // pass your merchantId
$privateKey = ''; // pass your privateKey
try {
$receiver->receive($event, $merchant, $privateKey);
} catch (\SolidGate\WebsocketClient\Exception\ConnectionException $connectionException) {
var_dump($connectionException->getBody()); // handle connection errors (authentication/validation/... error)
}
运行example.php进行测试使用
php -f example.php