class AuthorizeNet::CIM::Transaction

The CIM transaction class.

Public Class Methods

new(api_login_id, api_transaction_key, options = {}) click to toggle source

Constructs a CIM transaction. You can use the new CIM transaction object to issue a request to the payment gateway and parse the response into a new AuthorizeNet::CIM::Response object.

api_login_id

Your API login ID, as a string.

api_transaction_key

Your API transaction key, as a string.

options

A hash of options. See below for values.

Options

gateway

The gateway to submit the transaction to. Can be a URL string, an AuthorizeNet::CIM::Transaction::Gateway constant, or one of the convenience symbols :sandbox, :test, :production, or :live (:test is an alias for :sandbox, and :live is an alias for :production).

verify_ssl

A boolean indicating if the SSL certificate of the gateway should be verified. Defaults to true.

reference_id

A string that can be used to identify a particular transaction with its response. Will be echo'd in the response, only if it was provided in the transaction. Defaults to nil.

Calls superclass method AuthorizeNet::XmlTransaction::new
# File lib/authorize_net/cim/transaction.rb, line 31
def initialize(api_login_id, api_transaction_key, options = {})
  super
  @delim_char = ','
  @encap_char = nil
  @custom_fields = {}
end

Public Instance Methods

create_address(address, profile_id) click to toggle source

Sets up and submits a createCustomerShippingAddressRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The response object will have a address_id if the request was successful.

address

An AuthorizeNet::Address object describing the profile to create.

profile_id

Takes either a String containing the ID of the CustomerProfile who will own this Address, or a CustomerProfile object with the ID populated.

Typical usage:

address = AuthorizeNet::Address.new(:first_name => 'Jane', :last_name => 'Doe', :address => '123 Fake St', :city => 'Raccoon Junction', :state => 'WY', :zip => '99999')
response = transaction.create_address(address, '123456')
puts response.address_id if response.success?
# File lib/authorize_net/cim/transaction.rb, line 315
def create_address(address, profile_id)
  @type = Type::CIM_CREATE_ADDRESS
  @fields.merge!(address.to_hash)
  handle_profile_id(profile_id)
  make_request
end
create_payment_profile(payment_profile, profile_id, options = {}) click to toggle source

Sets up and submits a createCustomerPaymentProfileRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The response object will have a payment_profile_id if the request was successful.

profile

An AuthorizeNet::CIM::PaymentProfile object describing the profile to create.

profile_id

Takes either a String containing the ID of the CustomerProfile who will own the PaymentProfile, or a CustomerProfile object with the ID populated.

options

An optional hash of options.

Options:

validation_mode

Set to :testMode, :liveMode or :none (the default) to indicate what sort of PaymentProfile validation to do (assuming a PaymentProfile is included with the CustomerProfile)

Typical usage:

credit_card = AuthorizeNet::CreditCard.new('4111111111111111', '0120')
payment_profile = AuthorizeNet::CIM::PaymentProfile.new(:payment_method => credit_card)
response = transaction.create_payment_profile(payment_profile, '123456')
puts response.payment_profile_id if response.success?
# File lib/authorize_net/cim/transaction.rb, line 200
def create_payment_profile(payment_profile, profile_id, options = {})
  options = @@create_payment_profile_option_defaults.merge(options)
  @type = Type::CIM_CREATE_PAYMENT
  @fields.merge!(payment_profile.to_hash)
  set_fields(:validation_mode => options[:validation_mode])
  handle_profile_id(profile_id)
  make_request
end
create_profile(profile, options = {}) click to toggle source

Sets up and submits a createCustomerProfileRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The response object will have a profile_id if the request was successful. If any PaymentProfiles or Addresses were included, you can find their IDs in the response objects payment_profile_ids and address_ids methods.

profile

An AuthorizeNet::CIM::CustomerProfile object describing the profile to create.

options

An optional hash of options.

Options:

validation_mode

Set to :testMode, :liveMode or :none (the default) to indicate what sort of PaymentProfile validation to do (assuming a PaymentProfile is included with the CustomerProfile)

Typical usage:

profile = AuthorizeNet::CIM::CustomerProfile.new(
  :email => 'test@example.com',
  :id => 'userassignedid'
)
response = transaction.create_profile(profile)
puts response.profile_id if response.success?
# File lib/authorize_net/cim/transaction.rb, line 97
def create_profile(profile, options = {})
  options = @@create_profile_option_defaults.merge(options)
  @type = Type::CIM_CREATE_PROFILE
  @fields.merge!(profile.to_hash)
  set_fields(:validation_mode => options[:validation_mode])
  make_request
