Lightweight ruby bindings for the Firstdata 'Global Gateway e4' API.
Note: This works for v12+ of the API. It calculates the HMAC hash according to this (https://support.payeezy.com/hc/en-us/articles/203731149-API-Security-HMAC-Hash)
Add this line to your application's Gemfile:
gem 'firstdata'
And then execute:
$ bundle
Or install it yourself as:
$ gem install firstdata
Note: It is recommended that you use environment variables to set these values.
To set the keys:
Firstdata.gateway_id = # gateway id goes here
Firstdata.password = # password goes here
Firstdata.key_id = # key id goes here
Firstdata.key = # key goes here
To make a transaction:
Firstdata.transact(
# request hash goes here.
)
For more information on what to put in the request hash, refer to the API reference guide or scroll down for examples.
Purchase:
Firstdata.transact(
{
transaction_type: '00',
amount: 0,
cc_expiry: '1020',
cardholder_name: 'Test Name',
cc_number: '4111111111111111',
cvd_code: '1111',
currency_code: 'USD',
address: {
address1: 'Address Line 1',
city: 'City',
state: 'MA',
zip: '02108',
phone_number: '1111111111',
phone_type: 'H',
}
}
)
Pre-Authorization:
res = Firstdata.transact(
{
transaction_type: '01',
amount: 0,
cc_expiry: '1020',
cardholder_name: 'Test Name',
cc_number: '4111111111111111',
cvd_code: '1111',
currency_code: 'USD',
address: {
address1: 'Address Line 1',
city: 'City',
state: 'MA',
zip: '02108',
phone_number: '1111111111',
phone_type: 'H',
}
}
)
Purchase:
res2 = Firstdata.transact(
{
transaction_type: '00',
amount: 50,
credit_card_type: "Visa",
cc_expiry: '1020',
cardholder_name: 'Test Name',
transarmor_token: "#{res['transarmor_token']}",
}
)
- Fork it ( https://github.com/[my-github-username]/firstdata/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request