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

~~~~~ ruby 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], 'localhost/callback_url' )

Send the browser to :permissions_url to grant permission to your application

redirect_to request_data ~~~~~

Step 2: Lookup result to get the final permission token

~~~~~ ruby paypal = PayPal::Permissions::Paypal.new( userid, password, signature, application_id, :production ) token_data = paypal.get_access_token( params, params )

Save token_data and token_data

~~~~~

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.

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

Lookup granted permissions

~~<s>~ ruby scopes = paypal.lookup_permissions paypal_token </s>~~~

Cancel granted permissions

~~<s>~ ruby paypal.cancel_permissions paypal_token </s>~~~

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 © 2011 Recurly. MIT License

Original version by Isaac Hall.