Skip to content

Instantly share code, notes, and snippets.

@seanmc2
seanmc2 / create_account_example_php
Created August 19, 2016 22:49
Creating an account using PHP
<?php
// WePay PHP SDK - http://git.io/mY7iQQ
require 'wepay.php';
// application settings
<span class="variable">$client_id</span> = 123456789;
<span class="variable">$client_secret</span> = "1a3b5c7d9";
<span class="variable">$access_token</span> = "1a3b5c7d9";
// change to useProduction for live environments
@seanmc2
seanmc2 / create_account_example_ruby
Last active August 19, 2016 21:27
Creating an account using Ruby
# WePay Ruby SDK - http://git.io/a_c2uQ
require 'wepay'
# application settings
<span class="variable">client_id</span> = 123456789
<span class="variable">client_secret</span> = '1a3b5c7d9'
<span class="variable">access_token</span> = '1a3b5c7d9'
# set _use_stage to false for live environments
wepay = WePay::Client.new(client_id, client_secret, _use_stage = true)
@seanmc2
seanmc2 / access_token_response
Created August 19, 2016 20:51
Access token response
{
"user_id":123456,
"access_token":"1a2b3c4d5e6f",
"token_type":"BEARER"
}
@seanmc2
seanmc2 / oauth2_auth_token
Created August 19, 2016 17:11
Oauth2 Auth Token
https://stage.wepayapi.com/v2/oauth2/token?
client_id=[your client id]
&<strong>redirect_uri=[your redirect uri]
&client_secret=[your client secret]
&code=[code you got in the previous step]
@seanmc2
seanmc2 / auth_code_response
Created August 19, 2016 16:34
Oauth2 Authorization Code Resonse
http://example.com/setup?<strong>code</strong>=1a2b3c4d5e6f
@seanmc2
seanmc2 / oauth2_authorize_call
Created August 19, 2016 15:33
Get an Oauth2 Token
https://stage.wepay.com/v2/oauth2/authorize?
client_id=[your client id]
&redirect_uri=[your redirect uri]]
&scope<=[the permissions you want]
@seanmc2
seanmc2 / curl_sample_userAPI_result
Created August 18, 2016 19:04
Sample cURL user api response
{
"first_name":"Bob",
"last_name": "Smith",
"email":"bob@smith.com",
"state":"registered"
}
@seanmc2
seanmc2 / curl_sample_userAPI_call
Created August 18, 2016 19:02
Sample cURL /user call
<?php
$access_token = 'token'; // access_token received from /oauth2/token call
$ch = curl_init('https://stage.wepayapi.com/v2/user'); // URL of the call
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array("Authorization: Bearer $access_token"));
// execute the api call
$result = curl_exec($ch);
// display the json response
@seanmc2
seanmc2 / API_Version_update_python
Created August 17, 2016 16:04
API version update with python
# WePay Python SDK - http://git.io/v7Y1jA
from wepay import WePay
# set production to True for live environments
PRODUCTION = False
# set API Version. Change this to the API Version you want to use.
API_VERSION = "2016-08-10"
wepay = WePay(PRODUCTION, ACCESS_TOKEN, API_VERSION)
@seanmc2
seanmc2 / API_Version_update_ruby
Last active August 16, 2016 17:07
API update ruby example
# WePay Ruby SDK - http://git.io/a_c2uQ
require 'wepay'
# set API Version. Change this to the API Version you want to use.
API_VERSION = "2016-08-10"
wepay = WePay.new(<YOUR_CLIENT_ID, YOUR_CLIENT_SECRET, API_VERSION)
# create the checkout
response = wepay.call('/account', ACCESS_TOKEN, {