Created
May 11, 2011 22:45
-
-
Save pioz/967559 to your computer and use it in GitHub Desktop.
Paypal express checkout setup purchase with options
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 '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 => '[email protected]', | |
: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