CardConnect API Ruby Client
Add this line to your application's Gemfile:
gem 'cardconnect'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cardconnect
For Rails in config/initializers/cardconnect.rb
NOTE: Merchant ID can also be passed in with params when building a request. If no ID is passed in then the request will use the ID from the configuration.
CardConnect.configure do |config|
config.merchant_id = '<merchant-id-number>'
config.api_username = '<api user id>'
config.api_password = '<api user password>'
config.endpoint = 'https://url.goeshere.com:6443'
end
You may pass additional options into the Faraday connection via connection_options
.
CardConnection.configure do |config|
config.connection_options = { ssl: your_ssl_options }
end
Note: We do not recommend setting verify: false
CardConnect documentation for this service can be found here: http://developer.cardconnect.com/cardconnect-api/#authorization-service
Example:
service = CardConnect::Service::Authorization.new
service.build_request(params)
response = service.submit
CardConnect documentation for this service can be found here: http://developer.cardconnect.com/cardconnect-api/#capture-service
Example:
service = CardConnect::Service::Capture.new
service.build_request(params)
response = service.submit
CardConnect documentation for this service can be found here: http://developer.cardconnect.com/cardconnect-api/#void-service
Example:
service = CardConnect::Service::Void.new
service.build_request(params)
response = service.submit
CardConnect documentation for this service can be found here: http://developer.cardconnect.com/cardconnect-api/#refund-service
Example:
service = CardConnect::Service::Refund.new
service.build_request(params)
response = service.submit
CardConnect documentation for this service can be found here: http://developer.cardconnect.com/cardconnect-api/#inquire-service
Example:
service = CardConnect::Service::Inquire.new
service.build_request(params)
response = service.submit
CardConnect documentation for this service can be found here: http://developer.cardconnect.com/cardconnect-api/#settlement-status-service
Example:
service = CardConnect::Service::SettlementStatus.new
service.build_request(params)
response = service.submit
CardConnect documentation for this service can be found here: https://developer.cardconnect.com/cardconnect-api/#profile-service
Example:
service = CardConnect::Service::Profile.new
service.build_request(params)
response = service.submit
CardConnect documentation for this service can be found here: https://developer.cardconnect.com/cardconnect-api#bin-service
Example:
service = CardConnect::Service::Bin.new
service.build_request(params)
response = service.submit
http://developer.cardconnect.com/cardconnect-api/#response-codes
Typically, you want to use config/initializers/cardconnect.rb
to set your API username and password details in a secure way, as detailed above. If you need to connect to multiple CardConnect accounts, you can specify the username/password immediately before processing a transaction.
Example:
config = CardConnect::Configuration.new
config.api_username = "username"
config.api_password = "password123"
config.endpoint = "https://url.com"
connection = CardConnect::Connection.new(config).connection
service = CardConnect::Service::Authorize.new(connection)
service.build_request(params)
response = service.submit
Username, password, and/or endpoint can be defined either in the CardConnect initializer or overridden at runtime.
- Support for custom descriptor fields
- Support for Card Present authorizations is untested
- Support 3D Secure processing
- Support for Level 3 data including items
- Funding Service needs to be implemented
- Signature Capture Service needs to be implemented
- Open Batch Service needs to be implemented
- Close Batch Service needs to be implemented
- Fork it ( https://github.com/mobilecause/cardconnect/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