Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Work-in-progress Samurai client library for python.
branch: master

This branch is 185 commits behind FeeFighters:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

This is the python library for the Samurai API from Fee Fighters. It allows you easily store customer payment information, and create transactions, without having to ever worry about having their credit card number cross your server.


Payment Method

This a set of credentials for making a credit card payment. It includes:

  • less sensitive data that you will have access to (name, address, credit card expiration date, etc)
  • more sensitive data that you won't have access to (credit card number and cvv)
  • the state of the payment method (is data valid, is payment method redacted, etc)

Each Payment Method is identified by a payment_method_token.


This is an action taken based on a payment method, and/or a previous transaction. There are a 5 different types of transactions.

  • purchase - a complete payment
  • authorize - the first part of a two-step payment
  • capture - the second part of a two-step payment
  • void - the cancellation of any previous payment
  • credit - a partial or complete refund on an existing completed payment

Each Transaction is identified by a reference_id, and each set of transactions that relate to each other (the capture for an earlier authorize, the void of an earlier purchase, etc) is identified by a transaction_token.


This library currently isn't a proper Python package, so you will have to get the source. The main directory serves as a module, though you should rename it to something like samurai_client_python, since dashes aren't valid for module names. The directory also works as a Django application, if you would like to use it for that.


The module samurai_client_python.core and the file transparent_redirect.html.example contain everything necessary to use the Samurai API. You will be in charge of saving references to Payment Methods and Transactions Read More


The modules samurai_client_python.models, samurai_client_python.urls, samurai_client_python.views make up a Django app which call on samurai_client_python.core. Read More (Though read first about Core, above)


This is if you want to run samurai_client_python test suite. It's good to test the code, and also to test if anything is wrong or just changed with the samurai API. If you suddenly start having unexplainable problems, this might be a good place to start.


If you want any of the tests to pass, you will need to create a file called Look at for what to put in. Do not put credentials from real merchants or processors into this file. You should get test credentials from FeeFighters.


If you don't have this properly configured as part of Django, the Django tests will not pass.


Testing only


This will run every test, and fail the Django ones:

Testing everything:

./ test samurai_client_python

This requires that you have samurai_client_python in your INSTALLED_APPS.

Something went wrong with that request. Please try again.