fixsoftware / webpay-ws-php
GP Webpay WS API
dev-master
2021-09-24 03:46 UTC
This package is auto-updated.
Last update: 2024-09-24 10:23:11 UTC
README
PHP SDK 用于 GP Webpay WebService 付款。
对于 HTTPS API,请使用 GP Webpay PHP SDK。
在实施之前,请首先阅读供应商的文档!
!! 此 SDK 尚未功能完整。它仅针对周期性付款进行了测试,但它非常易于扩展。如果您以任何方式扩展了它,请随时创建 pull-request。
安装
composer require fixsoftware/webpay-ws-php dev-master
设置
$webpayWSConfig = new FixSoftware\WebpayWS\Config([ 'merchantNumber' => $merchantNumber, // Merchant number 'provider' => $provider, // Your paygate provider number from documentation 'serviceUrl' => $webpayUrl, // URL of webpay WS service 'wsdlPath' => $wsdlPath, // WSDL file path (absolute) 'signerPrivateKeyPath' => $signerPrivateKeyPath, // Path to the private key (absolute) 'signerPrivateKeyPassword' => $signerPrivateKeyPassword, // Password for private key 'signerGpPublicKeyPath' => $signerGpPublicKeyPath, // Path to the public key (absolute) 'signerLogPath' => $signerLogPath // Path to log file for logging requests and responses signed/verified by Signer ]);
如何发起调用
$webpayWS = new FixSoftware\WebpayWS\Api($webpayWSConfig); // process master payment status try { // call WS for master payment status $response = $this->webpayWS->call( $webserviceMethod, // WS action name (see WS docs) [ // request params (see WS docs) ] ); $response_params = $response->getParams(); // gets response parameters // in case of WS error (WS error response) if($response->hasError()) { $error = $response->getError(); // do something } // in case of exception (SDK exception) } catch(FixSoftware\WebpayWS\ApiException $e) { $exception = $e->getMessage(); // do something }
响应状态常量
FixSoftware\WebpayWS\Response::STATUS_MASTER_RECURRING_CREATED
FixSoftware\WebpayWS\Response::STATUS_MASTER_RECURRING_PENDING_SETTLEMENT
FixSoftware\WebpayWS\Response::STATUS_MASTER_RECURRING_CANCELED_BY_MERCHANT
FixSoftware\WebpayWS\Response::STATUS_MASTER_RECURRING_CANCELED_BY_ISSUER
FixSoftware\WebpayWS\Response::STATUS_MASTER_RECURRING_CANCELED_BY_CARDHOLDER
FixSoftware\WebpayWS\Response::STATUS_MASTER_RECURRING_EXPIRED_CARD
FixSoftware\WebpayWS\Response::STATUS_MASTER_RECURRING_EXPIRED_NO_PAYMENT
FixSoftware\WebpayWS\Response::STATUS_MASTER_RECURRING_VALID