PHP code example of dominicwatts / sagepay-sdk-php
1. Go to this page and download the library: Download dominicwatts/sagepay-sdk-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dominicwatts / sagepay-sdk-php example snippets
use Xigen\Library\Sagepay\Payment;
use Xigen\Library\Sagepay\Classes\SagepayCustomer;
use Xigen\Library\Sagepay\Classes\SagepayCustomerDetails;
$config = [
'vendorName' => 'testing'
];
$payment = new Payment(
Payment::FORM,
$config
);
$customer = new SagepayCustomer();
$customerDetails = new SagepayCustomerDetails();
$customerDetails->__set('firstname', 'Dave');
$customerDetails->setLastname('Smith');
$api = $payment->getApi();
$api->setCustomer($customer);
$api->setCustomerDetails($customerDetails);
var_dump($api);
$api->createRequest();