Coder Social home page Coder Social logo

paypal-permissions's Introduction

Paypal Permissions

Ruby implementation of the PayPal Permissions API.

Please visit PayPal's Permissions Service API developer forums for questions about the Permissions API.

Example

Step 1: Direct the user to the "Grant Permissions" on PayPal

paypal = PayPal::Permissions::Paypal.new( userid, password, signature, application_id, :production )
request_data = paypal.request_permissions(
  [:express_checkout, :direct_payment, :auth_capture, :refund, :transaction_details],
  'http://localhost/callback_url'
)

# Send the browser to :permissions_url to grant permission to your application
redirect_to request_data[:permissions_url]

Step 2: Lookup result to get the final permission token

paypal = PayPal::Permissions::Paypal.new( userid, password, signature, application_id, :production )
token_data = paypal.get_access_token( params['token'], params['verifier'] )

# Save token_data[:token] and token_data[:token_secret]

Step 3: Make API calls with the X-PP-AUTHORIZATION header

Use the :token and :token_secret, along with your own API credentials, to create the X-PP-AUTHORIZATION header.

signature = paypal.generate_signature(api_key, secret, token, token_secret, 'POST', 'https://api.paypal.com/nvp')
header = { 'X-PP-AUTHORIZATION' => signature }

Lookup granted permissions

scopes = paypal.lookup_permissions paypal_token

Cancel granted permissions

paypal.cancel_permissions paypal_token

Available Permissions

:express_checkout
:direct_payment
:settlement_consolidation
:settlement_reporting
:auth_capture
:mobile_checkout
:billing_agreement
:reference_transaction
:air_travel
:mass_pay
:transaction_details
:transaction_search
:recurring_payments
:account_balance
:encrypted_website_payments
:refund
:non_referenced_credit
:button_manager
:manage_pending_transaction_status
:recurring_payment_report
:extended_pro_processing_report
:exception_processing_report
:account_management_permission

Copyright

Copyright (c) 2011 Recurly. MIT License

Original version by Isaac Hall.

paypal-permissions's People

Contributors

isaachall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

paypal-permissions's Issues

uninitialized constant Paypal

Installing the gem gives the following error:

~/.rvm/gems/ruby-1.9.3-p286@nfc/gems/paypal-permissions-0.2.0/lib/paypal/permissions/version.rb:1:in `<top (required)>': uninitialized constant Paypal (NameError)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.