我试图弄清楚如何包含PostFinance(瑞士银行)支付处理器,但不幸的是,这是一个非常不清楚的文档,我无法弄清楚如何处理它。 我找到了一个回购https://github.com/wysow/wysow-postfinance 所以,如果那里有一些php专家,如果你能给我一个示例代码,可以在我的clean index.php文件中包含这个库,我将不胜感激。
我已经安装了composer并包含了库,但无法进行测试付款。
我尝试的最后一个代码是README文件中的示例:
<?php
require 'vendor/autoload.php';
use PostFinance\Passphrase;
use PostFinance\Ecommerce\EcommercePaymentRequest;
use PostFinance\ShaComposer\AllParametersShaComposer;
use PostFinance\FormGenerator\SimpleFormGenerator;
$passphrase = new Passphrase('MySecretSig123');
$shaComposer = new AllParametersShaComposer($passphrase);
//$shaComposer->addParameterFilter(new ShaInParameterFilter); //optional
$ecommercePaymentRequest = new EcommercePaymentRequest($shaComposer);
// Optionally set PostFinance uri, defaults to TEST account
//$ecommercePaymentRequest->setPostFinanceUri(EcommercePaymentRequest::PRODUCTION);
// Set various params:
$ecommercePaymentRequest->setPspid('mypspid');
$ecommercePaymentRequest->setOrderid('123456');
$ecommercePaymentRequest->setAmount(1500); // in cents
$ecommercePaymentRequest->setCurrency('EUR');
// ...
$ecommercePaymentRequest->validate();
$formGenerator = new SimpleFormGenerator;
$html = $formGenerator->render($ecommercePaymentRequest);
echo $html;
// Or use your own generator. Or pass $ecommercePaymentRequest to a view
?>
我该如何解决?