I am trying to integrate Paynow using PHP, I have set up everything according to the Documentation, however the Payment verification is not happening.
I set up an API route separately on a subdomain, created a laravel application just to accept the POST request with the data, but there’s nothing being received. Can I get any help, It’s quite urgent, I really need this to work today. I am using a Sandbox account and making fake success requests but they are not working. Just a basic sample of the laravel function to verify the payment that accepts POST requests is as follows
$reference = $request->input(‘reference’);
$paynowreference= $request->input(‘paynowreference’);
$amount = $request->input(‘amount’);
$status = $request->input(‘status’);
// $data = $request->input(‘data’);
//$pollurl = $request->input(‘pollurl’);
$hash = $request->input(‘hash’);
$values = PaynowTransactions::where(‘id’, $reference)->first();
$user = DB::table(‘cl_users’)->where(‘id’, ‘=’, $values->user_id)->first();
$history = DB::table(‘cl_wallet_history’)->insert([
‘user_id’ => $user->id,
‘operation’ => ‘paynow_wallet_tup’,
‘amount’ => $amount,
‘json_data’ => json_encode(array(
‘paynow_ref’ => $paynowreference,
“status” => $status,
“request” => $request,
‘reference’ => $reference
), true),
‘time’ => time()
]);
if($status == ‘Paid’){
DB::table(‘cl_users’)->where(‘id’, ‘=’, $values->user_id)->update([‘wallet’ => ($user->wallet += $amount)]);
}
return response()->json(array(“success” =>true , ‘history’ => $history, ‘status’ => $status, ‘data’ => $values));
For testing purposes i set it up to log everything in the database and there are no records as yet.