Class ActiveMerchant::Billing::AuthorizeNetCimGateway
In: lib/active_merchant/billing/gateways/authorize_net_cim.rb
Parent: Gateway

Customer Information Manager (CIM)

The Authorize.Net Customer Information Manager (CIM) is an optional additional service that allows you to store sensitive payment information on Authorize.Net‘s servers, simplifying payments for returning customers and recurring transactions. It can also help with Payment Card Industry (PCI) Data Security Standard compliance, since customer data is no longer stored locally.

To use the AuthorizeNetCimGateway CIM must be enabled for your account.

Information about CIM is available on the Authorize.Net website. Information about the CIM API is available at the Authorize.Net Integration Center

Login and Password

The login and password are not the username and password you use to login to the Authorize.Net Merchant Interface. Instead, you will use the API Login ID as the login and Transaction Key as the password.

How to Get Your API Login ID and Transaction Key

  1. Log into the Merchant Interface
  2. Select Settings from the Main Menu
  3. Click on API Login ID and Transaction Key in the Security section
  4. Type in the answer to the secret question configured on setup
  5. Click Submit

Methods

Constants

AUTHORIZE_NET_CIM_NAMESPACE = 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
CIM_ACTIONS = { :create_customer_profile => 'createCustomerProfile', :create_customer_payment_profile => 'createCustomerPaymentProfile', :create_customer_shipping_address => 'createCustomerShippingAddress', :get_customer_profile => 'getCustomerProfile', :get_customer_payment_profile => 'getCustomerPaymentProfile', :get_customer_shipping_address => 'getCustomerShippingAddress', :delete_customer_profile => 'deleteCustomerProfile', :delete_customer_payment_profile => 'deleteCustomerPaymentProfile', :delete_customer_shipping_address => 'deleteCustomerShippingAddress', :update_customer_profile => 'updateCustomerProfile', :update_customer_payment_profile => 'updateCustomerPaymentProfile', :update_customer_shipping_address => 'updateCustomerShippingAddress', :create_customer_profile_transaction => 'createCustomerProfileTransaction', :validate_customer_payment_profile => 'validateCustomerPaymentProfile'
CIM_TRANSACTION_TYPES = { :auth_capture => 'profileTransAuthCapture', :auth_only => 'profileTransAuthOnly', :capture_only => 'profileTransCaptureOnly'
CIM_VALIDATION_MODES = { :none => 'none', :test => 'testMode', :live => 'liveMode'
BANK_ACCOUNT_TYPES = { :checking => 'checking', :savings => 'savings', :business_checking => 'businessChecking'
ECHECK_TYPES = { :ccd => 'CCD', :ppd => 'PPD'

Public Class methods

Creates a new AuthorizeNetCimGateway

The gateway requires that a valid API Login ID and Transaction Key be passed in the options hash.

Options

  • :login — The Authorize.Net API Login ID (REQUIRED)
  • :password — The Authorize.Net Transaction Key. (REQUIRED)
  • :testtrue or false. If true, perform transactions against the test server. Otherwise, perform transactions against the production server.

[Source]

    # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 93
93:       def initialize(options = {})
94:         requires!(options, :login, :password)
95:         @options = options
96:         super
97:       end

Public Instance methods

Creates a new customer payment profile for an existing customer profile.

Options

  • :customer_profile_id — The Customer Profile ID of the customer the payment profile will be added to. (REQUIRED)
  • :payment_profile — A hash containing the elements of the new payment profile (REQUIRED)

Payment Profile

  • :payment — A hash containing information on payment. Either :credit_card or :bank_account (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 125
125:       def create_customer_payment_profile(options)
126:         requires!(options, :customer_profile_id)
127:         requires!(options, :payment_profile)
128:         requires!(options[:payment_profile], :payment)
129:         
130:         request = build_request(:create_customer_payment_profile, options)
131:         commit(:create_customer_payment_profile, request)
132:       end

Creates a new customer profile along with any customer payment profiles and customer shipping addresses for the customer profile.

Returns a Response with the Customer Profile ID of the new customer profile in the authorization field. It is CRITICAL that you save this ID. There is no way to retrieve this through the API. You will not be able to create another Customer Profile with the same information.

Options

TODO

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 109
109:       def create_customer_profile(options)
110:         # TODO Add requires
111:         request = build_request(:create_customer_profile, options)
112:         commit(:create_customer_profile, request)
113:       end

Creates a new payment transaction from an existing customer profile

This is what is used to charge a customer whose information you have stored in a Customer Profile.

Returns a Response object that contains the result of the transaction in params[‘direct_response’]

Options

  • :transaction — A hash containing information on the transaction that is being requested. (REQUIRED)

Transaction

  • :type — The type of transaction. Can be either :auth_only, :capture_only, or :auth_capture. (REQUIRED)
  • :amount — The amount for the tranaction. Formatted with a decimal. For example "4.95" (REQUIRED)
  • :customer_profile_id — The Customer Profile ID of the customer to use in this transaction. (REQUIRED)
  • :customer_payment_profile_id — The Customer Payment Profile ID of the Customer Payment Profile to use in this transaction. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 316
316:       def create_customer_profile_transaction(options)
317:         requires!(options, :transaction)
318:         requires!(options[:transaction], :type, :amount, :customer_profile_id, :customer_payment_profile_id)
319: 
320:         request = build_request(:create_customer_profile_transaction, options)
321:         commit(:create_customer_profile_transaction, request)
322:       end

Creates a new customer shipping address for an existing customer profile.

Options

  • :customer_profile_id — The Customer Profile ID of the customer the payment profile will be added to. (REQUIRED)
  • :address — A hash containing the elements of the shipping address (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 140
140:       def create_customer_shipping_address(options)
141:         requires!(options, :customer_profile_id)
142:         requires!(options, :address)
143:         
144:         request = build_request(:create_customer_shipping_address, options)
145:         commit(:create_customer_shipping_address, request)
146:       end

Deletes a customer payment profile from an existing customer profile.

Options

  • :customer_profile_id — The Customer Profile ID of the customer with the payment profile to be deleted. (REQUIRED)
  • :customer_payment_profile_id — The Payment Profile ID of the payment profile to be deleted. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 166
166:       def delete_customer_payment_profile(options)
167:         requires!(options, :customer_profile_id)
168:         requires!(options, :customer_payment_profile_id)
169: 
170:         request = build_request(:delete_customer_payment_profile, options)
171:         commit(:delete_customer_payment_profile, request)
172:       end

Deletes an existing customer profile along with all associated customer payment profiles and customer shipping addresses.

Options

  • :customer_profile_id — The Customer Profile ID of the customer to be deleted. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 153
153:       def delete_customer_profile(options)
154:         requires!(options, :customer_profile_id)
155: 
156:         request = build_request(:delete_customer_profile, options)
157:         commit(:delete_customer_profile, request)
158:       end

Deletes a customer shipping address from an existing customer profile.

Options

  • :customer_profile_id — The Customer Profile ID of the customer with the payment profile to be deleted. (REQUIRED)
  • :customer_address_id — The Shipping Address ID of the shipping address to be deleted. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 180
180:       def delete_customer_shipping_address(options)
181:         requires!(options, :customer_profile_id)
182:         requires!(options, :customer_address_id)
183: 
184:         request = build_request(:delete_customer_shipping_address, options)
185:         commit(:delete_customer_shipping_address, request)
186:       end

Retrieve a customer payment profile for an existing customer profile.

Returns a Response whose params hash contains all the payment profile information. Sensitive information such as credit card numbers will be masked.

Options

  • :customer_profile_id — The Customer Profile ID of the customer with the payment profile to be retrieved. (REQUIRED)
  • :customer_payment_profile_id — The Payment Profile ID of the payment profile to be retrieved. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 211
211:       def get_customer_payment_profile(options)
212:         requires!(options, :customer_profile_id)
213:         requires!(options, :customer_payment_profile_id)
214: 
215:         request = build_request(:get_customer_payment_profile, options)
216:         commit(:get_customer_payment_profile, request)
217:       end

Retrieves an existing customer profile along with all the associated customer payment profiles and customer shipping addresses.

Returns a Response whose params hash contains all the profile information.

Options

  • :customer_profile_id — The Customer Profile ID of the customer to retrieve. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 195
195:       def get_customer_profile(options)
196:         requires!(options, :customer_profile_id)
197: 
198:         request = build_request(:get_customer_profile, options)
199:         commit(:get_customer_profile, request)
200:       end

Retrieve a customer shipping address for an existing customer profile.

Returns a Response whose params hash contains all the shipping address information.

Options

  • :customer_profile_id — The Customer Profile ID of the customer with the payment profile to be retrieved. (REQUIRED)
  • :customer_address_id — The Shipping Address ID of the shipping address to be retrieved. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 227
227:       def get_customer_shipping_address(options)
228:         requires!(options, :customer_profile_id)
229:         requires!(options, :customer_address_id)
230: 
231:         request = build_request(:get_customer_shipping_address, options)
232:         commit(:get_customer_shipping_address, request)
233:       end

Updates a customer payment profile for an existing customer profile.

Warning: if you do not provide a parameter in the :payment_profile hash, it is automatically set to nil at Authorize.Net. You will most likely want to first get the profile hash using get_customer_payment_profile and then only change the elements you wish to change.

Options

  • :customer_profile_id — The Customer Profile ID of the customer with the payment profile to be updated. (REQUIRED)
  • :payment_profile — A hash containing the values the Customer Payment Profile should be updated to. (REQUIRED)

Payment Profile

  • :customer_payment_profile_id — The Customer Payment Profile ID of the Customer Payment Profile to update. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 270
270:       def update_customer_payment_profile(options)
271:         requires!(options, :customer_profile_id, :payment_profile)
272:         requires!(options[:payment_profile], :customer_payment_profile_id)
273: 
274:         request = build_request(:update_customer_payment_profile, options)
275:         commit(:update_customer_payment_profile, request)
276:       end

Updates an existing customer profile.

Warning: if you do not provide a parameter in the :payment_profile hash, it is automatically set to nil at Authorize.Net. You will most likely want to first get the profile hash using get_customer_profile and then only change the elements you wish to change.

Options

  • :profile — A hash containing the values the Customer Profile should be updated to. (REQUIRED)

Profile

  • :customer_profile_id — The Customer Profile ID of the customer profile to update. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 248
248:       def update_customer_profile(options)
249:         requires!(options, :profile)
250:         requires!(options[:profile], :customer_profile_id)
251: 
252:         request = build_request(:update_customer_profile, options)
253:         commit(:update_customer_profile, request)
254:       end

Updates a customer shipping address for an existing customer profile.

Warning: if you do not provide a parameter in the :address hash, it is automatically set to nil at Authorize.Net. You will most likely want to first get the profile hash using get_customer_shipping_address and then only change the elements you wish to change.

Options

  • :customer_profile_id — The Customer Profile ID of the customer with the payment profile to be updated. (REQUIRED)
  • :address — A hash containing the values the Customer Shipping Address should be updated to. (REQUIRED)

Address

  • :customer_address_id — The Customer Address ID of the Customer Payment Profile to update. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 292
292:       def update_customer_shipping_address(options)
293:         requires!(options, :customer_profile_id, :address)
294:         requires!(options[:address], :customer_address_id)
295: 
296:         request = build_request(:update_customer_shipping_address, options)
297:         commit(:update_customer_shipping_address, request)
298:       end

Verifies an existing customer payment profile by generating a test transaction

Returns a Response object that contains the result of the transaction in params[‘direct_response’]

Options

  • :customer_profile_id — The Customer Profile ID of the customer to use in this transaction. (REQUIRED)
  • :customer_payment_profile_id — The Customer Payment Profile ID of the Customer Payment Profile to be verified. (REQUIRED)
  • :customer_address_id — The Customer Address ID of the Customer Shipping Address to be verified.
  • :validation_mode:live or :test In Test Mode, only field validation is performed. In Live Mode, a transaction is generated and submitted to the processor with the amount of $0.01. If successful, the transaction is immediately voided. (REQUIRED)

[Source]

     # File lib/active_merchant/billing/gateways/authorize_net_cim.rb, line 335
335:       def validate_customer_payment_profile(options)
336:         requires!(options, :customer_profile_id, :customer_payment_profile_id, :validation_mode)
337: 
338:         request = build_request(:validate_customer_payment_profile, options)
339:         commit(:validate_customer_payment_profile, request)
340:       end

[Validate]