0

I am using a payment package which returns an instance of RedirecResponse class, then the user is redirected to the payment page.

I need to use this in a mobile application. I don't know how to tell the application to open that paying page. I can't return the instance of RedirecResponse to the application, therefore I have to get the url of the payment page from the instance of RedirecResponse and then return it to the application, then application must open the browser.

The TargetUrl property contains the url but Laravel returns the following error while accessing this:

Cannot access protected property Illuminate\Http\RedirectResponse::$targetUrl

How can I get the url from RedirectResponse?

Thanks

2
  • 1
    did you try $redirectResponse->getTargetUrl()? Commented Jan 9, 2020 at 11:43
  • @NoOorZ24 It worked thanks alot. post as an answer to accept it Commented Jan 9, 2020 at 11:50

2 Answers 2

6

As confirmed:

$redirectResponse->getTargetUrl()

does the trick

Sign up to request clarification or add additional context in comments.

Comments

4

You can add $redirectResponse->getTargetUrl() something like this to get redirect response.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.