adamb / sagepayform-php

一个简单的PHP类,用于将sagepayForm v3.00集成到您的网站中。

v1.0.5 2023-11-28 13:34 UTC

This package is auto-updated.

Last update: 2024-09-28 15:44:35 UTC


README

一个简单的类,用于将sagepayForm v3.00集成到您的网站中。由于目前还没有sage php集成套件,可能对某些人有用。

要开始,请更改受保护的字段$encryptPassword,并查看index.php中的示例表单,success.php中的示例响应解析。

#集成很简单

<?php
require_once('lib/SagePay.php');

$sagePay = new SagePay();
$sagePay->setCurrency('EUR');
$sagePay->setAmount('100');
$sagePay->setDescription('Lorem ipsum');
$sagePay->setBillingSurname('Mustermann');
$sagePay->setBillingFirstnames('Max');
$sagePay->setBillingCity('Cologne');
$sagePay->setBillingPostCode('50650');
$sagePay->setBillingAddress1('Bahnhofstr. 1');
$sagePay->setBillingCountry('de');
$sagePay->setDeliverySameAsBilling();
$sagePay->setSuccessURL('https://www.yoururl.com/success.php');
$sagePay->setFailureURL('https://www.yoururl.org/fail.php');
?>

<form method="POST" id="SagePayForm" action="*https://live.opayo.eu.elavon.com/gateway/service/vspform-register.vsp*">
	<input type="hidden" name="VPSProtocol" value= "3.00">
	<input type="hidden" name="TxType" value= "PAYMENT">
	<input type="hidden" name="Vendor" value= "*YOURVERNODID*">
	<input type="hidden" name="Crypt" value= "<?php echo $sagePay->getCrypt(); ?>">
	<input type="submit" value="continue to SagePay">
</form>

或者使用链式调用

$sagePay = new SagePay();
$sagePay
  ->setCurrenty('EUR')
  ->setAmount('100')
  ->setDescription('Lorem ipsum')
  ....

更多示例请参阅index.php