end
create_transaction(type, amount, profile_id, payment_profile_id, order, options = {}) click to toggle source

Sets up and submits a createCustomerProfileTransactionRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. It is recommend to use the connivence methods for each type of payment transaction rather than this method.

type

The type of payment transaction to run. Can be :auth_capture, :auth_only, :prior_auth_capture, :void, or :refund.

amount

The amount of the transaction. This is required for every transaction type except :void.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns the PaymentProfile to be charged, or a CustomerProfile object with the ID populated.

payment_profile_id

Takes either a String containing the ID of the PaymentProfile you want to charge, or a PaymentProfile object with the ID populated.

order

An Order object describing the order that this payment transaction is for. Pass nil for no order.

options

An optional hash of options.

Options:

address_id

Takes either a String containing the ID of an Address, or an Address object with the ID populated. Used as the shipping address for the payment transaction. Defaults to nil.

split_tender_id

A split tender transaction ID as a string. If the transaction is to be part of a split tender batch, this must be included. Defaults to nil.

aim_options

A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.

custom_fields

A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.

Typical usage:

response = transaction.create_transaction(:auth_capture, 10.00, '123456', '654321', nil)
if response.success?
  puts response.direct_response if direct_response.success?
# File lib/authorize_net/cim/transaction.rb, line 406
def create_transaction(type, amount, profile_id, payment_profile_id, order, options = {})
  @type = Type::CIM_CREATE_TRANSACTION
  options = @@create_transaction_option_defaults.merge(options)
  handle_profile_id(profile_id)
  handle_payment_profile_id(payment_profile_id)
  handle_address_id(options[:address_id]) unless options[:address_id].nil?
  set_fields(:split_tender_id => options[:split_tender_id])
  @transaction_type = type
  @fields.merge!(order.to_hash) unless order.nil?
  set_fields(:amount => amount)
  handle_aim_options(options[:aim_options])
  handle_custom_fields(options[:custom_fields])
  make_request
end
create_transaction_auth_capture(amount, profile_id, payment_profile_id, order = nil, options = {}) click to toggle source

Sets up and submits an AUTHORIZE_AND_CAPTURE transaction using stored payment information. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

amount

The amount of the transaction.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns the PaymentProfile to be charged, or a CustomerProfile object with the ID populated.

payment_profile_id

Takes either a String containing the ID of the PaymentProfile you want to charge, or a PaymentProfile object with the ID populated.

order

An Order object describing the order that this payment transaction is for. Pass nil for no order.

options

An optional hash of options.

Options:

address_id

Takes either a String containing the ID of an Address, or an Address object with the ID populated. Used as the shipping address for the payment transaction. Defaults to nil.

split_tender_id

A split tender transaction ID as a string. If the transaction is to be part of a split tender batch, this must be included. Defaults to nil.

aim_options

A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.

custom_fields

A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.

Typical usage:

response = transaction.create_transaction_auth_capture(10.00, '123456', '654321', nil)
if response.success?
  puts response.direct_response if direct_response.success?
# File lib/authorize_net/cim/transaction.rb, line 444
def create_transaction_auth_capture(amount, profile_id, payment_profile_id, order = nil, options = {})
  create_transaction(:auth_capture, amount, profile_id, payment_profile_id, order, options)
end
create_transaction_auth_only(amount, profile_id, payment_profile_id, order = nil, options = {}) click to toggle source

Sets up and submits an AUTH_ONLY transaction using stored payment information. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

amount

The amount of the transaction.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns the PaymentProfile to be charged, or a CustomerProfile object with the ID populated.

payment_profile_id

Takes either a String containing the ID of the PaymentProfile you want to charge, or a PaymentProfile object with the ID populated.

order

An Order object describing the order that this payment transaction is for. Pass nil for no order.

options

An optional hash of options.

Options:

address_id

Takes either a String containing the ID of an Address, or an Address object with the ID populated. Used as the shipping address for the payment transaction. Defaults to nil.

split_tender_id

A split tender transaction ID as a string. If the transaction is to be part of a split tender batch, this must be included. Defaults to nil.

aim_options

A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.

custom_fields

A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.

Typical usage:

