If you don't already have Shift4 account you can create it here.
Add this line to your application's Gemfile:
gem 'shift4'
And then execute:
bundle
Or install it yourself as:
gem install shift4
Configuration:
Shift4::Configuration.secret_key = 'pr_test_id'
If you want connect to different backend:
Shift4::Configuration.api_url = 'https://api.myshift4.env'
Shift4::Configuration.uploads_url = 'https://uploads.myshift4.env'
Creates a new card object.
customer_id = 'cust_id'
card = {
number: '4242424242424242',
expMonth: '11',
expYear: '2022',
cvc: '123',
cardholderName: 'John Doe',
}
Shift4::Cards.create(customer_id, card)
Retrieve an existing card object.
customer_id = 'cust_id'
card_id = 'card_id'
Shift4::Cards.retrieve(customer_id, card_id)
Update an existing card object.
customer_id = 'cust_id'
card_id = 'card_id'
card = {
cardholderName: 'Mr Bean'
}
Shift4::Cards.update(customer_id, card_id, card)
Deletes an existing card object.
customer_id = 'cust_id'
card_id = 'card_id'
Shift4::Cards.delete(customer_id, card_id)
List card objects for given customer.
customer_id = 'cust_id'
Shift4::Cards.list(customer_id)
blacklist_rule = {
ruleType: 'fingerprint',
fingerprint: '123abc456efg'
}
Shift4::Blacklist.create(blacklist_rule)
blacklist_rule_id = 'blr_number'
Shift4::Blacklist.retrieve(blacklist_rule_id)
blacklist_rule_id = 'blr_number'
Shift4::Blacklist.delete(blacklist_rule_id)
Shift4::Blacklist.list(deleted: true, limit: 100)
Please refer to detailed API docs (linked) for all available fields
- charges
- customers
- cards
- subscriptions
- plans
- events
- tokens
- blacklist
- checkoutRequest
- credits
- disputes
- fileUploads
- fraudWarnings
- paymentMethods
For further information, please refer to our official documentation at https://dev.shift4.com/docs.
Bug reports and pull requests are welcome on GitHub at https://github.com/shift4developer/shift4-ruby
After checking out the repo, run bundle setup
to install dependencies.
To run integration tests:
SECRET_KEY='sk_test_id' bundle exec rake spec:integration
To run style checks execute:
bundle exec rubocop