Comments (9)
Hi @emigr2k1,
Can you please share the example of code and how you do type assert? Maybe we need to change how errors are returned. Thank you!
from paypal.
Hi, @plutov.
I'm sorry I didn't reply before. I didn't get the notification.
I was testing the library when I posted this issue and I don't have the code anymore.
The error I got was coming from:
func (c *Client) ExecuteApprovedPayment(paymentID string, payerID string) (*ExecuteResponse, error){...}
in payment.go but maybe this happens in other methods aswell
As you can see this function returns a normal error interface. To have access to the fields we have to use:
err.(*paypalsdk.ErrorResponse).Details
from paypal.
Hi @emigr2k1 are you able to provide a PR to solve this? But please keep error return value to be compatible.
from paypal.
I could but this and this recommend to return a normal error instead of a custom error and then use type assert.
So, probably the best way to solve this is just to add a section in the documentation showing how to handle the returned errors to get access to the ErrorResponse struct fields.
I'll provide a PR with examples handling errors if you think it's ok. Or maybe edit the example_test.go file and change:
if err != nil {
panic(err)
}
To something like:
if err != nil {
errDetails := err.(*ErrorResponse).Details
panic(errDetails)
}
from paypal.
Or maybe we should format an error
with correct description using Details inside the package, so panic(err) will be easy to understand.
from paypal.
Yes. I think that's better.
from paypal.
I am facing the same error, why this error occured?
I am not able to find the solution
from paypal.
Also need to confirm one more thing, the credit card details we are adding here are of which account? I mean of some other customer, or merchant of app itself?
Thanks in advance!
from paypal.
@archana-iron, try printing the error with:
err.(*paypalsdk.ErrorResponse).Details
About the credit card, it is the credit card of the payer but if I recall correctly, you can't use credit card method for payments. Try using
PaymentMethod: "paypal",
In the Payer field of a payment.
Check the official docs of paypal for more info. And you should create a new issue.
from paypal.
Related Issues (20)
- Suggestion: Mark all functions that represent deprecated paypal api resources as deprecated in godoc comment. HOT 2
- Get Order - Incomplete response object HOT 5
- Bug in ReauthorizeAuthorization HOT 1
- Make the mutex private in the structure HOT 2
- Suggestion: Error checking for malformed httpReq.Body on VerifyWebhookSignature HOT 1
- add landing page to v2/checkout/orders HOT 1
- Missed typing !
- POST https://api.sandbox.paypal.com/v2/checkout/orders: 401 Authentication failed due to invalid authentication credentials or a missing Authorization header. HOT 6
- How can i verify payment? HOT 3
- Removing deprecations HOT 1
- CHECKOUT.ORDER.COMPLETED response does not satisfty AnyEvent type HOT 2
- SendWithAuth requires GetAccessToken call explicitly HOT 2
- No dispute?
- Create Order error: paypal.Item.Tax is a String, API expects Object HOT 3
- Subscriber struct contains outdated fields HOT 1
- Create order body schema now uses payment_source HOT 4
- Paypal HOT 1
- Add Functionality to Create Estimates HOT 1
- Subscriber struct error HOT 2
- Specific Payment Method HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paypal.