response = transaction.create_transaction_auth_only(10.00, '123456', '654321', nil)
if response.success?
  puts response.direct_response if direct_response.success?
# File lib/authorize_net/cim/transaction.rb, line 470
def create_transaction_auth_only(amount, profile_id, payment_profile_id, order = nil, options = {})
  create_transaction(:auth_only, amount, profile_id, payment_profile_id, order, options)
end
create_transaction_prior_auth_capture(transaction_id, amount, order = nil, options = {}) click to toggle source

Sets up and submits a PRIOR_AUTHORIZATION_AND_CAPTURE transaction using stored payment information. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

transaction_id

A string containing a transaction ID that was generated via an AUTH_ONLY transaction.

amount

The amount to capture. Must be <= the amount authorized via the AUTH_ONLY transaction.

order

An Order object describing the order that this payment transaction is for. Pass nil for no order.

options

An optional hash of options.

Options:

aim_options

A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.

custom_fields

A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.

Typical usage:

response = transaction.create_transaction_prior_auth_capture('111222', 10.00)
if response.success?
  puts response.direct_response if direct_response.success?
# File lib/authorize_net/cim/transaction.rb, line 493
def create_transaction_prior_auth_capture(transaction_id, amount, order = nil, options = {})
  handle_transaction_id(transaction_id)
  create_transaction(:prior_auth_capture, amount, nil, nil, order, options)
end
create_transaction_refund(transaction_id, amount, profile_id, payment_profile_id, order = nil, options = {}) click to toggle source

Sets up and submits a REFUND transaction using stored payment information. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

transaction_id

A string containing a transaction ID to refund. Pass nil for an unlinked refund.

amount

The amount to refund.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns the PaymentProfile to be credited, or a CustomerProfile object with the ID populated. Pass nil for an unlinked refund.

payment_profile_id

Takes either a String containing the ID of the PaymentProfile you want to credit, or a PaymentProfile object with the ID populated. Pass nil for an unlinked refund.

order

An Order object describing the order that is being refunded. Pass nil for no order.

options

An optional hash of options.

Options:

aim_options

A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.

custom_fields

A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.

Typical usage:

response = transaction.create_transaction_refund('111222', 10.00, '123456', '654321')
if response.success?
  puts response.direct_response if direct_response.success?
# File lib/authorize_net/cim/transaction.rb, line 541
def create_transaction_refund(transaction_id, amount, profile_id, payment_profile_id, order = nil, options = {})
  handle_transaction_id(transaction_id)
  create_transaction(:refund, amount, profile_id, payment_profile_id, order, options)
end
create_transaction_void(transaction_id, options = {}) click to toggle source

Sets up and submits a VOID transaction using stored payment information. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

transaction_id

A string containing a transaction ID to void.

options

An optional hash of options.

Options:

aim_options

A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.

custom_fields

A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.

Typical usage:

response = transaction.create_transaction_void('111222')
if response.success?
  puts response.direct_response if direct_response.success?
# File lib/authorize_net/cim/transaction.rb, line 515
def create_transaction_void(transaction_id, options = {})
  handle_transaction_id(transaction_id)
  create_transaction(:void, nil, nil, nil, nil, options)
end
delete_address(address_id, profile_id) click to toggle source

Sets up and submits a deleteCustomerShippingAddressRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

address_id

Takes either a String containing the ID of the Address you want to delete, or an Address object with the ID populated.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns this Address, or a CustomerProfile object with the ID populated.

Typical usage:

response = transaction.delete_address('654321', '123456')
puts response.success?
# File lib/authorize_net/cim/transaction.rb, line 375
def delete_address(address_id, profile_id)
  @type = Type::CIM_DELETE_ADDRESS
  handle_address_id(address_id)
  handle_profile_id(profile_id)
  make_request
end
delete_payment_profile(payment_profile_id, profile_id) click to toggle source

Sets up and submits a deleteCustomerPaymentProfileRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

payment_profile_id

Takes either a String containing the ID of the PaymentProfile you want to retrieve, or a PaymentProfile object with the ID populated.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns this PaymentProfile, or a CustomerProfile object with the ID populated.

Typical usage:

response = transaction.delete_profile('123456')
puts response.success?
# File lib/authorize_net/cim/transaction.rb, line 266
def delete_payment_profile(payment_profile_id, profile_id)
  @type = Type::CIM_DELETE_PAYMENT
  handle_payment_profile_id(payment_profile_id)
  handle_profile_id(profile_id)
  make_request
