Пример #1
0
var_dump($output);
/**
 * Below here is a token payment
 *
 * This makes the same payment as above, but shows how it can be made with Tokens
 */
// Lets try and make a payment with a token
$sagepay2 = new dwmsw\sagepay\Direct();
$sagepay2->setBasket($basket);
// Set up the config
$sagepay2->setConnectionMode('test');
$sagepay2->setVendorName('testdigitalweb');
$sagepay2->setCurrency('GBP');
$sagepay2->setApplyAvsCv2(1);
$sagepay2->setApply3dSecure(0);
$sagepay2->setGiftAid(0);
$sagepay2->setCreateToken(0);
$vendorTxCode = 'TOK' . md5(rand(1, 1000) . date('U'));
// TX Specific bits
$sagepay2->setVendorTxCode($vendorTxCode);
$sagepay2->setDescription('Test Payment');
$sagepay2->setCustomerEmail('*****@*****.**');
// Set Addresses into the class
$sagepay2->setBillingAddress($BillingAddress);
$sagepay2->setDeliveryAddress($BillingAddress);
// New card instance
$card2 = new dwmsw\sagepay\Card();
$card2->setToken($output['Token']);
$card2->setCV2('123');
$sagepay2->setCard($card2);
$output = $sagepay2->register('PAYMENT');