Permissions SDK

The PayPal Permission SDK provides Ruby APIs for developers to request and obtain permissions from merchants and consumers, to execute APIs on behalf of them. The permissions include variety of operations from processing payments to accessing account transaction history.


Add this line to your application's Gemfile:

gem 'paypal-sdk-permissions'

And then execute:

$ bundle

Or install it yourself as:

$ gem install paypal-sdk-permissions


For Rails application:

rails g paypal:sdk:install

For other ruby application, create a configuration file(config/paypal.yml):

development: &default
  password: WX4WTU3S8MY44S7F
  signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
  app_id: APP-80W284485P519543T
  http_timeout: 30
  mode: sandbox
  # # with certificate
  # cert_path: "config/cert_key.pem"
  # # with token authentication
  # token: ESTy2hio5WJQo1iixkH29I53RJxaS0Gvno1A6.YQXZgktxbY4I2Tdg
  # token_secret: ZKPhUYuwJwYsfWdzorozWO2U9pI
  # # with Proxy
  # http_proxy: http://proxy-ipaddress:3129/
  # # with device ip address
  # device_ipaddress: ""
  <<: *default
  <<: *default
  mode: live

Load Configurations from specified file:

PayPal::SDK::Core::Config.load('config/paypal.yml',  ENV['RACK_ENV'] || 'development')


Request permission:

require 'paypal-sdk-permissions'

  :mode      => "sandbox",  # Set "live" for production
  :app_id    => "APP-80W284485P519543T",
  :username  => "",
  :password  => "WX4WTU3S8MY44S7F",
  :signature => "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy" })

@api =

# Build request object
@request_permissions = @api.build_request_permissions({
  :callback => "http://localhost:3000/samples/permissions/get_access_token" })

# Make API call & get response
@response = @api.request_permissions(@request_permissions)

# Access Response
if @response.success?
  @api.grant_permission_url(@response) # Redirect url to grant permissions

Make API call with token and token_secret:

@api ={
   :token => "3rMSi3kCmK1Q3.BKxkH29I53R0TRLrSuCO..l8AMOAFM6cQhPTTrfQ",
   :token_secret => "RuE1j8RNRlSuL5T-PSSpVWLvOlI" })

@response = @api.get_basic_personal_data({
  :attributeList => {
    :attribute => [ "" ] } })

For more samples

Samples App

Add following line in rails Gemfile:

gem 'paypal-sdk-permissions'
gem 'permissions_samples', :git => "", :group => :development

Configure routes(config/routes.rb):

mount PermissionsSamples::Engine => "/samples" if Rails.env.development?

To get default paypal configuration execute:

rails g paypal:sdk:install

Run rails server and check the samples.