David
David

Reputation: 139

Reply to the Notification Post in sagepay (PHP)

I am creating a inframe payment gateway for Sagepay. I have the first bit working fine, using wp_remote_post to send my request and getting back an ok with the next url and putting that in an iframe. My problem comes on handling the response. I always get it moving out of the iframe and onto the test.sage.com to process the payment and then a 5006 error code which is the 'Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL.'. I understand that I need to give a similar response to how sagepay tells me it's cool with my response, something like:

Status=ok
RedirectURL=http://

But I am really confused how I convey this. I tried simply:

echo '
        Status=ok ' . PHP_EOL . '
        RedirectURL=https://url/sagepay/callbacks
    ';

but get the same error. The integration kits seem to give examples for everything minus the inframe method. But just really confused how I handle this.

Upvotes: 2

Views: 763

Answers (1)

DannyTheDev
DannyTheDev

Reputation: 4173

Make sure you provide a plain text header..

header("Content-type: text/plain");

and provide your response like this:

echo 'Status=OK' . chr(13) . chr(10) . 'RedirectURL=https://url/sagepay/callbacks' . chr(13) . chr(10);

This is how I send my response to SagePay.. it is important to not have any whitespace before and after your response..

Upvotes: 3

Related Questions