Comments (5)
Elliott, thanks for your suggestion. I will review the parsing of the error messages request and get back to you once we discuss in our sprint
from amazon-pay-sdk-php.
I am working with this library and its very hard to handle the errors - have to dig in the arrays to understand why payments get stuck. Please note that not all errors are getting handled with exceptions, such as invalid payment method error that is in some other place in XML.
from amazon-pay-sdk-php.
Agreed. I believe I am looking for similar answers. I arrived here in search of the best practice for error handing the API calls. For example, is any sort of specific Exception
's thrown or are they all a simple generic Exception
class? For example, what if Amazon is down and cannot be communicated with? There's the "service status" API call but if the Amazon API is down that probably defaults the purpose of that call. Looking at the code I saw an invokePost
method which looked like the right spot for these cases. If so, is the recommended way to wrap each API call like so?
try {
$response = $this
->amazonPay
->setOrderReferenceDetails(array(
'amazon_order_reference_id' => $order->getAmazonReferenceId(),
'seller_order_id' => $order->getAmazonOrderId(),
'amount' => $order->getTotal(),
'currency_code' => 'USD',
'seller_note' => 'Hello World.',
'store_name' => 'Our Shop!',
));
} catch (\Exception $e) {
// Perform error handing here ...
}
from amazon-pay-sdk-php.
@bmeynell This library is a total mess. 😄 It does not throw exceptions at all. You have to "ask" the client if there was an error on an boolean var.
When implementing an Exception Approach it would be nice to wrap them into super classes Like ClientException == 4xx and ServiceException = 5xx
ClientException would then wrap around the response object and extract useful messages and and Error codes from it?
from amazon-pay-sdk-php.
frustrated without error code.
the "charge" method returns an exception because of Suspended caused by InvvalidPaymentMethod
"The Order Reference is in the Suspended State. It should be in the Draft or Open State"
I want to identify this with the exception error code but currently only the string above.
from amazon-pay-sdk-php.
Related Issues (20)
- php fatal error for newer psr\log
- Error setting certificate verify locations: CAfile: ~/cacert.pem CApath: /etc/ssl/certs. HOT 2
- Unable to post request, underlying exception of SSL certificate problem HOT 2
- Charge convenience method doesn't authorize - FIXED: needs to set a confirmOrder arg HOT 1
- Can't settle in a production environment HOT 4
- client object response false.
- SCA doesn't work in version 2.x
- Why HttpClient implementation is limited to use Curl? HOT 2
- synchronous mode returns Pending HOT 2
- Multi Currency Error
- Send amount on login screen
- InheritShippingAddress does not seem to default to true
- What is the best way to manage recurring payments HOT 3
- switch to php-fig/log vendor instead of inside implementation
- Where is the access token for unit testing? HOT 1
- https://pay.amazon.com/developer/documentation/apireference/201751960 HOT 1
- order of using class methods to perform a transaction HOT 3
- Pay HOT 2
- Jailbreak HOT 1
- str_contains issue HOT 2
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 amazon-pay-sdk-php.