Sample code: Ruby on Rails

While we strive to ensure that all code we publish is accurate and well documented, the sample code given below is user contributed code and is provided as is, without any guarantees as to its correctness or valid operation. If you have any queries concerning this code and debugging or further development thereof, please contact the contributor or a developer familiar with this particular language as we will be unable to assist you.

The sample code was kindly contributed by Pawel Janiak.

This is a simple application that shows you how to get going with Payfast using Ruby on Rails. It uses the offsite_payments gem to build up the form but it’s not strictly necessary. The home/index view has a fake shopping cart table as well as the form that submits to PayFast.

The table is just a visual demo and is not tied to the form at all.

For the source code follow this link to the PayFast Rails example on GitHub.