1

In a custom payement gateway, where the store redirects to third party website for payment. To request i have options to send either in POST/GET. I'm requesting with POST method. But the response they give is in get method.

The response url according to their documentation is http://yoursite.com/success?q=su&oid=XYZ1234&amt=100&refId=000AE01

And in my case i have captured response at http://yoursite.com/cgateway/payment/response with responseAction method of PaymentController.php controller.

The result i obtained is http://yoursite.com/cgateway/payment/response?q=su&oid=XYZ1234&amt=100&refId=000AE01

Now the problem is how should i get those data in responseAction in PaymentController ?

asked Mar 14, 2016 at 10:49

2 Answers 2

3

To get params in a controller you can use:

$this->getRequest()->getParam('paramName');

or

$this->getRequest()->getParams();
answered Mar 14, 2016 at 10:52
2

Magento's default routing algorithm uses three part URLs.

http://example.com/front-name/controller-name/action-method

So when you call

http://example.com/path/action/id/123

The word path is your front name, action is your controller name, and id is your action method. After these three methods, you can use getParam to grab a key/value pair

http://yoursite.com/cgateway/payment/response?q=su&oid=XYZ1234&amt=100&refId=000AE01
//in a controller
var_dump($this->getRequest()->getParams('q'));

You may also use the getParams method to grab an array of parameters

$this->getRequest()->getParams();

Hope this helps

answered Mar 14, 2016 at 10:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.