I am trying to get my signature for payu webcheckout implementation I think the error is in the signature field, I have the api key defined in the controller
<form method="post" action="https://sandbox.checkout.payulatam.com/ppp-web-gateway-payu/">
<input name="merchantId" type="text" value="508029">
<input name="accountId" type="text" value="512321">
<input name="description" type="text" value="{{ $plans->description }}">
<input name="referenceCode" type="text" value="{{ $plans->id }}">
<input name="amount" type="text" value="{{ $plans->price }}">
<input name="tax" type="text" value="0">
<input name="taxReturnBase" type="text" value="0">
<input name="currency" type="text" value="COP">
<input name="signature" type="text" value="md5($apy_key." ~ "."508029 "."~ ".$plans->id."~ ".$plans->price."~ "."COP ")">
<input name="test" type="text" value="1">
<input name="buyerEmail" type="text" value="test@test.com">
<input name="responseUrl" type="text" value="https://poligonourbano.soluttolabs.com/">
<input name="confirmationUrl" type="text" value="http:// www.test.com/confirmation">
<input name="Submit" type="submit" value="Enviar">
</form>
Controller function:
public function planView() {
$apy_key = "4Vj8eK4rloUd272L48hsrarnUA";
$plans = Plan::findOrFail(2);
return view('plans', compact('plans', 'apy_key'));
}
The problem is indeed coming from the way you are creating the signature
when you put md5($apy_key."~"."508029"."~".$plans->id."~".$plans->price."~"."COP")
in ""
it is considered as a string you should wrap the md5 with {{ }}
.
Please try to create the signature in the controller and pass it as a value to the view, it is not a best practice to handle any logic in the view.