Ryan Florence
Ryan Florence

Reputation: 13483

Authorize.net Parameters with activemerchant

I'm using authorize.net and activemerchant in a rails app.

When I make a purchase authorize.net sends back an email with information about the purchase. I should be able to send them the billing and shipping address information and have that returned in the email, but it's not returning any of the information, obviously I've got the varable names wrong, anybody know what they should be? I've been pouring over the authorize.net api docs and activemerchant's but can't find what I need.

My purchase method on an orders model looks like this:

def purchase
  purchase_options = {
    :ip                   => ip_address,
    :first_name           => first_name,
    :last_name            => last_name,
    :address              => billing_street_address,
    :city                 => billing_city,
    :state                => billing_state,
    :country               => "US",
    :zip                  => billing_zip,
    :ship_to_first_name   => first_name,
    :ship_to_last_name    => last_name,
    :ship_to_address      => shipping_street_address,
    :ship_to_city         => shipping_city,
    :ship_to_state        => shipping_state,
    :ship_to_country      => "US",
    :ship_to_zip          => shipping_zip
  }
response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)
# other transaction stuff
response.success?

end

Upvotes: 1

Views: 1012

Answers (2)

John Conde
John Conde

Reputation: 219894

The billing address variables are: x_first_name, x_last_name, x_company, x_address, x_city, x_state, x_zip, x_country, x_phone, x_fax

The shipping variables are: x_ship_to_first_name, x_ship_to_last_name, x_ship_to_company, x_ship_to_address, x_ship_to_city, x_ship_to_state, x_ship_to_zip, x_ship_to_country

You can omit any you do not wish to provide as they are all optional.

You can find these in the AIM Guide on pages 21 - 25.

Upvotes: 1

Byron Whitlock
Byron Whitlock

Reputation: 53921

Install fiddler and look at the raw response you are getting back. authorize.net should give you some hints on what is wrong.

Upvotes: 0

Related Questions