Laravel Controller eka use karala wena site ehekata POST method eken Data Post



  • Mage requirement eka, 
    

    Laravel Controller eka use karala wena site ehekata POST method eken Data Post karanna

    <form action="anotherweb.com" method="post">
    <input type="hhh" value="ccc">
    .....
    <button type="submit"></button>
    </form
    

    Uda code eke tiyenne view eken another site ehekata data post karanna form eken, But mata one view eken nathuwa controller eka use karala uda code eke tiyena ekama karanna

    Ai mata ehema karanna one
    

    Payhere Integration ekata, Js ekak dala payhere submit karanna puluwan but eka security less, Js code eka run wenna yana time eke page eke code eka view karala url blind karala less payment ekak karanna puluwan

    $client = new GuzzleHttp\Client();
    
    $response = $client->request('POST', 'http://httpbin.org/post', [ 
        'form_params' => [ 
            'field_name' => 'abc', 
            'other_field' => '123', 
            'nested_field' => [ 
                'nested' => 'hello'
            ] 
        ] 
    ]);
    

    Mama guzzle try kara but, meka wor karanne na methanadi wenne post method eka ape site eka request karana eka, Site ekata request karata wadak naha payhere support naha

    Controller eka athule idan payhere or wena onema site ekakata data form ekak post karanne kohomada?
    


  • Re: Laravel Controller eka use karala wena site ehekata POST method eken Data Post

            echo '<form method="post" id="myForm" action="https://sandbox.payhere.lk/pay/checkout">';
            echo '<input type="hidden" name="merchant_id" value="'.$merchant_id.'">';
            echo '<input type="hidden" name="return_url" value="'.url('dashboard/premium_subcribed').'">';
            echo '<input type="hidden" name="cancel_url" value="'.url('premium_cancel').'">';
            echo '<input type="hidden" name="notify_url" value="'.url('notify').'">';
            echo ' <script type="text/javascript"> document.getElementById("myForm").submit(); </script> ';
    

    Methana echo karanne nathuwa js run karanna puluwan nam eth okay 😞


  • Web Development

    controller eke curl request ekak gahan puluwan oyta payhere url ekata



  • oyata javascript eken tamai payment gateway ekata redirect karanna wenne, payment amount eka verify kara gnna payhere eke notify url eken puluwan, eken payment ekak unama notify url ekata post request ekak enwa order details ekka (orderid, amount, txid) ethanin order amount eka verify karala db eke update kara gnna payment status eka



  • @cody curl try kara but hariyata work karanna widiyta curl hadagann ba.. Mata request karanna newi one Post karanna, Payhere ekata request karata wadak naha, eyala eyalage site eka athule idan witarai payment pass karanne a nisa POST karanna one controller eka athule idan



  • @dev_lak Notify url request eka awata passe payment verify karala db submit karanna puluwn,
    Eth notify url eka work karanne nathi awulk tiyenawa laravel 7.* waladi, Laravel 5.6 ekka hadapu project eke awulk na notify url eka working, A widiytm controller ekai model ekai set karala db update ekak dunnata laravel 7 waladi notify url eka ganne na..

    Lokuma issue eka danata submit karanne JS ehekin.. JS nathuwa wena method ekak nadda hoda security ekka 😞



  • @rithu20 server side language ekakin thawa site ekakata data post krla ekata redirect krnn bha user wa, laravel 7 eke notify url eke aulk atte poddk check krnna middleware ekakin block wenwada kyla request eka