Skip to content

Instantly share code, notes, and snippets.

@pioz
Created May 11, 2011 22:45
Show Gist options
  • Save pioz/967559 to your computer and use it in GitHub Desktop.
Save pioz/967559 to your computer and use it in GitHub Desktop.
Paypal express checkout setup purchase with options
require 'rubygems'
require 'activemerchant'
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
:login => 'xxx',
:password => 'yyy',
:signature => 'zzz'
}
::PAYPAL_EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)
response = PAYPAL_EXPRESS_GATEWAY.setup_purchase(1000,
:ip => '127.0.0.1',
:return_url => 'http://localhost:3000',
:cancel_return_url => 'http://localhost:3000',
:header_background_color => 'ff0000',
:email => 'pioz@pioz.it',
:allow_note => false,
:allow_guest_checkout => true,
:locale => 'IT',
:address => {
:name => 'Enrico',
:last_name => 'Pilotto',
:address1 => 'via fuck yeah 12',
:city => 'Padova',
:state => 'Padova',
:county => 'IT',
:zip => 35100,
:phone => '0499460022'
}
)
url = PAYPAL_EXPRESS_GATEWAY.redirect_url_for(response.token)
puts url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment