Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed improvement to paypal catch exception response in sample codes in github #15

Closed
annraoimts opened this issue Sep 18, 2013 · 4 comments

Comments

@annraoimts
Copy link

I have been testing the REST API 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 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.

@prannamalai
Copy link

👍

@jziaja
Copy link
Contributor

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 reported.

@jziaja jziaja closed this as completed Oct 6, 2014
@amitatrey
Copy link

I am running the sample from "github.com/paypal/rest-api-sdk-dotnet" and trying to use PaymentWithPayPal.aspx it fails at

return this.payment.Execute(apiContext, paymentExecution);

with 404 error and {"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":"fd0006d389566"}
Please help

@jziaja
Copy link
Contributor

jziaja commented Oct 26, 2014

Hi @amitatrey , can you open a new issue concerning your error? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants