Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivabudh/1306747 to your computer and use it in GitHub Desktop.
Save sivabudh/1306747 to your computer and use it in GitHub Desktop.
PaypalExpressController checkout
class PaypalExpressController < ApplicationController
before_filter :assigns_gateway
include ActiveMerchant::Billing
include PaypalExpressHelper
def checkout
total_as_cents, setup_purchase_params = get_setup_purchase_params @cart, request
setup_response = @gateway.setup_purchase(total_as_cents, setup_purchase_params)
redirect_to @gateway.redirect_url_for(setup_response.token)
end
private
def assigns_gateway
@gateway ||= PaypalExpressGateway.new(
:login => PaypalLogin.login,
:password => PaypalLogin.password,
:signature => PaypalLogin.signature,
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment