title: Integrating PayUMoney in Laravel 5.6
body: <p>I am trying integrate PayUMoney in Laravel 5.6. As per the PayUMoney Redirect Checkout document, a form needs to be filled and submitted to "<a href="https://sandboxsecure.payu.in/_payment" rel="nofollow noreferrer">https://sandboxsecure.payu.in/_payment</a>" (using sandbox url for testing).
  Submitting the html form with necessary fields filled successfully redirects me to the payment gateway page and works fine. But I wanted to implement it in my Laravel controller. I did the following:</p>
  
  <p><strong>my routes are:</strong></p>
  
  <pre><code>    Route::get('book/placeOrder', ['uses' =&gt; 'BooksController@placeOrder', 'as' =&gt; 'placeOrder']);
  Route::get('payumoney/surl', ['uses' =&gt; 'BooksController@surl', 'as' =&gt; 'payumoneysurl']);
      Route::get('payumoney/furl', ['uses' =&gt; 'BooksController@furl', 'as' =&gt; 'payumoneyfurl']);
  </code></pre>
  
  <p><strong>placeOrder function in BooksController:</strong></p>
  
  <pre><code>public function sendCurlPostRequest(){
      //code to add order and order details go here
  
      $salt = "[my merchant salt]";
      $hash_string = '';
      $hash_string .= "[hash string as per the payumoney checkout document]";
      $hash_string .= $salt;
      $hash = strtolower(hash('sha512', $hash_string));
  
      $data1 = [
          'key' =&gt; "[merchant key]",
          'hash' =&gt; $hash,
          'txnid' =&gt; "or1234txn",
          'amount' =&gt; "10",
          'firstname' =&gt; "[sample customer name]",
          'email' =&gt; "[sample email]",
          'phone' =&gt; "[sample phone number]",
          'productinfo' =&gt; "book",
          'surl' =&gt;  "[route to success page]",
          'furl' =&gt; "[route to failure page]",
          'service_provider' =&gt; "payu_paisa",
      ];
  
      $curl = curl_init();
      curl_setopt_array($curl, array(
          CURLOPT_URL =&gt; "https://sandboxsecure.payu.in/_payment",
          CURLOPT_RETURNTRANSFER =&gt; false,
          CURLOPT_FOLLOWLOCATION =&gt; 1,
          CURLOPT_POST =&gt; true,
          CURLOPT_POSTFIELDS =&gt; $data1,
      ));
  
      $response = curl_exec($curl);
  
      $err = curl_error($curl);
  
      curl_close($curl);
  
      if ($err) {
          echo "cURL Error #:" . $err;
      } else {
          //print_r(json_decode($response));
          //print_r($response);
      }
  </code></pre>
  
  <p>}</p>
  
  <p>On clicking the checkout button in the cart page, I do get redirected to the PayUMoney page but the page does not load completely. Only the page's html title appears and the page loader appears. Since the page does not load, the loader is all that i can see.</p>
  
  <p>Can you please help me the correct way to implement the PayUMoney payment gateway (preferably without any third party plugin) in my Laravel controller method?</p>
  
  <p>Please point me to the necessary solution...</p>
  
  <p>Thanks</p>