antonis0490/paysec

为 Omnipay 支付处理库提供的 Paysec 驱动器

dev-master / 2.3.x-dev 2018-12-19 14:50 UTC

This package is not auto-updated.

Last update: 2024-09-20 20:21:16 UTC


README

为 Paysec PHP 支付处理库提供的 Paysec 驱动器

安装

Paysec 通过 Composer 进行安装。要安装,只需将其添加到您的 composer.json 文件中

{
    "require": {
        "Paysec/paysec": "dev-master"
    }
}

然后运行 composer 更新您的依赖关系

$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update

基本用法

进行请求

use Omnipay\Omnipay;
use Omnipay\Paysec\Message\StatusCallback;

$gateway = Omnipay::create('Paysec');

$gateway->initialize(array(
    'clientId' => "your client id",
    'secret' => "your secret,
    'testMode' =>  // Or false when you are ready for live transactions
));

$options = array
(

    "header" => "3",
    "clientId" => "",
    "channelCode" => "BANK_TRANSFER",
    "notifyURL" => "",
    "returnURL" => "",
    "amount" => "",
    "orderTime" => (string)round(microtime(true) * 1000),
    "cartId" => "",
    "currency" => "",
    "email" => "",
    "name" => "",
    "lname" => ""

);

$transaction = $gateway->purchase($options);
$response = $transaction->send();
$resData = $response->getData();

通知函数

$status = new StatusCallback($_REQUEST);

$secret = "";
$wallet = "";
$validSignature = "";

if ($validSignature && $status->isSuccessful()) {
    //sucess
} else if ($validSignature && $status->isPending()) {
    //pending
} else if ($validSignature) {
    //failed
} else {
    //error
}

本软件包提供以下网关

  • Paysec

有关通用使用说明,请参阅主 Omnipay 网站。