ReturnUrl & ResultUrl Not Working


#1

Hi Forum,

I am having issues with processing transactions. When I send a transaction to PayNow, I specify Return and Result Url in my integration but nothing seems to be happening after I do a test payment. PayNow fails to redirect the user to the correct Redirect Url that I specified and also the result of the transaction is not being sent to the Result Url I initialised the PayNow object with.

Your assistance is greatly appreciated.


#2

Good day, please send the result and return URL you are sending to Paynow.


#3

Hi,

Below are the respective URLs as per your request:

ResultUrl - https://portal.hpa.co.zw/invoice/paymentstatus/{invoice Id from the database}
ReturnUrl - https://portal.hpa.co.zw/invoice/processed/{invoice Id from the database}


#4

Hi there.

  1. Your return URL is behind authentication and requires a user to login such that opening the URL will redirect a user to the login page if they have not logged in. Is this the intended functionality? When you say Paynow fails to redirect the user to the page you specified, do you mean that the user always ends up on the login page? If you remove the authentication requirement on the page https://portal.hpa.co.zw/invoice/processed/ {invoice Id from the database}, do you get the intended return page?

  2. Your result URL is not accepting POST requests (see screenshot below). Please note that Paynow will send a POST request with the payment result. You need to update the URL implementation https://portal.hpa.co.zw/invoice/paymentstatus/ {invoice Id from the database} such that it accepts POST requests.


#5

Hi @jamesof,

Thanks for the feedback. I have fixed the return and result URL. Return URL is working fine but I don’t think anything is getting passed to Result URL. Can you please check what is happening on Result URL.

Regards,


#6

Hmm, the URL is now returning an “415 Unsupported Media Type” response code when I POST an empty request with Postman. Ensure that the URL accepts any POST requests coming through, and do any validation after accepting the request, including checking the authenticity of the incoming data via hash.


#7

I have changed the method but it will better if I know the kind of message that PayNow sends. When you tested it had the following signature:

[HttpPost()]
public async Task< IActionResult > PaymentStatus(string id, [FromBody] PayNowResponse resp){
//do something here
}


#8

Hi there, the request has Content-Type: application/x-www-form-urlencoded and looks something like this:
“reference=W7YIUPFP6EUVJEGQONFD&paynowreference=17906&amount=17.22&status=Paid&pollurl=https%3a%2f%2fstaging.paynow.co.zw%2fInterface%2fCheckPayment%2f%3fguid%3de151ef75-cedc-4a92-9075-16abc7244fsv8&merchantfees=0.00&customerfees=1.07&hash=A348AD10CA90658B9C165459673B7A812A70EE43F9198C543234D859997920C28CA6894A1A23CC1524056424E375DE401C5684EEFC29D3D4F7D9F17796C5717B”

The best way to work with it though is to log it and see how your framework treats it, which will make it easier to see how to read and process it further.


#9

Is this a form post or it comes in as query string?


#10

It’s a query string. Although that shouldn’t matter much since you’re using a framework, which should take care of handling the incoming request and passing you an object of some kind to work with.


#11

Noted with thanks. Let me implement it and retest again


#12

Hi @jamesof,

I don’t seem to be receiving anything on my result URL. Is there way you can check this for me. If possible can I have a session with you. So that I can finalise this as it is delaying our project.


#13

Good morning, please check the access/icoming request logs in your nginx, apache or equivalent and you see the requests are coming through. So long as your URL is public the result will be sent.

Testing now on your previously provided result URL: https://portal.hpa.co.zw/invoice/paymentstatus/5 (which you might want to change for security once everything is working), using 5 as the invoice ID, the server is returning a 500 error status, which might result in the impression that your URL is not being called. NOTE: I didn’t do anything special, just sent a basic POST request to your URL via Postman, here’s cURL version:

curl --location --request POST 'https://portal.hpa.co.zw/invoice/paymentstatus/5'

#14

I am now getting responses on my Result Url. Thanks @jamesof