Support the ongoing development of Laravel.io →
Laravel Packages

Hi guys, Am Getting the following exception when trying to do a purchase call using Paypal: Omnipay\Common\Exception\RuntimeException: Error: This response does not support redirection. and the following is the code in common/src/Omnipay/Common/Message/AbstractResponse.php

_<?php namespace Omnipay\Common\Message; use Omnipay\Common\Exception\RuntimeException; use Symfony\Component\HttpFoundation\RedirectResponse as HttpRedirectResponse; use Symfony\Component\HttpFoundation\Response as HttpResponse; /**

  • Abstract Response / abstract class AbstractResponse implements ResponseInterface { protected $request; protected $data; public function __construct(RequestInterface $request, $data) { $this->request = $request; $this->data = $data; } public function getRequest() { return $this->request; } public function isRedirect() { return false; } public function getData() { return $this->data; } public function getMessage() { return null; } public function getCode() { return null; } public function getTransactionReference() { return null; } /*
    • Automatically perform any required redirect
    • This method is meant to be a helper for simple scenarios. If you want to customize the
    • redirection page, just call the getRedirectUrl() and getRedirectData() methods directly. */ public function redirect() { $this->getRedirectResponse()->send(); exit; } public function getRedirectResponse() { if (!$this instanceof RedirectResponseInterface || !$this->isRedirect()) { throw new RuntimeException('This response does not support redirection.'); } if ('GET' === $this->getRedirectMethod()) { return HttpRedirectResponse::create($this->getRedirectUrl()); } elseif ('POST' === $this->getRedirectMethod()) { $hiddenFields = ''; foreach ($this->getRedirectData() as $key => $value) { $hiddenFields .= sprintf( '<input type="hidden" name="%1$s" value="%2$s" />', htmlspecialchars($key, ENT_QUOTES, 'UTF-8'), htmlspecialchars($value, ENT_QUOTES, 'UTF-8') )."\n"; } $output = '<!DOCTYPE html>
<html> <head> <title>Redirecting...</title> </head> <body onload="document.forms[0].submit();"> <form action="%1$s" method="post"> <p>Redirecting to payment page...</p> <p> %2$s <input type="submit" value="Continue" /> </p> </form> </body> </html>'; $output = sprintf($output, htmlspecialchars($this->getRedirectUrl(), ENT_QUOTES, 'UTF-8'), $hiddenFields); return HttpResponse::create($output); } throw new RuntimeException('Invalid redirect method "'.$this->getRedirectMethod().'".'); } }

Kindly assist on what am supposed to do to correct the above error message. Thanks

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jacklyne jacklyne jackym Joined 12 Jul 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.