I want to send user to payment gate. Normally it could be made by this form:
<form method="post" action="https://demo.moneta.ru/assistant.htm">
<input type="hidden" name="MNT_ID" value="12345678">
<input type="hidden" name="MNT_TRANSACTION_ID" value="000001">
<input type="hidden" name="MNT_CURRENCY_CODE" value="USD">
<input type="hidden" name="MNT_AMOUNT" value="123.45">
<input type="submit" value="Pay">
</form>
User press "Pay" and redirect to payment gate.
But I want implement this workflow:
The question is: how to redirect user to external resource from controller (method should be POST, and I need do send some data such as MNT_ID, etc. (see form example above)?
I think this is what you are looking for:
call your function controller:
public function redirectPOST(){
//params
$USERNAME='username';
return view('your vie', compact('USERNAME'));}
then in your view:
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<script type="text/javascript">
function closethisasap() {
document.forms["redirectpost"].submit();
}
</script>
</head>
<body onload="closethisasap();">
<form name="redirectpost" method="POST" action="http://URL">
<input type="hidden" id="USERNAME" name="USERNAME" value="{{$USERNAME}}">
</form>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With