satispay/online-api-php-sdk

此包已弃用且不再维护。作者建议使用satispay/gbusiness-api-php-sdk包。

Satispay GBusiness API PHP SDK

1.3.0 2020-12-17 10:24 UTC

This package is auto-updated.

Last update: 2024-06-11 10:42:57 UTC


README

Packagist Version Packagist Downloads

安装

运行以下命令

composer require satispay/gbusiness-api-php-sdk

如果您不想使用Composer,请导入init.php文件。

require_once("/path/init.php");

文档

https://developers.satispay.com

使用RSA签名进行身份验证

business.satispay.com仪表板中登录,点击“Negozi Online”或“Negozi Fisici”,然后点击“Genera un token di attivazione”以生成激活令牌。

使用authenticateWithToken函数与激活令牌一起生成并交换RSA密钥对。

将密钥保存在您的数据库中或在网站无法访问的安全地方

// Authenticate and generate the keys
$authentication = \SatispayGBusiness\Api::authenticateWithToken("XXXXXX");

// Export keys
$publicKey = $authentication->publicKey;
$privateKey = $authentication->privateKey;
$keyId = $authentication->keyId;

身份验证后重用密钥。

// Keys variables
$publicKey = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhk...";
$privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBg...";
$keyId = "ldg9sbq283og7ua1abpj989kbbm2g60us6f18c1sciq...";

// Set keys
\SatispayGBusiness\Api::setPublicKey($publicKey);
\SatispayGBusiness\Api::setPrivateKey($privateKey);
\SatispayGBusiness\Api::setKeyId($keyId);

启用沙盒

要启用沙盒,请使用setSandbox函数。

\SatispayGBusiness\Api::setSandbox(true);

变更日志

1.3.0

  • 添加了\SatispayGBusiness\Api::getPlatformHeader()方法。

  • 添加了\SatispayGBusiness\Api::setPlatformHeader()方法。

  • 添加了\SatispayGBusiness\Api::getTrackingHeader()方法。

  • 添加了\SatispayGBusiness\Api::setTrackingHeader()方法。

  • x-satispay-os请求头添加了\SatispayGBusiness\Request::HEADER_OS常量。

  • x-satispay-osv请求头添加了\SatispayGBusiness\Request::HEADER_OS_VERSION常量。

  • x-satispay-appv请求头添加了\SatispayGBusiness\Request::HEADER_APP_VERSION常量。

  • x-satispay-appn请求头添加了\SatispayGBusiness\Request::HEADER_APP_NAME常量。

  • x-satispay-devicetype请求头添加了\SatispayGBusiness\Request::HEADER_DEVICE_TYPE常量。

  • x-satispay-tracking-code请求头添加了\SatispayGBusiness\Request::HEADER_TRACKING_CODE常量。

  • \SatispayGBusiness\Request中将头键从X-Satispay-Platformv更改为x-satispay-osv

  • \SatispayGBusiness\Request中将头键从X-Satispay-Plugin-Version更改为x-satispay-appv

  • \SatispayGBusiness\Request中将头键从X-Satispay-Plugin-Name更改为x-satispay-appn

  • \SatispayGBusiness\Request中将头键从X-Satispay-Type更改为x-satispay-devicetype

1.2.1

  • 添加了\SatispayGBusiness\ApiAuthentication类。
  • 对代码进行了重构,以符合PSR2编码标准。

1.2.0

  • 添加了\SatispayGBusiness\PreAuthorizedPaymentToken类。

1.1.1

  • 修复了composer文件版本。

1.1.0

  • 移除了\SatispayGBusiness\Api::testAuthentication()方法。

  • 移除了\SatispayGBusiness\Api::getSecurityBearer()方法。

  • 移除了\SatispayGBusiness\Api::setSecurityBearer()方法。

  • 添加了\SatispayGBusiness\Api::getPlatformVersionHeader()方法。

  • 添加了\SatispayGBusiness\Api::setPlatformVersionHeader()方法。

  • 添加了\SatispayGBusiness\Api::getPluginVersionHeader()方法。

  • 添加了\SatispayGBusiness\Api::setPluginVersionHeader()方法。

  • 添加了\SatispayGBusiness\Api::getPluginNameHeader()方法。

  • 添加了\SatispayGBusiness\Api::setPluginNameHeader()方法。

  • 添加了\SatispayGBusiness\Api::getTypeHeader()方法。

  • 添加了\SatispayGBusiness\Api::setTypeHeader()方法。