Class: ActiveMerchant::Billing::SwipeCheckoutGateway
- Defined in:
- lib/active_merchant/billing/gateways/swipe_checkout.rb
Constant Summary collapse
- TRANSACTION_APPROVED_MSG =
'Transaction approved'
- TRANSACTION_DECLINED_MSG =
'Transaction declined'
- LIVE_URLS =
{ 'NZ' => 'https://api.swipehq.com', 'CA' => 'https://api.swipehq.ca' }
- TRANSACTION_API =
'/createShopifyTransaction.php'
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SwipeCheckoutGateway
constructor
Swipe Checkout requires the merchant’s email and API key for authorization.
-
#purchase(money, creditcard, options = {}) ⇒ Object
Transfers funds immediately.
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ SwipeCheckoutGateway
Swipe Checkout requires the merchant’s email and API key for authorization. This can be found under Settings > API Credentials after logging in to your Swipe Checkout merchant console at merchant.swipehq.[com|ca]
:region determines which Swipe URL is used, this can be one of “NZ” or “CA”. Currently Swipe Checkout has New Zealand and Canadian domains (swipehq.com and swipehq.ca respectively). Merchants must use the region that they signed up in for authentication with their merchant ID and API key to succeed.
32 33 34 35 |
# File 'lib/active_merchant/billing/gateways/swipe_checkout.rb', line 32 def initialize( = {}) requires!(, :login, :api_key, :region) super end |
Instance Method Details
#purchase(money, creditcard, options = {}) ⇒ Object
Transfers funds immediately. Note that Swipe Checkout only supports purchase at this stage
39 40 41 42 43 44 45 46 47 |
# File 'lib/active_merchant/billing/gateways/swipe_checkout.rb', line 39 def purchase(money, creditcard, = {}) post = {} add_invoice(post, ) add_creditcard(post, creditcard) add_customer_data(post, creditcard, ) add_amount(post, money, ) commit('sale', money, post) end |