Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save wehub/e3e0f50687a3a31f656285f64fb8200e to your computer and use it in GitHub Desktop.
# WePay Ruby SDK - http://git.io/a_c2uQ
require 'wepay'
# application settings
account_id = 123456789
client_id = 9543125
client_secret = '1a3b5c7d9'
access_token = 'STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20'
# set _use_stage to false for live environments
wepay = WePay::Client.new(client_id, client_secret, _use_stage = true)
# create the pre-approval
response = wepay.call('/preapproval/create', access_token, {
:account_id => account_id,
:period => 'once',
:amount => '19.99',
:mode => 'regular',
:short_description => 'A pledge for the awesome project',
:redirect_uri => 'http://example.com/success/'
})
# display the response
p response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment