$card->setCardType('VISA'); $card->setCardNumber('4929000000006'); $card->setStartDate(false); $card->setExpiryDate('1216'); $card->setCV2('123'); $sagepay->setCard($card); $output = $sagepay->register('PAYMENT'); print '<h2>PAYMENT</h2>'; 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
<?php ini_set('xdebug.var_display_max_children', -1); ini_set('xdebug.var_display_max_data', -1); include '../../vendor/autoload.php'; // Create instance of Direct $sagepay = new dwmsw\sagepay\Direct(); $sagepay->setConnectionMode('test'); $output = $sagepay->threeDResponse($_POST['MD'], $_POST['PaRes']); print '<h1>RESPONSE</h1>'; var_dump($output);
<?php include '../../vendor/autoload.php'; // New Basket instance $basket = new dwmsw\sagepay\Basket(); // Add an item to the basket $basket->addItem(new dwmsw\sagepay\Item('Test Item', 30.0, 6, 1)); // Add another item to the basket $basket->addItem(new dwmsw\sagepay\Item('Test Item Two', 30.0, 6, 2)); // Create instance of Direct $sagepay = new dwmsw\sagepay\Direct(); // Set the Basket $sagepay->setBasket($basket); // Set up the config $sagepay->setVendorName('YOUR VENDOR NAME'); $sagepay->setConnectionMode('test'); $sagepay->setCurrency('GBP'); $sagepay->setApplyAvsCv2(1); $sagepay->setApply3dSecure(0); $sagepay->setGiftAid(0); $vendorTxCode = md5(rand(1, 1000) . date('U')); // TX Specific bits $sagepay->setVendorTxCode($vendorTxCode); $sagepay->setDescription('Test Payment'); $sagepay->setCustomerEmail('*****@*****.**'); $sagepay->setCreateToken(1); // Set up addresses $BillingAddress = new dwmsw\sagepay\Address(); $BillingAddress->setName('Test', 'Person'); $BillingAddress->setPhone('01589658741'); $BillingAddress->setAddress('88', 'Street 2', 'City', 'GB', '412');