Laravel payhere integration
-
Laravel walata payhere payment gateway checkout api eka integration karapu kenek innawada?
Mama mulinma checkout ekdi payhere checkout click karaham products data controller eken db eke payhere table ekata save karanawa, ita passe controller eken return redirect karanawa
//up more codes for db and etc $post = array( 'merchant_id' => '1213296', 'return_url' => 'http://kali/return', 'cancel_url' => 'http://kali/cancel', 'notify_url' => 'http://kali/notify', 'order_id' => 'ItemNo12345', 'items' => 'Door bell wireless', 'currency' => 'LKR', 'amount' => '1000', 'first_name' => 'Saman', 'last_name' => 'Perera', 'email' => '[email protected]', 'phone' => '0771234567', 'address' => 'No.1, Galle Road', 'city' => 'Colombo', 'country' => 'Sri Lanka' ); return redirect('https://sandbox.payhere.lk/pay/checkout')->with('post', $post);
data db ekata gihilla sandbox url ekata redirect wenawa but sandbox ekedi man pass karana data mukut gahanne na merchant error enawa
-
oya payhere sandbox wala reg unada?
-
payhere sandbox reg wela oyage site eke url eka add karanna one nathana redirect wenne na .
-
@dev_lak ow, man laravel walin nathuwa nikn html eheka post method ekath ekka sandbox url eka dunnahma eka payhere eken recognize karagannawa awulak nathuwa, mn sandbox eke mage url eka dila tiyenne, mata hithena widiyata laravel controller eken mn data eka pass karana widiye awulk tiyenne, payhere ekata data post method ekata controller eken pass karanna system ekak one
-
@root ow, man laravel walin nathuwa nikn html eheka post method ekath ekka sandbox url eka dunnahma eka payhere eken recognize karagannawa awulak nathuwa, mn sandbox eke mage url eka dila tiyenne, mata hithena widiyata laravel controller eken mn data eka pass karana widiye awulk tiyenne, payhere ekata data post method ekata controller eken pass karanna system ekak one
-
machan payhere client browser request withrai allow karanne . egollonge documentation eke thiyenne form request ekka . ithn oyath php curl walin post request ekak send karanna user agent kenek set karala.
-
e wagema oyata ba oyage site eke idala wena site ekkata mehama redirect karanna meka nikam 302 redirect ekak wage . php curl walin request karanna
-
e wagema oyata http://docs.guzzlephp.org/en/stable/ meka use karanna puluwan
-
@root client side eken checkout ekak security nane bro, Donation system ehekata wage nam client side okay, curl nam mn use karala na curl walin post method ekata pass karhm browser data ganne nathuwa puluwanda security eka awulk nadda
-
client eken neme server eken yawanne client ekak widiyata, oya me karanne laravel route ridirect ekak ehema karanna ba wena api ekkata. oya client kenek widiyata server eken yawanna one request eka, curl or guzzle walin karanna, simple deyak
-
@root bot kenek wage trick ekak pahadili, curl or Guzzle composer eken install karanna packages tiyenawane, a deken secure n lesima mkkd
-
php curl kiyanne php extention ekak, guzzle package ekak eka composer eken install karanna puluwan
-
php wala onama api ekakata backend ekakin request karanawanam mehemai karanne. bot ekak neme
-
@root okay bro, Ill try this.. thanx
-
@root machan, mama guzzle walin request karahm payhere view eka mage url eke load wenawa awulk nathuwa datath okkoma gannawa,
case eke tiyenne ita passe,
Payment method eka payhere ekedi (visa/master/amex/etc) me mokak click karath "Unexpected Error Occurred " ekak denawa
$client = new \GuzzleHttp\Client(); $url = "https://sandbox.payhere.lk/pay/checkout"; $myBody['name'] = "Demo"; $request = $client->post($url, array( 'form_params' => [ 'merchant_id' => '1213296', 'return_url' => 'http://kali/return', 'cancel_url' => 'http://kali/cancel', 'notify_url' => 'http://kali/lhorsamadi/notify', 'order_id' => 'ItemNo12345', 'items' => 'Door bell wireless', 'currency' => 'LKR', 'amount' => '1000', 'first_name' => 'Saman', 'last_name' => 'Perera', 'email' => '[email protected]', 'phone' => '0771234567', 'address' => 'No.1, Galle Road', 'city' => 'Colombo', 'country' => 'Sri Lanka' ] )); echo $request->getStatusCode(); echo $request->getHeaderLine('content-type'); echo $request->getBody();
a wagema echo nathuwa ->send() use karahama,
Call to undefined method GuzzleHttp\Psr7\Response::send()
meka fix krnne khmd bro
-
oya me karana de mata therenne na , ai mehema echo karanne payhere kiyanne external payment gateway ekak egollon payment eka karanne egollonge site eke idala , payment eka complete nam oyage site eka redirect karanawa. oyata ba payment eka handle karanna oyata puluwan payment eka verify karanna witharai.
-
@root echo kare ->send() dunnahama
Call to undefined method GuzzleHttp\Psr7\Response::send()
ehema nathuwa guzzel eken redirect krnn puluwanda
-
@alwismt bro oya me karana de waradi. payhere checkout api eka use karanawanam mehema karanna ba . oya hadanne oyage server eka thorugh yawanna ehema karanna ba bro . payhere egollonge server eke idalai payment eka process karanne . oyata denne na chekckout api ekedi oyage server eke idala handle karanna .
oyage site eke idala customer wa payhere ekata redirect karanawa , amount , discrption tika dala. ita passe payment eka succes unama customer wa apahu ewanawa payhere oyage site ekata .
<input type="hidden" name="return_url" value="http://sample.com/return"> <input type="hidden" name="cancel_url" value="http://sample.com/cancel"> <input type="hidden" name="notify_url" value="http://sample.com/notify">
oya me endpoint 3k hadala eken thama status eka verify karaganna one, oyata ba me credit card form eka checkout api ekedi oyage server eke run karanna.
-
This post is deleted! -
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>