class ActiveMerchant::Billing::PayArcGateway

Constants

FAILURE_STATUS
STANDARD_ACTIONS
STANDARD_ERROR_CODE_MAPPING
SUCCESS_STATUS

Public Class Methods

new(options = {}) click to toggle source

The gateway must be configured with Bearer token.

:api_key PAYARC’s Bearer token must be passsed to initialise the gateway.

Calls superclass method ActiveMerchant::Billing::Gateway::new
# File lib/active_merchant/billing/gateways/pay_arc.rb, line 51
def initialize(options = {})
  requires!(options, :api_key)
  super
end

Public Instance Methods

authorize(money, creditcard, options = {}) click to toggle source

Authorize the payment API through PAYARC.

:money A positive integer in cents representing how much to charge. The minimum amount is 50c USD.

:creditcard CreditCard object with card details.

:options Other information like address, card source etc can be passed in options

Options

  • :card_source – Source of payment (REQUIRED) ( INTERNET, SWIPE, PHONE, MAIL, MANUAL )

  • :currency – Three-letter ISO currency code, in lowercase (REQUIRED)

  • :card_holder_name –Name of the Card Holder (OPTIONAL)

  • :address_line1 – Set in payment method’s billing address (OPTIONAL)

  • :address_line2 – Set in payment method’s billing address (OPTIONAL)

  • :state – State (OPTIONAL)

  • :country Country (OPTIONAL)

  • :statement_description – An arbitrary string to be displayed on your costomer’s credit card statement. This may be up to 22 characters. (OPTIONAL)

  • :card_level – Commercial card level - “LEVEL2” OR “LEVEL3” (OPTIONAL)

  • :sales_tax – A positive integer in cents representing sales tax. (OPTIONAL)

  • :terminal_id – Optional terminal id. (OPTIONAL)

  • :tip_amount – A positive integer in cents representing tip amount. (OPTIONAL)

  • :sales_tax – Applicable for LEVEL2 or LEVEL3 Charge. A positive integer in cents representing sales tax. (REQUIRED for LEVEL2 0r LEVEL3)

  • :purchase_order – Applicable for Level2 or Level3 Charge. The value used by the customer to identify an order. Issued by the buyer to the seller. (REQUIRED for LEVEL2 0r LEVEL3)

  • :order_date – Applicable for Level2 Charge for AMEX card only or Level3 Charge. The date the order was processed. Format: Alphanumeric and Special Character |Min Length=0 Max Length=10|Allowed format: MM/DD/YYYY For example: 12/01/2016

  • :customer_ref_id – Applicable for Level2 Charge for AMEX card only or Level3 Charge. The reference identifier supplied by the Commercial Card cardholder. Format: Alphanumeric and Special Character |Min Length=0 Max Length=17| a-z A-Z 0-9 Space <>

  • :ship_to_zip – Applicable for Level2 Charge for AMEX card only or Level3 Charge. The postal code for the address to which the goods are being shipped. Format: Alphanumeric |Min Length=2 Max Length=10

  • :amex_descriptor – Applicable for Level2 Charge for AMEX card only. The value of the Transaction Advice Addendum field, displays descriptive information about a transactions on a customer’s AMEX card statement. Format: Alphanumeric and Special Character |Min Length=0 Max Length=40|a-z A-Z 0-9 Space <>

  • :supplier_reference_number – Applicable for Level2 Charge for AMEX card only or Level3 charge. The value used by the customer to identify an order. Issued by the buyer to the seller.

  • :tax_amount – Applicable for Level3 Charge. The tax amount. Format: Numeric|Max Length=12|Allowed characters: 0-9 .(dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value.

  • :tax_category – Applicable for Level3 Charge. The type of tax. Formerly established through TaxCategory messages. Allowed values: SERVICE, DUTY, VAT, ALTERNATE, NATIONAL, TAX_EXEMPT

  • :customer_vat_number – Applicable for Level3 Charge. Indicates the customer’s government assigned tax identification number or the identification number assigned to their purchasing company by the tax authorities. Format: Alphanumeric and Special Character|Min Length=0 Max Length=13| a-z A-Z 0-9 Space <>

  • :summary_commodity_code – Applicable for Level3 Charge. The international description code of the overall goods or services being supplied. Format: Alphanumeric and Special Character |Min Length=0 Max Length=4|Allowed character: a-z A-Z 0-9 Space <>

  • :shipping_charges – Applicable for Level3 Charge. The dollar amount for shipping or freight charges applied to a product or transaction. Format: Numeric |Max Length=12|Allowed characters: 0-9 .(dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value.

  • :duty_charges – Applicable for Level3 Charge. Indicates the total charges for any import or export duties included in the order. Format: Numeric |Max Length=12|Allowed characters: 0-9 . (dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value.

  • :ship_from_zip – Applicable for Level3 Charge. The postal code for the address to which the goods are being shipped. Format: Alphanumeric |Min Length=2 Max Length=10

  • :destination_country_code – Applicable for Level3 Charge. The destination country code indicator. Format: Alphanumeric.

  • :tax_type – Applicable for Level3 Charge. The type of tax. For example, VAT, NATIONAL, Service Tax. Format: Alphanumeric and Special Character

  • :vat_invoice – Applicable for Level3 Charge. The Value Added Tax (VAT) invoice number associated with the transaction. Format: Alphanumeric and Special Character |Min Length=0 Max Length=15|Allowed character: a-z A-Z 0-9 Space <>

  • :tax_rate – Applicable for Level3 Charge. The type of tax rate. This field is used if taxCategory is not used. Default sale tax rate in percentage Must be between 0.1% - 22% ,Applicable only Level 2 AutoFill. Format: Decimal Number |Max Length=4|Allowed characters: 0-9 .(dot) Allowed range: 0.01 - 100

  • :email – Customer’s email address.

# File lib/active_merchant/billing/gateways/pay_arc.rb, line 150
def authorize(money, creditcard, options = {})
  options[:capture] = '0'
  MultiResponse.run do |r|
    r.process { token(creditcard, options) }
    r.process { charge(money, r.authorization, options) }
  end
end
capture(money, tx_reference, options = {}) click to toggle source

Capture the payment of an existing, uncaptured, charge. This is the second half of the two-step payment flow, where first you created / authorized a charge with the capture option set to false.

:money A positive integer in cents representing how much to charge. The minimum amount is 50c USD.

:tx_reference charge_id from previously created / authorized a charge

:options Other information like address, card source etc can be passed in options

# File lib/active_merchant/billing/gateways/pay_arc.rb, line 169
def capture(money, tx_reference, options = {})
  post = {}
  add_money(post, money, options)
  action = "#{STANDARD_ACTIONS[:capture][:end_point]}/#{tx_reference}/capture"
  post = filter_gateway_fields(post, options, STANDARD_ACTIONS[:capture][:allowed_fields])
  commit(action, post)
end
credit(money, creditcard, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/pay_arc.rb, line 213
def credit(money, creditcard, options = {})
  post = {}
  add_money(post, money, options)
  add_creditcard(post, creditcard, options)
  add_address(post, options)
  add_phone(post, options)
  post['receipt_email'] = options[:email] if options[:email]
  action = STANDARD_ACTIONS[:credit][:end_point]
  post = filter_gateway_fields(post, options, STANDARD_ACTIONS[:credit][:allowed_fields])
  commit(action, post)
end
purchase(money, creditcard, options = {}) click to toggle source

Purchase API through PAYARC.

:money A positive integer in cents representing how much to charge. The minimum amount is 50c USD.

:creditcard CreditCard object with card details.

:options Other information like address, card source etc can be passed in options

Options

  • :card_source – Source of payment (REQUIRED) ( INTERNET, SWIPE, PHONE, MAIL, MANUAL )

  • :currency – Three-letter ISO currency code, in lowercase (REQUIRED)

  • :card_holder_name –Name of the Card Holder (OPTIONAL)

  • :address_line1 – Set in payment method’s billing address (OPTIONAL)

  • :address_line2 – Set in payment method’s billing address (OPTIONAL)

  • :state – State (OPTIONAL)

  • :country Country (OPTIONAL)

  • :statement_description – An arbitrary string to be displayed on your costomer’s credit card statement. This may be up to 22 characters. (OPTIONAL)

  • :card_level – Commercial card level - “LEVEL2” OR “LEVEL3” (OPTIONAL)

  • :sales_tax – A positive integer in cents representing sales tax. (OPTIONAL)

  • :terminal_id – Optional terminal id. (OPTIONAL)

  • :tip_amount – A positive integer in cents representing tip amount. (OPTIONAL)

  • :sales_tax – Applicable for LEVEL2 or LEVEL3 Charge. A positive integer in cents representing sales tax. (REQUIRED for LEVEL2 0r LEVEL3)

  • :purchase_order – Applicable for Level2 or Level3 Charge. The value used by the customer to identify an order. Issued by the buyer to the seller. (REQUIRED for LEVEL2 0r LEVEL3)

  • :order_date – Applicable for Level2 Charge for AMEX card only or Level3 Charge. The date the order was processed. Format: Alphanumeric and Special Character |Min Length=0 Max Length=10|Allowed format: MM/DD/YYYY For example: 12/01/2016

  • :customer_ref_id – Applicable for Level2 Charge for AMEX card only or Level3 Charge. The reference identifier supplied by the Commercial Card cardholder. Format: Alphanumeric and Special Character |Min Length=0 Max Length=17| a-z A-Z 0-9 Space <>

  • :ship_to_zip – Applicable for Level2 Charge for AMEX card only or Level3 Charge. The postal code for the address to which the goods are being shipped. Format: Alphanumeric |Min Length=2 Max Length=10

  • :amex_descriptor – Applicable for Level2 Charge for AMEX card only. The value of the Transaction Advice Addendum field, displays descriptive information about a transactions on a customer’s AMEX card statement. Format: Alphanumeric and Special Character |Min Length=0 Max Length=40|a-z A-Z 0-9 Space <>

  • :supplier_reference_number – Applicable for Level2 Charge for AMEX card only or Level3 charge. The value used by the customer to identify an order. Issued by the buyer to the seller.

  • :tax_amount – Applicable for Level3 Charge. The tax amount. Format: Numeric|Max Length=12|Allowed characters: 0-9 .(dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value.

  • :tax_category – Applicable for Level3 Charge. The type of tax. Formerly established through TaxCategory messages. Allowed values: SERVICE, DUTY, VAT, ALTERNATE, NATIONAL, TAX_EXEMPT

  • :customer_vat_number – Applicable for Level3 Charge. Indicates the customer’s government assigned tax identification number or the identification number assigned to their purchasing company by the tax authorities. Format: Alphanumeric and Special Character|Min Length=0 Max Length=13| a-z A-Z 0-9 Space <>

  • :summary_commodity_code – Applicable for Level3 Charge. The international description code of the overall goods or services being supplied. Format: Alphanumeric and Special Character |Min Length=0 Max Length=4|Allowed character: a-z A-Z 0-9 Space <>

  • :shipping_charges – Applicable for Level3 Charge. The dollar amount for shipping or freight charges applied to a product or transaction. Format: Numeric |Max Length=12|Allowed characters: 0-9 .(dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value.

  • :duty_charges – Applicable for Level3 Charge. Indicates the total charges for any import or export duties included in the order. Format: Numeric |Max Length=12|Allowed characters: 0-9 . (dot) Note: If a decimal point is included, the amount reflects a dollar value. If a decimal point is not included, the amount reflects a cent value.

  • :ship_from_zip – Applicable for Level3 Charge. The postal code for the address to which the goods are being shipped. Format: Alphanumeric |Min Length=2 Max Length=10

  • :destination_country_code – Applicable for Level3 Charge. The destination country code indicator. Format: Alphanumeric.

  • :tax_type – Applicable for Level3 Charge. The type of tax. For example, VAT, NATIONAL, Service Tax. Format: Alphanumeric and Special Character

  • :vat_invoice – Applicable for Level3 Charge. The Value Added Tax (VAT) invoice number associated with the transaction. Format: Alphanumeric and Special Character |Min Length=0 Max Length=15|Allowed character: a-z A-Z 0-9 Space <>

  • :tax_rate – Applicable for Level3 Charge. The type of tax rate. This field is used if taxCategory is not used. Default sale tax rate in percentage Must be between 0.1% - 22% ,Applicable only Level 2 AutoFill. Format: Decimal Number |Max Length=4|Allowed characters: 0-9 .(dot) Allowed range: 0.01 - 100

  • :email – Customer’s email address sent with payment method.

# File lib/active_merchant/billing/gateways/pay_arc.rb, line 99
def purchase(money, creditcard, options = {})
  options[:capture] = 1
  MultiResponse.run do |r|
    r.process { token(creditcard, options) }
    r.process { charge(money, r.authorization, options) }
  end
end
refund(money, tx_reference, options = {}) click to toggle source

Refund full / partial payment of an successful charge / capture / purchase.

:money A positive integer in cents representing how much to charge. The minimum amount is 50c USD.

:tx_reference charge_id from previously created / authorized a charge

:options Other information like address, card source etc can be passed in options

# File lib/active_merchant/billing/gateways/pay_arc.rb, line 205
def refund(money, tx_reference, options = {})
  post = {}
  add_money(post, money, options)
  action = STANDARD_ACTIONS[:refund][:end_point].gsub(/{{charge_id}}/, tx_reference)
  post = filter_gateway_fields(post, options, STANDARD_ACTIONS[:refund][:allowed_fields])
  commit(action, post)
end
verify(creditcard, options = {}) click to toggle source

Verify the creditcard API through PAYARC.

:creditcard CreditCard object with card details.

:options Other information like address, card source etc can be passed in options

Options

  • :card_source – Source of payment (REQUIRED) ( INTERNET, SWIPE, PHONE, MAIL, MANUAL )

  • :card_holder_name –Name of the Card Holder (OPTIONAL)

  • :address_line1 – Set in payment method’s billing address (OPTIONAL)

  • :address_line2 – Set in payment method’s billing address (OPTIONAL)

  • :state – State (OPTIONAL)

  • :country Country (OPTIONAL)

# File lib/active_merchant/billing/gateways/pay_arc.rb, line 241
def verify(creditcard, options = {})
  token(creditcard, options)
end
void(tx_reference, options = {}) click to toggle source

Voids the transaction / charge.

:tx_reference charge_id from previously created charge

:options Other information like address, card source etc can be passed in options

Options

  • :reason – Reason for voiding transaction (REQUIRED) ( requested_by_customer, duplicate, fraudulent, other )

# File lib/active_merchant/billing/gateways/pay_arc.rb, line 188
def void(tx_reference, options = {})
  post = {}
  post['reason'] = options[:reason]
  action = STANDARD_ACTIONS[:void][:end_point].gsub(/{{chargeID}}/, tx_reference)
  post = filter_gateway_fields(post, options, STANDARD_ACTIONS[:void][:allowed_fields])
  commit(action, post)
end