FirstApiClient

Installation

Install the gem

gem install first_api_client

(for development, run gem install --dev first_api_client to install the development dependencies)

Then add the gem to your Gemfile:

gem 'first_api_client', '~> 1.0.0'

Install from Git

Add the following in the Gemfile:

gem 'swagger_client', :git => 'https://github.com/GBSEcom/Ruby.git'

Getting Started

# Load the gem
require 'swagger_client'
require 'simple_client'

api_key = "Your API Key here"
api_secret = "Your API Secret here"

credentials = SimpleClient::MerchantCredentials.new(api_key, api_secret)

gateway = SimpleClient::Gateway.create(credentials)

payload =   "{ 
                \"amount\":{
                    \"currency\":\"USD\",
                    \"total\":\"12.10\"
                },
                \"paymentMethod\":{
                    \"paymentCard\":{
                        \"expiryDate\":{
                            \"month\":\"12\",
                            \"year\":\"21\"
                        },
                        \"number\":\"5500000000000004\"
                    },
                    \"type\":\"PAYMENT_CARD\"
                },
                \"transactionType\":\"SALE\"
            }"
result = gateway.primary_payment_transaction(payload)
p JSON.generate(result.to_hash)

Documentation for API Endpoints

All URIs are relative to https://cert.api.firstdata.com/gateway

Class Method HTTP request Description
SwaggerClient::AuthenticationApi v1_authentication_access_tokens_post POST /v1/authentication/access-tokens Generate an access token for user authentication
SwaggerClient::OrderApi perform_payment_post_authorisation POST /v1/orders/order-id/postauth Use this to capture/complete a transaction. Partial postauths are allowed.
SwaggerClient::OrderApi return_transaction POST /v1/orders/order-id/return Use this to return/refund on the order. Partial returns are allowed.
SwaggerClient::PaymentApi perform_payment_post_authorisation POST /v1/payments/transaction-id/postauth Use this to capture/complete a transaction. Partial postauths are allowed.
SwaggerClient::PaymentApi primary_payment_transaction POST /v1/payments Generate a primary transaction
SwaggerClient::PaymentApi return_transaction POST /v1/payments/transaction-id/return Return/refund a transaction.
SwaggerClient::PaymentApi transaction_inquiry GET /v1/payments/transaction-id Retrieve the state of a transaction
SwaggerClient::PaymentApi void_transaction POST /v1/payments/transaction-id/void Reverse a previous action on an existing transaction

Documentation for Models