Created
April 21, 2017 16:38
-
-
Save wehub/ca777c50a1047243b2e8b9002f4bd9dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # WePay Ruby SDK - http://git.io/a_c2uQ | |
| require 'wepay' | |
| # application settings | |
| account_id = 123456789 # the merchant's account_id | |
| client_id = 9543125 | |
| client_secret = '1a3b5c7d9' | |
| access_token = 'STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20' # the merchant's access_token | |
| preapproval_id = '12345' # the preapproval_id from step 1 | |
| # set _use_stage to false for live environments | |
| wepay = WePay::Client.new(client_id, client_secret, _use_stage = true) | |
| # create the checkout | |
| response = wepay.call('/checkout/create', access_token, { | |
| :account_id => account_id, | |
| :amount => '19.99', | |
| :currency => 'USD', | |
| :short_description => 'Payment for test project', | |
| :type => 'goods', | |
| :payment_method => { | |
| :type => 'preapproval', | |
| :preapproval => { | |
| :id => preapproval_id | |
| } | |
| } | |
| }) | |
| # display the response | |
| p response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment