pixelearth
pixelearth

Reputation: 14630

How do I save a name with my customer payment profile via ActiveMerchant::AuthorizeNetCimGateway?

The UI on Authorize.net clearly has a place for name and address information, which I can add/edit manually.

enter image description here

But I can't figure out how to add name information with the card

enter image description here

according to:

enter image description here

But The Active Merchant source file doesn't seem to use anything but the card number, expiration date and card code, and the name info on the card is not sent over to Authorize.net.

enter image description here

Does anyone know how to do this?

Upvotes: 1

Views: 44

Answers (1)

pixelearth
pixelearth

Reputation: 14630

Ok, for posterity this is solved, use bill_to:

    def create_payment_profile
      response = GatewayService.gateway.create_customer_payment_profile(
        customer_profile_id: owner.gateway_profile,
        payment_profile: {
          bill_to: bill_to,
          payment: {
            credit_card: credit_card
          }
        }
      )
    end

    def gateway_card
      ActiveMerchant::Billing::CreditCard.new(
        verification_value: cvv,
        number:             credit_card_number,
        year:               "20#{year}",
        month:              month,
      )
    end

    def bill_to
      {
        first_name:         first_name,
        last_name:          last_name,
        #company: ,
        #address1: ,
        #address: ,
        #city: ,
        #state: ,
        #zip: ,
        #country: ,
        #phone_number: ,
        #fax_number: ,
        #customer_address_id: ,
      }
    end

Upvotes: 1

Related Questions