Method: ActiveMerchant::Billing::PaypalCommonAPI#initialize

Defined in:
lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb

#initialize(options = {}) ⇒ Object

The gateway must be configured with either your PayPal PEM file or your PayPal API Signature. Only one is required.

:pem The text of your PayPal PEM file. Note

this is not the path to file, but its
contents. If you are only using one PEM
file on your site you can declare it
globally and then you won't need to
include this option

:signature The text of your PayPal signature.

If you are only using one API Signature
on your site you can declare it
globally and then you won't need to
include this option


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb', line 72

def initialize(options = {})
  requires!(options, :login, :password)

  headers = {'X-PP-AUTHORIZATION' => options.delete(:auth_signature), 'X-PAYPAL-MESSAGE-PROTOCOL' => 'SOAP11'} if options[:auth_signature]
  options = {
    :pem => pem_file,
    :signature => signature,
    :headers => headers || {}
  }.update(options)


  if options[:pem].blank? && options[:signature].blank?
    raise ArgumentError, "An API Certificate or API Signature is required to make requests to PayPal"
  end

  super(options)
end