1. Begin by downloading the GoToBilling Ruby Plugin (Download Here)
2. Unzip and copy the plugin files to a location that you will be using them from within Rails or just Ruby.
3. Create a new Ruby or Rails app, or open an existing one, and add the following lines at the top:
require "GoToBillingLibrary.rb"
include GoToBillingLibrary
4. Next, decide when the transaction processing action will take place, and begin to insert the following code in that location. First, we will create a new GoToBilling object:
gotob = GoToBilling.new
5. Set the appropriate parameters for your transaction, for example, you are required to send your Merchant ID and Pin:
gotob.SetMerchantId(MyMerchantId)
gotob.SetMerchantPin(MyMerchantPin)
6. Once you've set all the parameters for the transaction, submit it:
gotob.process
7. Verify whether the transaction succeeded by checking the Status:
if gotob.GetStatus == "R"
puts "Order Number: " + gotob.GetOrderNumber
end
A full demo example with debugging and code documentation is included in the plugin package that can be downloaded above.
Note: Once you are ready to test your integration, please contact GoToBilling to set up a test account for certification with your application. |