Paypal The Remote Server Returned An Error 400 Bad Request
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more the remote server returned an error (400) bad request. c# paypal about Stack Overflow the company Business Learn more about hiring developers or posting ads
Paypal 400 Bad Request
with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow paypal debug id is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PayPal REST API .net SDK - 400 Bad Requests up vote 12 paypal rest api down vote favorite 2 I'm working in the sandbox and using the PayPal REST .net SDK method Payment.Create with a CreditCard object. When all parameters are valid and using the test CC number from https://developer.paypal.com/webapps/developer/docs/integration/direct/accept-credit-cards/, the Payment object is returned from that method and all is well. However, when a parameter is not valid, such as a past expiration date or a CC number not recognized by the sandbox, the
Paypal Developer
Payment object is not returned. Instead the method throws an exception: "Exception in HttpConnection Execute: Invalid HTTP response The remote server returned an error: (400) Bad Request", but with no further explanation. When I execute the same request in cURL, in addition to the "400 Bad Request", I get a JSON response. This includes more helpful messages such as "VALIDATION_ERROR" and "Invalid expiration (cannot be in the past)". My question: Is there a way to get these messages back from the SDK? What I've tried: PayPal docs: https://developer.paypal.com/webapps/developer/docs/api/#errors This document mentions that in the case of an error, they return the details in the body of the response. Unfortunately, it doesn't give a clue about whether these are accessible by the SDK. Various Google and SO searches. The PizzaApp sample code provided with the SDK has nothing in the way of exception handling or further insight into this problem. I see a PayPalException object in the SDK, but have not found anything that indicates how it should be used or if it's even relevant to this problem. All help is much appreciated. .net rest sdk paypal paypal-sandbox share|improve this question asked Mar 22 '13 at 23:13 Jonathan Black 111110 add a comment| 6 Answers 6 activ
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this paypal sandbox site About Us Learn more about Stack Overflow the company Business Learn more fiddler about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PayPal 400 http://stackoverflow.com/questions/15581314/paypal-rest-api-net-sdk-400-bad-requests Bad Request, more specific? up vote 4 down vote favorite Is there any way to get a more specific PayPal error than 400 bad request? I saw someone doing something like this: if (ex.InnerException is ConnectionException) { Response.Write(((ConnectionException) ex.InnerException).Response); } else { Response.Write(ex.Message); } But that doesn't seem to do anything different for me, all the error says is: "The remote server returned an error: http://stackoverflow.com/questions/30540859/paypal-400-bad-request-more-specific (400) Bad Request." I've read that it could have something to do with some sort of validation error, but I've tried changing the data I'm sending to PayPal, but all with no luck so far. I hope you can help me, thank you! EDIT: Thanks to Aydin I managed to find this error-message in one of the HTTP requests through Fiddler: {"name":"VALIDATION_ERROR","details":[{"field":"payer.funding_instruments[0].credit_card.number","issue":"Value is invalid"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR","debug_id":"dd5f11f6e9c98"} c# asp.net-mvc paypal share|improve this question edited May 30 '15 at 0:53 asked May 30 '15 at 0:12 Mikkel 363113 Are you authenticated at this point in your code? PayPal might not give you a more detailed error message for security reasons. –Sumner Evans May 30 '15 at 0:18 Thanks for your fast comment! Hmm... It seems the exception occurs on payment Create. If if's an connection exception wouldn't it show more info when I use the above code though? –Mikkel May 30 '15 at 0:22 add a comment| 3 Answers 3 active oldest votes up vote 3 down vote accepted You can save yourself time by installing Fiddler, by doing so you can see the exact HTTP Web
Sign in Pricing Blog Support Search GitHub This repository Watch 83 Star 227 Fork 319 paypal/PayPal-NET-SDK Code Issues 16 Pull requests 5 Projects 0 https://github.com/paypal/PayPal-NET-SDK/issues/15 Wiki Pulse Graphs New issue Proposed improvement to paypal catch exception response https://github.com/paypal/PayPal-NET-SDK/issues/105 in sample codes in github #15 Closed annraoimts opened this Issue Sep 18, 2013 · 4 comments Projects None yet Labels api-enhancement sdk-enhancement Milestone No milestone Assignees No one assigned 5 participants annraoimts commented Sep 18, 2013 I have been testing the REST API bad request for VAULT and I was experiencing some coding issues while using payment API using the vault as the fundInstrument, when using the sample code on: https://github.com/paypal/rest-api-sdk-dotnet/blob/master/Samples/RestApiSample/PaymentWithSavedCard.aspx.cs. All the response error codes I was getting was the standard 400,404 etc. as is expected from the sample code I then changed the exception response within the sample code on my test site the remote server to the following: if (ex.InnerException is PayPal.Exception.ConnectionException) { Textbox1.Text = (((PayPal.Exception.ConnectionException)ex.InnerException).Response); } else { TextBox1.Text = (ex.Message); } I found it on http://stackoverflow.com/questions/15581314/paypal-rest-api-net-sdk-400-bad-requests, I feel this is valuable for Vault responses it was to me as I fixed my issue in seconds. If you agree can we get the sample code to include it? Before my change in the exception response: Exception in HttpConnection Execute: Invalid HTTP response The remote server returned an error: (400) Bad Request Since the change: {"name":"INVALID_RESOURCE_ID","message":"The requested resource ID was not found","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID","debug_id":"5a652da4b066c"} The error for this was because I 2 digit year not a 4 digit. PayPal member prannamalai commented Sep 18, 2013 👍 avidas added enhancement sdk-enhancement labels Feb 14, 2014 PayPal member jziaja commented Oct 6, 2014 The PayPal Core SDK for .NET has recently had its error reporting improved to make it easier for developers to get at this information in the thrown exceptions. Feel free to reopen this issue if you feel there can still be further improvements to how the HTTP error codes and responses are being r
Sign in Pricing Blog Support Search GitHub This repository Watch 83 Star 227 Fork 319 paypal/PayPal-NET-SDK Code Issues 16 Pull requests 5 Projects 0 Wiki Pulse Graphs New issue Payment.Create not working #105 Closed Zartexx opened this Issue Jun 11, 2015 · 25 comments Projects None yet Labels api-payments question Milestone No milestone Assignees No one assigned 4 participants Zartexx commented Jun 11, 2015 I am attempting implementation of the REST API. but can't get past the line: Payment ZeroChargedPayment = pymnt.Create(PAC) all it tells me is UNKNOWN_ERROR some debug_ids 9916dd16fade6 ebca6a2b07079 I also tried with the Details() in the Amount() and adding the ItemList() to the Transaction() with the same result. the json looks like this { "intent":"sale", "payer":{ "payment_method":"credit_card", "funding_instruments":[ { "credit_card_token":{ "credit_card_id":"CARD-9V730261823609037KV462DY", "expire_month":11, "expire_year":2018 } } ] }, "transactions":[ { "amount":{ "currency":"USD", "total":"1.00" }, "description":"Validating a Credit Card" } ] } the account has direct enable for sandbox so I don't know what is wrong, I am using the fake credit card from the sample C# REST API PayPal member jziaja commented Jun 11, 2015 CC previous discussion on the PHP SDK jaypatel512 commented Jun 11, 2015 Just to confirm, are you trying to create payment using credit card, or vault ? Zartexx commented Jun 11, 2015 The plan is: User enters CC info on our site, I vault it and store the Vault # in our database. then when the "Event" occurs, we will charge their CC by using the Vault id. (the "Event" can be hours later or weeks later) PayPal member jziaja commented Jun 11, 2015 @Zartexx can you try using the sandbox credentials used by the .NET SDK sample project in your project and see if it's able to create the payment successfully? That will help to rule out whether or not it's an issue with your account. Thanks! jziaja added question api-payments labels Jun 11, 2015 jaypatel512 commented Jun 11, 2015 Make sure to create a new Vault Token, as vaults are specific for each merchant (clientId). Zartexx commented Jun 11, 2015 I