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