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( = {}) requires!(, :login, :password) headers = {'X-PP-AUTHORIZATION' => .delete(:auth_signature), 'X-PAYPAL-MESSAGE-PROTOCOL' => 'SOAP11'} if [:auth_signature] = { :pem => pem_file, :signature => signature, :headers => headers || {} }.update() if [:pem].blank? && [:signature].blank? raise ArgumentError, "An API Certificate or API Signature is required to make requests to PayPal" end super() end |