Result Url not get called by paynow after payment successfull


#1

Hi,
I am new to paynow integration, I am trying to do payment integration, payment created and made successful but result url not get called.

Result URL (HTTP POST) : http://13.244.235.35:9010/PaymentGateway/Update

My service side code :
Controller :
[HttpPost(“Update”)]
public IActionResult Update(PayNowResponse response)
{
try
{
response.SerializeObject().WriteLog();
return Ok();
}
catch (Exception ex)
{
return BadRequest(new { message = ex.Message });
}
}

Model :
public class PayNowResponse
{
public string reference { get; set; }
public decimal amount { get; set; }
public string paynowreference { get; set; }
public string pollurl { get; set; }
public string status { get; set; }
public string hash { get; set; }
}

I am not sure about protocol whether the paynow calls only https. I am using http protocol only for testing purpose.


#2

I can confirm Paynow is sending a result POST to your URL. The last Post to your URL was August 2nd 2021, 08:50


#3

Hi @Harvey, but i didn’t receive any response from your side.


#4

Is there logged any failed attempts ? kindly please check, or else tell me if code was wrong.


#5

We sent the POST but your server did not respond. Have you tested your endpoint with a tool for like Postman


#6

Yes, I tested with postman. here testing result.

result also logged in our server.


#7

hi @Harvey, did you find anything ? we want urgent support from you. we almost wait for 1 month. we need to rectify this. kindly support us to solve this.


#8

I looked at your Postman test , Paynow is not sending the response as JSON . it is being sent as as a string and formatted as an HTTP Post, i.e. each field separated by a & and Key Value pairs separated by an = and all Values URL Encoded. You can read more here

Initiate a transaction · Paynow Developer Hub


#9

As your guidance, I changed my code as below picture.

this time paynow returning null or empty to result url.

image

do I change anything again in my code ?


#10

Hi,
Thank you harvey,

finally got the solution for .net why the paynow server send me the empty string to result_url.

if we done your code this way you can get the result from paynow.
Url encoded based value to get result

HttpFormCollection.Request.Form
Request.Form["<paynow result field goes here>"].ToString()

does this.


#11

@mohideenasraf wonderful news , @lucia thank you for the guidance with .NET