Paynow PHP Not sending Verification Post Request to Result URL


#1

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.


#2

@Chris hi. Please share an example of your initiate transaction request?


#3

The initiating code is as follows.

require_once(cl_full_path(‘core/libs/paynow/autoloader.php’));

$item = “Top up account balance”;
$reference = sha1(microtime());
$paynow = new Paynow\Payments\Paynow(
$cl[‘config’][‘paynow_api_id’],
$cl[‘config’][‘paynow_api_key’],
https://example.com/native_api/wallet/wallet_tup_return?ref=example-true,
https://subdomain.example.com/api/v1/verify”,
);

$payment = $paynow->createPayment($reference, $me[“email”]);
$payment->add($item, $topup_amount);
$response = $paynow->send($payment);

if($response->success()) {
$link = $response->redirectUrl();
$pUrl = $response->pollUrl();

db_insert(T_PAYNOW, array(
‘id’ => $reference,
‘user_id’ => $me[‘id’],
‘pollUrl’ => $pUrl,
‘amount’ => $topup_amount,
‘time’ => date(“Y-m-d H:i:s”)
));

$data[‘url’] = $link;
$data[‘status’] = 200;

Its an internal API that the web app requests to, then i redirect to the $data[“url”]


#4

Sorry, what Im referring to is the raw request message which is sent to Paynow – that will show a lot of detail which will help with debugging.


#5

And how do i get that, I’m using that PHP as according to the documentation, so where do i get that part?
Cause the only think i can access here is the result from the createPayment() result.


#6

Fiddler or similar tool will show you request/response from Paynow. Meantime, perhaps you can share your Paynow integration ID? (not your secret key, just the numeric integration ID)


#7

The Integration ID IS : 13553


#8

The following error is appearing when Paynow is trying to post to your resulturl:
The request was aborted: Could not create SSL/TLS secure channel

As a temporary fix, you could use http instead of https for your resulturl – you’ll be validating the hash of the message in any case, so it wont introduce a security flaw.


#9

Okay, thank u, let me do that. Please be available here, if i have any more need for your hlp.


#10

Can i parse a JWT token as a Get variable on the result url, for added security verification?


#11

I have made the system Accept post requests on http not https as you recomended, but still its not verifying regardless. The screenshot above is the API Test as you can see it works well on http and aswell as https. Can you please tell me whats stopping verification now.


#12

Hi Chris, please confirm if the details you provided here are correct.

$item = “Top up account balance”;
$reference = sha1(microtime());
$paynow = new Paynow\Payments\Paynow(
$cl[‘config’][‘paynow_api_id’],
$cl[‘config’][‘paynow_api_key’],
https://example.com/native_api/wallet/wallet_tup_return?ref=example-true,
“https://subdomain.example.com/api/v1/verify”,
);

If so, you might be putting the return_url where you’re supposed to be putting the result_url & thus the API will be posting updates to example.com instead of subdomain.example.com can you switch those and test if the API is still not sending the request?


#13

Well, then that means the Paynow function suggests wrong variable names, and also it redirects well to the return url, because they would be different


#14

Are you still experiencing the error?


#15

Yes, When the result url is https we dont get any POST request, and we cant do http because our server configs blocks such, and for security purposes we cant turn that off. We have an SSL certificate installed, that works well on other platforms we have integrated Paynow with also.


#16

Screenshot%20(73)


From the code snippets above i have used to test the response from Paynow as well as the urls if i had configured them wrong, thats the result on the first image, the result url is at the right place, and PhpStorm confirms this with its variable name suggestions. Then below are the log files written, as it stands there’s nothing coming from Paynow.


#17

Post requests comes only on http not https, why? Cause this has to be secure