Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
RESTful Rails app for storing credit cards
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
config
db
lib
public
script
spec
stories
test
vendor
.gitignore
CHANGELOG
MIT-LICENSE
README
Rakefile

README

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

Something went wrong with that request. Please try again.