vanssata/vanssata-pag-online-sdk

PagOnlineSDK PHP SDK,适用于开发者

v0.0.2 2022-03-29 14:46 UTC

This package is auto-updated.

Last update: 2024-08-29 06:01:51 UTC


README

此 SDK 与 mattiabasone/PagOnline 相同,但去除了所有 Laravel 依赖

此库可用于 PagOnline 支付网关,并且可以轻松集成到 Laravel 中。

使用此包,我试图改进 PagOnline 支付网关提供的糟糕的 IGFS CG PHP 库。

基本用法

示例脚本位于 tests/demo 中,例如初始化请求

<?php 

require __DIR__.'/vendor/autoload.php';

$init = new \VanssataPagOnlineSDK\Init\IgfsCgInit();
$init->serverURL = "https://payment-gateway-example.com/IGFS_CG_SERVICES/services";
$init->tid = "MY-TID-CODE";
$init->kSig = '1234567890987654321';
$init->shopID = 'my-transaction-id';
$init->shopUserRef = "email@example.org";
$init->trType = "AUTH";
$init->currencyCode = "EUR";
$init->amount = 500; // Amount without comma (500 = 5,00)
$init->langID = "IT";
$init->notifyURL = "http://my-domain.tld/verify.php";
$init->errorURL = "http://my-domain.tld/error.php";
$init->addInfo1 = 'myFirstAddintionalInfo';

// if you need to edit http client parameters...
$init->setRequestTimeout(10); // Seconds
$init->setConnectTimeout(5); // Seconds
$init->setHttpProxy('tcp://some.proxy'); // Proxy server for requests
$init->setHttpAuthUser('username'); // HTTP Basic Auth username
$init->setHttpAuthPass('password'); // HTTP Basic Auth password

if (!$init->execute()) {
    // Something went wrong
} else {
    // Redirect user to payment gateway
    header("location: ".$init->redirectURL);
}

`.env` 文件配置

在您的 .env 文件中设置以下环境变量

  • PAGONLINE_SERVER_URL 支付网关服务器 URL (默认:null)
  • PAGONLINE_REQUEST_TIMEOUT 完成请求的最大超时时间(秒)(默认:15)
  • PAGONLINE_CONNECT_TIMEOUT 连接到服务器的最大超时时间(秒)(默认:5)
  • PAGONLINE_TERMINAL_ID 支付网关提供的标识符(默认:null)
  • PAGONLINE_SIGNATURE_KEY 支付网关提供的签名密钥(默认:null)
  • PAGONLINE_CURRENCY_CODE 货币代码(默认:EUR)
  • PAGONLINE_LANGUAGE_ID 语言代码(默认:IT)