Method: AuthorizeNet::CreditCard#initialize

Defined in:
lib/authorize_net/payment_methods/credit_card.rb

#initialize(card_number, expiration, options = {}) ⇒ CreditCard

Constructs a new credit card object. Takes a credit card number and an expiration date. The CCV code can be passed as an option. So can the data tracks (1 & 2). When passing in data tracks, please pass the whole track. Sentinels and the LRC will be removed by the SDK. Track data must be passed along as ASCII. The raw bit stream from the card is not acceptable.

Field separators on

card_number

The credit card number as a string.

expiration

The credit card expiration date as a string with format MMYY.

options

A hash of options.

Options

card_code

Sets the CCV code for the credit card.

card_type

Sets the type of card (Visa, MasterCard, Dinners Club, etc.)

track_1

Sets the track 1 data. Either track 1 or track 2 data needs to be included for card present transactions (otherwise fee structure will change).

track_2

Sets the track 2 data. Either track 1 or track 2 data needs to be included for card present transactions (otherwise fee structure will change).



39
40
41
42
43
44
45
46
47
# File 'lib/authorize_net/payment_methods/credit_card.rb', line 39

def initialize(card_number, expiration, options = {})
  @card_number = card_number
  @expiration = expiration
  options = @@option_defaults.merge(options)
  @card_code = options[:card_code]
  @card_type = options[:card_type]
  @track_1 = options[:track_1]
  @track_2 = options[:track_2]
end