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

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb', line 81

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