-
-
Notifications
You must be signed in to change notification settings - Fork 163
API Errors
Andreas Wenk edited this page Aug 27, 2013
·
7 revisions
When PayPal API returns failure response, paypal-express raises Paypal::Exception::APIError
.
Since PayPal IPN API returns Failure
as string and PayPal NVP API (includes Express API) returns Hash (form-urlencoded params), Paypal::Exception::APIError#response
is String for IPN and Paypal::Exception::APIError::Response
instance for NVP.
begin
# Invalid API Request
rescue Paypal::Exception::APIError => e
e.message # => 'PayPal API Error'
e.response # => Paypal::Exception::APIError::Response
e.response.details # => Array of Paypal::Exception::APIError::Response::Detail. This includes error details for each payment request.
end
See spec code for more details.
ref.) API Error Codes – PayPal Developers
https://developer.paypal.com/webapps/developer/docs/classic/api/errorcodes/
When HTTP-level error occured, paypal-express raises Paypal::Exception::HttpError
.
Both Paypal::Exception::HttpError
and Paypal::Exception::APIError
are subclass of Paypal::Exception
.