-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
58 lines (34 loc) · 2.22 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
MonkeyCharger is a small stand-alone RESTified Rails app that lets you store
and charge credit cards. It uses the ActiveMerchant library for the
authorizing and capturing of credit cards.
You probably want to run this application on a super-secured machine that's firewalled
like crazy and is not accessible from the internet. And follow the Visa CISP
documentation.
NOTE ON RUNNING TESTS: running 'rake' will run the integration tests, which do hit the
remote payment gateways. You'll need a valid account with someone like authorize.net
to successfully run those tests. Running 'rake spec' doesn't hit any remote gateways.
Also, before running the tests, cp config/initializers/monkeycharger.rb.example to
config/initializers/monkeycharger.rb.
=API summary=
==Storing Credit Cards==
* `POST /credit_cards.xml`
use with parameters such as number, cvv, month, year, name, etc.
You'll also need to supply a passphrase parameter. Use the passphrase parameter when authorizing against the saved card.
Uses the ActiveResource conventions. But this might change -- ActiveResource might be overkill for this.
==Authorizing credit cards==
* `POST /authorizations.xml` use parameters amount and the same credit card group as above.
* `POST /authorizations.xml` use parameters amount and a credit_card_id.
Both these return a transaction_id and a X-AuthorizationSuccess HTTP header on success,
or text that represents the failure reason if it failed to authorize the card.
==Capturing==
* `POST /captures.xml` use parameters amount and transaction_id.
If the capture was successful, the X-CaptureSuccess HTTP header will be set. If not successful, will return the reason why.
==Cancelling==
* `POST /cancelations.xml` use parameter transaction_id.
==Refunds==
* `POST /refunds.xml` use parameters amount, transaction_id, and last_four_digits_of_credit_card
==Rails Way Writeup==
Jamis Buck did a write-up on monkeycharger: http://www.therailsway.com/2007/9/3/using-activeresource-to-consume-web-services
Also, MonkeyCharger was featured in "The Rails Way" book by Obie Fernandez on an example of how to
write good, descriptive tests for a Rails application.
Copyright (c) 2009 Joe Van Dyk, released under the MIT license