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'
- TRANSACTION_API =
'/createShopifyTransaction.php'
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, 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
#add_field_to_post_if_present, #add_fields_to_post_if_present, card_brand, #card_brand, #generate_unique_id, inherited, #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.
29 30 31 32 |
# File 'lib/active_merchant/billing/gateways/swipe_checkout.rb', line 29 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
36 37 38 39 40 41 42 43 44 |
# File 'lib/active_merchant/billing/gateways/swipe_checkout.rb', line 36 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 |