end
delete_profile(profile_id) click to toggle source

Sets up and submits a deleteCustomerProfileRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

profile_id

Takes either a String containing the ID of the CustomerProfile you want to delete, or a CustomerProfile object with the ID populated.

Typical usage:

response = transaction.delete_profile('123456')
puts response.success?
# File lib/authorize_net/cim/transaction.rb, line 152
def delete_profile(profile_id)
  @type = Type::CIM_DELETE_PROFILE
  handle_profile_id(profile_id)
  make_request
end
get_address(address_id, profile_id) click to toggle source

Sets up and submits a getCustomerShippingAddressRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The response object will have the Address object requested available via its address method if the request was successful.

address_id

Takes either a String containing the ID of the Address you want to retrieve, or an Address object with the ID populated.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns this Address, or a CustomerProfile object with the ID populated.

Typical usage:

response = transaction.get_address('654321', '123456')
address = response.address if response.success?
# File lib/authorize_net/cim/transaction.rb, line 336
def get_address(address_id, profile_id)
  @type = Type::CIM_GET_ADDRESS
  handle_address_id(address_id)
  handle_profile_id(profile_id)
  make_request
end
get_hosted_profile_token(profile_id, options = {}) click to toggle source

Sets up and submits a getHostedProfilePageRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

profile_id

Takes either a String containing the ID of the CustomerProfile you want to delete, or a CustomerProfile object with the ID populated.

Options:

return_url

Enter the URL for the page that the customer returns to when the hosted session ends. Do not pass this setting for iframes or popups.

return_url_text

Enter the text to display on the button that returns the customer to your web site. The value can be any text up to 200 characters. If you do not pass this parameter, the default button text is Continue. Do not pass this setting for iframes or popups.

heading_color

Enter a hex color string such as e0e0e0. The background color of the section headers changes from gray to a custom color.

border_visible

Enter true or false. Must be false for iframes or popups, and must be true for redirects.

iframe_communicator_url

Enter the URL to a page that can communicate with the merchant’s main page using javascript. This parameter enables you to dynamically change the size of the popup so that there are no scroll bars. This parameter is required only for iframe or lightbox applications.

validation_mode

Set to :testMode, :liveMode or :none (the default) to set hostedProfileValidationMode mode

# File lib/authorize_net/cim/transaction.rb, line 174
def get_hosted_profile_token(profile_id, options = {})
  options = @@get_hosted_profile_token_option_defaults.merge(options)
  @type = Type::CIM_GET_HOSTED_PROFILE
  handle_profile_id(profile_id)
  handle_hosted_profile_settings(options)
  make_request
end
get_payment_profile(payment_profile_id, profile_id) click to toggle source

Sets up and submits a getCustomerPaymentProfileRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The response object will have the PaymentProfile object requested available via its payment_profile method if the request was successful.

payment_profile_id

Takes either a String containing the ID of the PaymentProfile you want to retrieve, or a PaymentProfile object with the ID populated.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns this PaymentProfile, or a CustomerProfile object with the ID populated.

Typical usage:

response = transaction.get_payment_profile('654321', '123456')
payment_profile = response.payment_profile if response.success?
# File lib/authorize_net/cim/transaction.rb, line 222
def get_payment_profile(payment_profile_id, profile_id)
  @type = Type::CIM_GET_PAYMENT
  handle_payment_profile_id(payment_profile_id)
  handle_profile_id(profile_id)
  make_request
end
get_profile(profile_id) click to toggle source

Sets up and submits a getCustomerProfileRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The response object will have the CustomerProfile object requested available via its profile method if the request was successful.

profile_id

Takes either a String containing the ID of the CustomerProfile you want to retrieve, or a CustomerProfile object with the ID populated.

Typical usage:

response = transaction.get_profile('123456')
profile = response.profile if response.success?
# File lib/authorize_net/cim/transaction.rb, line 117
def get_profile(profile_id)
  @type = Type::CIM_GET_PROFILE
  handle_profile_id(profile_id)
  make_request
end
get_profile_ids() click to toggle source

Sets up and submits a getCustomerProfileIdsRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The response object will have a list of all CustomerProfile IDs available via its profile_ids method on success.

Typical usage:

response = transaction.get_profile_ids()
puts response.profile_ids if response.success?
# File lib/authorize_net/cim/transaction.rb, line 573
def get_profile_ids()
  @type = Type::CIM_GET_PROFILE_IDS
  make_request
