README.md in paypal-rest-api-0.0.1 vs README.md in paypal-rest-api-0.0.2
- old
+ new
@@ -60,11 +60,15 @@
Also PaypalAPI client can be added globally and class methods can be used instead:
```ruby
# in config/initializers/paypal_api.rb
-PaypalAPI.client = PaypalAPI::Client.new(...)
+PaypalAPI.client = PaypalAPI::Client.new(
+ client_id: ENV['PAYPAL_CLIENT_ID'],
+ client_secret: ENV['PAYPAL_CLIENT_SECRET'],
+ live: false
+)
# in your business logic
response = PaypalAPI.orders.create(body: body)
response = PaypalAPI.webhooks.verify(body: body)
@@ -89,11 +93,11 @@
PaypalAPI client can be defined with `live` option which is `false` by default.
When `live` is `false` all requests will be send to the sandbox endpoints.
```ruby
client = PaypalAPI::Client.new(
- live: true,
+ live: true
# ...
)
```
### Option `:retries`
@@ -165,10 +169,19 @@
```ruby
begin
response = PaypalAPI.payments.capture(authorization_id, body: body)
rescue PaypalAPI::Error => error
- YourLogger.error(...)
+ YourLogger.error(
+ error,
+ context: {
+ error_name: error.error_name,
+ error_message: error.error_message,
+ error_debug_id: error.error_debug_id,
+ error_details: error.error_details
+ }
+ )
+ # `error.request` and `error.response` methods can be used also
end
```
## Development