On Live env, ASP.NET CORE Payment giving error

 var jsonRequest = JsonSerializer.Serialize(requestObj);

                var result = RapydApiRequest.Utilities.MakeRequest("POST", "/v1/checkout", jsonRequest, accessKey, secretKey, rapydSetting.UseSandbox);

while calling this things , facing issue on SANDBOX its working fine , any reason or any help will be great

calling like this

                string httpMethod = method;
                Uri httpBaseURL = sandbox ? new Uri("https://sandboxapi.rapyd.net") : new Uri("https://rapyd.net");
                string httpURLPath = urlPath;
                string httpBody = body;
                string salt = GenerateRandomString(24);
                long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
                string signature = Sign(httpMethod, httpURLPath, salt, timestamp, httpBody, accessKey, secretKey);

                Uri httpRequestURL = new Uri(httpBaseURL, urlPath);
                WebRequest request = HttpWebRequest.Create(httpRequestURL);
                request.Method = httpMethod;
                request.ContentType = "application/json";
                request.Headers.Add("access_key", accessKey);
                request.Headers.Add("salt", salt);
                request.Headers.Add("timestamp", timestamp.ToString());
                request.Headers.Add("signature", signature);
                return HttpRequest(request, body);
            catch (Exception ex)
                return "Rapyd : Error generating request options: " + ex;

Rapyd : Error occurred : System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at RapydApiRequest.Utilities.HttpRequest(WebRequest request, String body) The remote server returned an error: (404) Not Found.

1.) you said that you are on live environment while some part of your code is still making request to sandbox API or there is a typo in live url as per here

Uri httpBaseURL = sandbox ? new Uri("https://sandboxapi.rapyd.net") : new Uri("https://rapyd.net");

Live API URL should be something like https://api.rapyd.net and not https://rapyd.net

2.) I will also advice you to look into the API Key and Secret Live enviroments.
you don’t have to use sandbox access credentials for live environments.

To get live access keys and secret, you will need to login to your developer account at the bottom of the page, click a switch button to generate a live access credentials. Finally, try it and see if it works


Thanks Iyas, @8538962a317c971ba767, let us know if that helps.

Thanks @fredjinbility!

Here are also some resources that may help:

If the above doesn’t help, would check some of the commends on specifically how the body string is put together and the spacing around each string.

For example:

  • All spaces and other whitespace outside of strings must be removed.
  • Numbers should be sent in strings, not as numbers.
1 Like