1
1
# Payson API
2
2
3
- A simple utility to handle requests against the Payson payment gateway API.
3
+ A zero dependency, pure Ruby utility to handle requests against the Payson payment gateway API.
4
4
5
5
## Supported Ruby versions
6
6
7
7
* 2.6
8
8
* 2.7
9
9
* 3.0
10
10
11
- ## Install
11
+ ## Installation
12
12
13
13
Put this line in your Gemfile:
14
14
@@ -58,6 +58,10 @@ request.order.items << PaysonAPI::V2::Requests::OrderItem.new.tap do |item|
58
58
item.quantity = 3
59
59
item.reference = ' product-1'
60
60
end
61
+
62
+ checkout = PaysonAPI ::V2 ::Client .create_checkout(request)
63
+
64
+ # Continue by rendering the HTML from checkout.snippet.
61
65
```
62
66
63
67
### Updating a checkout
@@ -116,8 +120,6 @@ payment.return_url = 'http://localhost/payson/success'
116
120
payment.cancel_url = ' http://localhost/payson/cancel'
117
121
payment.ipn_url = ' http://localhost/payson/ipn'
118
122
payment.memo = ' Sample order description'
119
- payment.sender = sender
120
-
121
123
payment.sender = PaysonAPI ::V1 ::Sender .new .tap do |s |
122
124
123
125
s.first_name = ' My'
@@ -197,10 +199,10 @@ class Payson < ApplicationController
197
199
# Create a new IPN request object containing the raw response from above
198
200
ipn_request = PaysonAPI ::V1 ::Requests ::IPN .new (ipn_response.raw)
199
201
200
- validate = PaysonAPI ::V1 ::Client .validate_ipn(ipn_request)
202
+ validation = PaysonAPI ::V1 ::Client .validate_ipn(ipn_request)
201
203
202
- unless validate .verified?
203
- raise " Something went terribly wrong. "
204
+ unless validation .verified?
205
+ raise " Something went terribly wrong"
204
206
end
205
207
206
208
# Do business transactions, e.g. update the corresponding order:
@@ -213,15 +215,15 @@ end
213
215
214
216
## Todo
215
217
216
- Document the code for the Payson Checkout v2 processes .
218
+ Nothing at the moment .
217
219
218
- ## Build Status
220
+ ## Project Status
219
221
220
- [ ![ Build Status] ( https://travis-ci.org/stoffus/payson_api.svg?branch=master )] ( https://travis-ci.org/stoffus/payson_api )
222
+ [ ![ Build Status] ( https://travis-ci.org/stoffus/payson_api.svg?branch=master )] ( https://travis-ci.org/stoffus/payson_api ) [ ![ Gem Version ] ( https://badge.fury.io/rb/payson_api.svg )] ( https://badge.fury.io/rb/payson_api )
221
223
222
224
## Questions, Feedback
223
225
224
- Feel free to message me on Github ( stoffus).
226
+ Feel free to message me on [ GitHub ] ( https://github.com/ stoffus) .
225
227
226
228
## Copyright
227
229
0 commit comments