end
update_address(address, profile_id) click to toggle source

Sets up and submits a updateCustomerShippingAddressRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

address

An Address object describing the address to update.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns this Address, or a CustomerProfile object with the ID populated.

Typical usage:

address.city = 'Somewhere Else'
response = transaction.update_address(address, '123456')
puts response.success?
# File lib/authorize_net/cim/transaction.rb, line 356
def update_address(address, profile_id)
  @type = Type::CIM_UPDATE_ADDRESS
  @fields.merge!(address.to_hash)
  handle_profile_id(profile_id)
  make_request
end
update_payment_profile(payment_profile, profile_id, options = {}) click to toggle source

Sets up and submits a updateCustomerPaymentProfileRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

payment_profile

An AuthorizeNet::CIM::PaymentProfile object describing the profile to update.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns this PaymentProfile, or a CustomerProfile object with the ID populated.

Typical usage:

payment_profile.cust_type = :business
response = transaction.update_payment_profile(payment_profile, '123456')
puts response.success?

Options:

validation_mode

Set to :testMode, :liveMode or :none (the default) to indicate what sort of PaymentProfile validation to do.

# File lib/authorize_net/cim/transaction.rb, line 245
def update_payment_profile(payment_profile, profile_id, options = {})
  options = @@create_payment_profile_option_defaults.merge(options)
  @type = Type::CIM_UPDATE_PAYMENT
  @fields.merge!(payment_profile.to_hash)
  set_fields(:validation_mode => options[:validation_mode])
  handle_profile_id(profile_id)
  make_request
end
update_profile(profile) click to toggle source

Sets up and submits a updateCustomerProfileRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. Note that any PaymentProfiles will NOT be updated using this method. This is a limitation of the CIM API. See update_payment_profile if you need to update a PaymentProfile.

profile

An AuthorizeNet::CIM::CustomerProfile object describing the profile to update. It must contain the customer_profile_id of the record to update.

Typical usage:

profile.fax = '5555551234'
response = transaction.update_profile(profile)
puts response.success?
# File lib/authorize_net/cim/transaction.rb, line 136
def update_profile(profile)
  @type = Type::CIM_UPDATE_PROFILE
  @fields.merge!(profile.to_hash)
  make_request
end
update_split_tender(split_tender_id, status) click to toggle source

Sets up and submits a updateSplitTenderGroupRequest transaction. Use this to end or void a split tender batch. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

split_tender_id

The split tender batch ID you want to change the status of.

status

The new status to set for the batch. Options are :voided or :completed.

Typical usage:

response = transaction.update_split_tender('1111111', :voided)
puts response if response.success?
# File lib/authorize_net/cim/transaction.rb, line 558
def update_split_tender(split_tender_id, status)
  @type = Type::CIM_UPDATE_SPLIT
  set_fields(:split_tender_id => split_tender_id, :split_tender_status => status.to_s)
  make_request
end
validate_payment_profile(payment_profile_id, profile_id, options = {}) click to toggle source

Sets up and submits a validateCustomerPaymentProfileRequest transaction. If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The results of the validation can be obtained via the direct_response method of the response object.

payment_profile_id

Takes either a String containing the ID of the PaymentProfile you want to validate, or a PaymentProfile object with the ID populated.

profile_id

Takes either a String containing the ID of the CustomerProfile who owns this PaymentProfile, or a CustomerProfile object with the ID populated.

Typical usage:

response = transaction.validate_payment_profile('654321', '123456')
puts response.direct_response.success? if response.success?

Options:

validation_mode

Set to :testMode (the default) or :liveMode to indicate what sort of PaymentProfile validation to do.

address_id

Set a shipping Address to be part of the validation transaction.

card_code

Set a CCV code if one is needed for validation. Defaults to nil.

# File lib/authorize_net/cim/transaction.rb, line 291
def validate_payment_profile(payment_profile_id, profile_id, options = {})
  @type = Type::CIM_VALIDATE_PAYMENT
  options = @@validate_payment_profile_option_defaults.merge(options)
  handle_payment_profile_id(payment_profile_id)
  handle_profile_id(profile_id)
  handle_address_id(options[:address_id]) unless options[:address_id].nil?
  set_fields(:validation_mode => options[:validation_mode])
  set_fields(:card_code => options[:card_code]) unless options[:card_code].nil?
  make_request
end