1. Go to this page and download the library: Download itinerisltd/gf-sagepay 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/ */
itinerisltd / gf-sagepay example snippets
$entryId = 123;
$rawEntry = GFAPI::get_entry($entryId);
if (is_wp_error($rawEntry)) {
wp_die('Entry not found');
}
$url = \Itineris\SagePay\ConfirmationHandler::buildUrlFor(
new \Itineris\SagePay\Entry($rawEntry),
86400 // expires in 24 hours (24*3600=86400)
);
echo $url;
// https://example.com/the-form-page/?entry=123&gf-sagepay-token=XXXXXXXXXXXX (the entry's source page)
add_filter('gf_sagepay_redirect_url_failure_wp_die', function(bool $shouldWpDie, \Omnipay\SagePay\Message\ServerAuthorizeResponse $response, \Itineris\SagePay\Entry $entry, \GFPaymentAddOn $addOn): bool {
// Do something.
return true; // Do `wp_die`
return false; // Don't `wp_die`, continue normal flow
return $shouldWpDie; // Keep the default
}, 10, 4);