CityPay API Client for Ruby

CityPayApiClient - the Ruby gem for the CityPay Payment API Build Status

This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts.

Compliance and Security

Your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council. These include

  • Data must be collected using TLS version 1.2 using strong cryptography. We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program.
  • The application must not store sensitive card holder data (CHD) such as the card security code (CSC) or primary access number (PAN)
  • The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation
  • If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations
  • You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from https://www.pcisecuritystandards.org/
  • The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.

This SDK is automatically generated by the OpenAPI Generator project:

Installation

Build a gem

To build the Ruby code into a gem:

gem build citypay_api_client.gemspec

Then either install the gem locally:

gem install ./citypay_api_client-1.1.1.gem

(for development, run gem install --dev ./citypay_api_client-1.1.1.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'citypay_api_client', '~> 1.1.1'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/citypay/citypay-api-client-ruby, then add the following in the Gemfile:

gem 'citypay_api_client', :git => 'https://github.com/citypay/citypay-api-client-ruby.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'citypay_api_client'

# Setup authorization
CityPayApiClient.configure do |config|
  config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
end

api_instance = CityPayApiClient::AuthorisationAndPaymentApi.new
auth_request = CityPayApiClient::AuthRequest.new({amount: 3600, cardnumber: '4000 0000 0000 0002', expmonth: 9, expyear: 2025, identifier: '95b857a1-5955-4b86-963c-5a6dbfc4fb95', merchantid: 11223344}) # AuthRequest | 

begin
  #Authorisation
  result = api_instance.authorisation_request(auth_request)
  p result
rescue CityPayApiClient::ApiError => e
  puts "Exception when calling AuthorisationAndPaymentApi->authorisation_request: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://api.citypay.com

Class Method HTTP request Description
CityPayApiClient::AuthorisationAndPaymentApi authorisation_request POST /v6/authorise Authorisation
CityPayApiClient::AuthorisationAndPaymentApi bin_range_lookup_request POST /v6/bin Bin Lookup
CityPayApiClient::AuthorisationAndPaymentApi c_res_request POST /v6/cres CRes
CityPayApiClient::AuthorisationAndPaymentApi capture_request POST /v6/capture Capture
CityPayApiClient::AuthorisationAndPaymentApi pa_res_request POST /v6/pares PaRes
CityPayApiClient::AuthorisationAndPaymentApi refund_request POST /v6/refund Refund
CityPayApiClient::AuthorisationAndPaymentApi retrieval_request POST /v6/retrieve Retrieval
CityPayApiClient::AuthorisationAndPaymentApi void_request POST /v6/void Void
CityPayApiClient::BatchProcessingApi batch_process_request POST /v6/batch/process Batch Process Request
CityPayApiClient::BatchProcessingApi batch_report_request POST /v6/batch/retrieve BatchReportRequest
CityPayApiClient::BatchProcessingApi check_batch_status_request POST /v6/batch/status CheckBatchStatus
CityPayApiClient::CardHolderAccountApi account_card_delete_request DELETE /v6/account/accountid/card/cardId Card Deletion
CityPayApiClient::CardHolderAccountApi account_card_register_request POST /v6/account/accountid/register Card Registration
CityPayApiClient::CardHolderAccountApi account_card_status_request POST /v6/account/accountid/card/cardId/status Card Status
CityPayApiClient::CardHolderAccountApi account_change_contact_request POST /v6/account/accountid/contact Contact Details Update
CityPayApiClient::CardHolderAccountApi account_create POST /v6/account/create Account Create
CityPayApiClient::CardHolderAccountApi account_delete_request DELETE /v6/account/accountid Account Deletion
CityPayApiClient::CardHolderAccountApi account_exists_request GET /v6/account-exists/accountid Account Exists
CityPayApiClient::CardHolderAccountApi account_retrieve_request GET /v6/account/accountid Account Retrieval
CityPayApiClient::CardHolderAccountApi account_status_request POST /v6/account/accountid/status Account Status
CityPayApiClient::CardHolderAccountApi charge_request POST /v6/charge Charge
CityPayApiClient::DirectPostApi direct_c_res_auth_request POST /direct/cres/auth/uuid Handles a CRes response from ACS, returning back the result of authorisation
CityPayApiClient::DirectPostApi direct_c_res_tokenise_request POST /direct/cres/tokenise/uuid Handles a CRes response from ACS, returning back a token for future authorisation
CityPayApiClient::DirectPostApi direct_post_auth_request POST /direct/auth Direct Post Auth Request
CityPayApiClient::DirectPostApi direct_post_tokenise_request POST /direct/tokenise Direct Post Tokenise Request
CityPayApiClient::DirectPostApi token_request POST /direct/token Direct Post Token Request
CityPayApiClient::OperationalFunctionsApi acl_check_request POST /v6/acl/check ACL Check Request
CityPayApiClient::OperationalFunctionsApi domain_key_check_request POST /dk/check Domain Key Check Request
CityPayApiClient::OperationalFunctionsApi domain_key_gen_request POST /dk/gen Domain Key Generation Request
CityPayApiClient::OperationalFunctionsApi list_merchants_request GET /v6/merchants/clientid List Merchants Request
CityPayApiClient::OperationalFunctionsApi ping_request POST /v6/ping Ping Request
CityPayApiClient::PaylinkApi token_adjustment_request POST /paylink/token/adjustment Paylink Token Adjustment
CityPayApiClient::PaylinkApi token_close_request PUT /paylink/token/close Close Paylink Token
CityPayApiClient::PaylinkApi token_create_bill_payment_request POST /paylink/bill-payment Create Bill Payment Paylink Token
CityPayApiClient::PaylinkApi token_create_request POST /paylink/create Create Paylink Token
CityPayApiClient::PaylinkApi token_purge_attachments_request PUT /paylink/token/purge-attachments Purges any attachments for a Paylink Token
CityPayApiClient::PaylinkApi token_reconciled_request PUT /paylink/token/reconciled Reconcile Paylink Token
CityPayApiClient::PaylinkApi token_reopen_request PUT /paylink/token/reopen Reopen Paylink Token
CityPayApiClient::PaylinkApi token_status_changes_request POST /paylink/token/changes Paylink Token Audit
CityPayApiClient::PaylinkApi token_status_request GET /paylink/token/status Paylink Token Status

Documentation for Models

Documentation for Authorization

cp-api-key

  • Type: API key
  • API key parameter name: cp-api-key
  • Location: HTTP header

cp-domain-key

  • Type: API key
  • API key parameter name: cp-domain-key
  • Location: URL query string