Skip to content

Instantly share code, notes, and snippets.

@wehub
Created April 21, 2017 16:19
Show Gist options
  • Select an option

  • Save wehub/9bd78685fab72d83de967bb189e4558d to your computer and use it in GitHub Desktop.

Select an option

Save wehub/9bd78685fab72d83de967bb189e4558d to your computer and use it in GitHub Desktop.
# WePay Ruby SDK - http://git.io/a_c2uQ
require 'wepay'
# application settings
client_id = '123456789'
client_secret = '1a3b5c7d9'
use_stage = true
wepay = WePay::Client.new(client_id, client_secret, use_stage)
# Get the OAuth 2.0 authorization URL. Send the user to this URL to authorize
# the application, then they will return to your `redirect_uri` with a code as
# a GET parameter.
redirect_uri = "http://myexamplesite.com/wepay"
redirect_to(wepay.oauth2_authorize_url(redirect_uri))
# Once you have the OAuth 2.0 code, you can request an access token.
response = wepay.oauth2_token(code, redirect_uri)
access_token = response['access_token']
# display the response
p response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment