This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup ActiveMerchant for development mode with Paypal Sandbox | |
config.after_initialize do | |
ActiveMerchant::Billing::Base.mode = :test | |
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new( | |
:login => '[Add PayPal API login here]', | |
:password => '[Add PayPal API password here]', | |
:signature => '[Add PayPal API signature here]' | |
) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/paypal/paypal_common_api' | |
require File.dirname(__FILE__) + '/paypal_express' | |
require File.dirname(__FILE__) + '/paypal/paypal_recurring_payments' # Add this line | |
module ActiveMerchant #:nodoc: | |
module Billing #:nodoc: | |
class PaypalGateway < Gateway | |
include PaypalCommonAPI | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveMerchant #:nodoc: | |
module Billing #:nodoc: | |
class PaypalGateway < Gateway | |
RECURRING_ACTIONS = Set.new([:add, :modify, :inquiry, :suspend, :reactivate, :cancel]) | |
# Creates a recurring profile | |
def create_recurring_profile(*args) #:nodoc: | |
request = build_recurring_request(:add, *args) | |
commit('CreateRecurringPaymentsProfile', request) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a ruby array of other state/province codes and corresponding abbreviations | |
# that are recognized by PayPal's API as of July 23, 2010 | |
@other_codes = [ | |
['American Samoa', 'AS'], | |
['Armed Forces', 'AE'], | |
['Armed Forces Americas', 'AA'], | |
['Armed Forces Pacific', 'AP'], | |
['Federated States of Micronesia', 'FM'], | |
['Guam', 'GU'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a ruby array of all Canadian provinces and corresponding abbreviations | |
# that are recognized by PayPal's API as of July 23, 2010 | |
@canada_province_codes = [ | |
['Alberta', 'AB'], | |
['British Columbia', 'BC'], | |
['Manitoba', 'MB'], | |
['New Brunswick', 'NB'], | |
['Newfoundland and Labrador', 'NL'], | |
['Northwest Territories', 'NT'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a ruby array of all U.S. states and corresponding abbreviations that are | |
# recognized by PayPal's API as of July 23, 2010 | |
@us_state_codes = [ | |
['Alabama', 'AL'], | |
['Alaska', 'AK'], | |
['Arizona', 'AZ'], | |
['Arkansas', 'AR'], | |
['California', 'CA'], | |
['Colorado', 'CO'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a ruby array of all 2-character IS0-3166-1 country/region codes used | |
# by PayPal's API as of July 23, 2010 | |
@country_codes = [ | |
['Afghanistan', 'AF'], | |
['Aland Islands', 'AX'], | |
['Albania', 'AL'], | |
['Algeria', 'DZ'], | |
['American Samoa', 'AS'], | |
['Andorra', 'AD'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveMerchant #:nodoc: | |
module Billing #:nodoc: | |
class PaypalGateway < Gateway | |
RECURRING_ACTIONS = Set.new([:add, :cancel, :inquiry, :suspend]) | |
@@API_VERSION = '50.0' | |
def recurring(money, credit_card, options = {}) | |
options[:name] = credit_card.name if options[:name].blank? && credit_card |
NewerOlder