承接 offline/postfinance 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

offline/postfinance

最新稳定版本:v1.0.1

Composer 安装命令:

composer require offline/postfinance

包简介

Helper class to work with the PostFinance e-payment system

README 文档

README

This class helps to implement basic e-commerce features from PostFinance Switzerland. The implementation follows the official documentation.

Install it

composer require 'offline/postfinance'

Use it

See index.php for an example.

Define your parameters as an array. Get your SHA-IN signature at hand. Initialize a class instance and pass your parameter array to setParamList.

$shaInSignature = 'Configuration -> Technical information -> Data and origni verification -> SHA-IN pass phrase';
$params = [
    'PSPID'        => 'your-postfinance-username',
    'ORDERID'      => '1234',
    'AMOUNT'       => '200' * 100,
    'CURRENCY'     => 'CHF',
    'LANGUAGE'     => 'de_CH',
];

$postfinance = new Offline\PaymentGateways\PostFinance($shaInSignature);
$postfinance->setParamList($params);

In your view file call getFormFields wherever you want to output the hidden input fields.

<form action="https://e-payment.postfinance.ch/ncol/test/orderstandard.asp" method="post">
    
    <?= $postfinance->getFormFields(); ?>
    
    <input type="submit" value="Submit Example">
</form>

Using different algorithms

To use SHA256 or SHA512 algorithms, simply pass the php MHASH constant as second parameter:

$postfinance256 = new Offline\PaymentGateways\PostFinance($shaInSignature, 'sha256');
$postfinance512 = new Offline\PaymentGateways\PostFinance($shaInSignature, 'sha512');

Validating SHA-OUT signatures

Make sure you have the option I would like to receive transaction feedback parameters on the redirection URLs. under Transaktion feedback enabled.

$shaOutSignature = 'Configuration -> Transaction feedback -> SHA-OUT pass phrase';
$shaSign = isset($_GET['SHASIGN']) ? $_GET['SHASIGN'] : '';

$postfinance = new PostFinance($shaOutSignature);
$postfinance->setParamList($_GET);

$isValid = $postfinance->getDigest() === $shaSign;

var_dump($isValid);

统计信息

  • 总下载量: 85
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 4
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-06