thephpleague / omnipay-sagepay

Sage Pay driver for the Omnipay PHP payment processing library
MIT License
54 stars 78 forks source link

Multiple POST from SagePay-Notifier and error 5006 #155

Closed kevin-ryser closed 3 years ago

kevin-ryser commented 4 years ago

Hi,

I keep having the error 5006 (Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL.) while all the payments are actually working (my payment are confirmed and I get the following status message: 0000 : The Authorisation was Successful.)

My website is WordPress, I use (I tried returnUrl and/or both): 'notifyUrl' => site_url('/payment-confirm/')

The order complete page (simplified): `$gateway = OmniPay::create('SagePay\Server'); $gateway->setVendor('myvendor'); $gateway->setTestMode(true);

$requestMessage = $gateway->completePurchase([
    'transactionReference' => $transaction_ref,
]);

try {
    $responseMessage = $requestMessage->send();
} catch(\Exception $e) {
    $requestMessage = $gateway->completePurchase([]);
    $responseMessage = new ServerCompleteAuthorizeResponse($requestMessage, []);
    $responseMessage->invalid(site_url('/order-completed/?error=true'), $e->getMessage());
}

if ($responseMessage->isSuccessful()) {
    // some stuff
}

$responseMessage->confirm(site_url('/order-completed/?pr=' . $payment_id));`

I can see as well that the SagePay-Notifier is doing multiple POST requests:

Screenshot 2020-09-14 at 12 40 31

Thanks a lot!! Kevin

kevin-ryser commented 3 years ago

Edit: This is happening on the testing environment and 3D secure if OFF, should I turn it on?

kevin-ryser commented 3 years ago

Okay I found my error. Some HTML was printed in my "payment-confirm" page, my bad!

judgej commented 3 years ago

Errors in the confirm page is so hard to debug, because it is only SagePay that ever sees it. Glad you have a solution now.