Issue while accessingtoken via getApi in live website

Posted in General by Arindam Chakraborty Mon May 15 2017 03:33:17 GMT+0000 (UTC)·4·Viewed 1,289 times

I have contacted several times about this issue support@instamojo.com but nobody even bothered to reply. So I am posting my issue here in details. Programming used - ASP.NET MVC (C#). Website - www.caddesksilchar.com I have used instamojoAPI in my localhost environment to test payment in the website i was developing for caddesksilchar and when i found that everything was working fine I published it in the above mentioned website. Suddenly i encountered an error. ** Lets make it short about the error - Everything was running fine in localhost environment but when i published the website the error occured. I was unable to recreate the error in my localhost environment at first making it very hard for me to debug the error. ** string clientid = "SECRET ID"; ** string clientsecret = "SECRET ID"; ** string endpoint = "https://api.instamojo.com/v2/";; ** string authendpoint = "https://www.instamojo.com/oauth2/token/"; ** Instamojo objClass = InstamojoImplementation.getApi(clientid, clientsecret, endpoint, authendpoint); After some long manual testing I found the source of the error. The error is in this piece of code - ** Instamojo objClass = InstamojoImplementation.getApi(clientid, clientsecret, endpoint, authendpoint); But Why the code works in my localhost and not in live website? So i did this I turned off the internet in my localhost machine and ran only this part - ** Instamojo objClass = InstamojoImplementation.getApi(clientid, clientsecret); And the error occured in my localhost environment also. So according to my observation ** getApi ** tries to connect to a service of Instamojo to get token of some kind. If i am not wrong. That means there is some issue with ports on live server that i am using. I have contacted the support staff of my SERVER ADMIN (who gave me instant support unlike instamojo) and told them to open port 443 as mentioned in this link - ** https://support.instamojo.com/hc/en-us/articles/214079929-cURL-Error-Number-7 They opened the port and still it doesnot work and they told me to get in touch with instamojo. So now everything rests on your reply. kindly tell me what to do now. I need instant support. My client is frustrated and if i dont get an instant support from you guys I will not bother a second to shift to another client because it has been many days i tried to contact you guys but nobody bothered to reply me. PS - I have build the C# wrapper and created a dll and used it as reference in my website. I have also tried to republish the website all over again. Nothing seems to work. Kindly help me ASAP.
Arindam Chakraborty
May 15, 2017

Server Error in '/' Application.

Invalid JSON primitive: The.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Invalid JSON primitive: The.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: Invalid JSON primitive: The.]
System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject() +586
System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth) +235
System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer) +79
System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) +37
System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(String input) +71
InstamojoAPI.InstamojoImplementation.getAccessToken(String clientId, String clientSecret, String authEndpoint) +465
InstamojoAPI.InstamojoImplementation.getInstamojo(String clientId, String clientSecret, String apiEndpoint, String authEndpoint) +173
InstamojoAPI.InstamojoImplementation.getApi(String clientId, String clientSecret, String apiEndpoint, String authEndpoint) +127
InstamojoAPI.InstamojoImplementation.getApi(String clientId, String clientSecret) +42
CadDeskSilchar.Controllers.HomeController.checkout(Int32 course, List1 softwares, Decimal tehabox) +3380 lambda_method(Closure , ControllerBase , Object[] ) +213 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +157
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27 System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22 System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32 System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50 System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225 System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34 System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26 System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36 System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +22
System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9765121
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Arindam Chakraborty
May 15, 2017

The error i mentioned in my first comment is what i get when i try to pay for the first time. But after that I get this error -

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
InstamojoAPI.InstamojoImplementation.isTokenExpired() +67
InstamojoAPI.InstamojoImplementation.getInstamojo(String clientId, String clientSecret, String apiEndpoint, String authEndpoint) +230
InstamojoAPI.InstamojoImplementation.getApi(String clientId, String clientSecret, String apiEndpoint, String authEndpoint) +127
InstamojoAPI.InstamojoImplementation.getApi(String clientId, String clientSecret) +42
CadDeskSilchar.Controllers.HomeController.checkout(Int32 course, List1 softwares, Decimal tehabox) +3380 lambda_method(Closure , ControllerBase , Object[] ) +213 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +157
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27 System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22 System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50

vinod
June 9, 2017

I am getting same error. What is that instant mojo.. Your payment gateway is for websites and no working example in .Net such a shame..

Jayasurya Chiruthanuru
Sep 5, 2017

Check if you are behind a proxy while creating the instance. I had the same issue and resolving the proxy fixed the issue.

  
Markdown is allowed