Search code examples
phpangularjsformscodeigniterpayu

Submit php form and redirect from backend


I want to integrate Payu Payment Gateway with my angularJS application. The server code is written in PHP (codeigniter).
I have been provided with a PHP kit from payu which consists of a single php file with form and php code. It posts the data to the payu url resulting in a successful transaction.

But I want the data to come from my angularJS form and after combining the merchant key and salt values to it from server side, the data should be posted to the payu url.
I tried using curl but the problem was that it does not redirect to the payu url.
Can anyone please explain how do I combine the data from my angularJS form and the secret keys(they will be using the data coming from angular form to generate secret keys) and post it to a url along with redirection.


Solution

  • You can send an ajax request to gather the key and then put it in the form and submit. This way the user will be redirected to the payu page.

    The post must come from the browser not from the server. cURL is strictly server side and it cannot influence the browser behavior.