Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (34 sloc) 2.22 KB
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