Laravel payhere integration
-
@alwismt me hadala thiyena widiyata notify funtion ekak hadala thiyenne. live server ekedi calle wenne ne me funtion eka.. eka thamai awla.. notify calle wenne nethi hethuwak thiyenawada?
-
@SI Server eke access logs blpn machn notify URL ekata request awilla tynwda kyla
-
Notify controller eka me wage set wenna one, return url eka enawa kiyanne notify url eka aniwa ubata enawa but eka blind ena nisa ube errors pennane na, eka parin work kale nattam reload karaddi aye data ennet na
public function payhere_notify(Request $request){ $merchant_id = $request->input('merchant_id'); $order_id = $request->input('order_id'); $payhere_amount = $request->input('payhere_amount'); $payhere_currency = $request->input('payhere_currency'); $status_code = $request->input('status_code'); $method = $request->input('method'); $status_message = $request->input('status_message'); $card_holder_name = $request->input('card_holder_name'); $card_no = $request->input('card_no'); $card_expiry = $request->input('card_expiry'); $md5sig = $request->input('md5sig'); $merchant_secret = 'XXXXXXX'; $local_md5sig = strtoupper (md5 ( $merchant_id . $order_id . $payhere_amount . $payhere_currency . $status_code . strtoupper(md5($merchant_secret)) ) ); if (($local_md5sig === $md5sig) AND ($status_code == 2) ){ $statu = $status_code; $payment_up = Payhere::payment_st_update($order_id, $statu, $method, $status_message, $card_holder_name, $card_no, $card_expiry); $pay_st = Payhere::pay_st_update($order_id, $statu); } elseif (($local_md5sig === $md5sig) AND ($status_code == 0) ){ $statu = $status_code; $payment_up = Payhere::payment_st_update($order_id, $statu, $method, $status_message, $card_holder_name, $card_no, $card_expiry); $pay_st = Payhere::pay_st_update($order_id, $statu); } elseif (($local_md5sig === $md5sig) AND ($status_code == -1) ){ $statu = $status_code; $payment_up = Payhere::payment_st_update($order_id, $statu, $method, $status_message, $card_holder_name, $card_no, $card_expiry); $pay_st = Payhere::pay_st_update($order_id, $statu); } elseif (($local_md5sig === $md5sig) AND ($status_code == -2) ){ $statu = $status_code; $payment_up = Payhere::payment_st_update($order_id, $statu, $method, $status_message, $card_holder_name, $card_no, $card_expiry); $pay_st = Payhere::pay_st_update($order_id, $statu); } elseif (($local_md5sig === $md5sig) AND ($status_code == -3) ){ $statu = $status_code; $payment_up = Payhere::payment_st_update($order_id, $statu, $method, $status_message, $card_holder_name, $card_no, $card_expiry); $pay_st = Payhere::pay_st_update($order_id, $statu); } else { $statu = $status_code; $payment_up = Payhere::payment_st_update($order_id, $statu, $method, $status_message, $card_holder_name, $card_no, $card_expiry); $pay_st = Payhere::pay_st_update($order_id, $statu); } }```
-
-
database eke columns tika hariytama tiyenna one, notify url eka workd kiyala balannapuluwan db eka update unhm
-
@alwismt OK mn balannam a tika..
-
REST_Controller ekak ekak athule idan payhere site ekata data pass karanne kohomada.. php project ekak curl use karanna puluwanda postman use karana puluwanda
-
mata therenne na ai oya me form vairables server side eken redirect karanne kiyala methana credit card wisthara monawath na . nikam amount ekak witharai thiyenne payhere egollonge server (SITE) ekedi thama credit card info type karanna kiyanne. oyata me form auto submit karanna puluwan oyage route ekak athule view eke hadala javascript walin
<form id="myForm" action="Page_C.php" method="post">
<?php
foreach ($_POST as $a => $b) {
echo '<input type="hidden" name="'.htmlentities($a).'" value="'.htmlentities($b).'">';
}
?>
</form>
<script type="text/javascript">
document.getElementById('myForm').submit();
</script>@root
me kiyanne checkout karaddi (<form method="post" action="https://sandbox.payhere.lk/pay/checkout"> form eka submit karaddi)
eke form entities wenama pahala thawa route ekakin java script walin submit karala e form data wenama database update karaganna kiyala neda.