Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save wehub/2260fb47f472371a927c3ebc00d5f29f to your computer and use it in GitHub Desktop.
// WePay PHP SDK - http://git.io/mY7iQQ
require 'wepay.php';
// oauth2 parameters
<span class="variable">$code</span> = $_GET['code']; // the code parameter from step 2
<span class="variable">$redirect_uri</span> = "http://www.example.com/oauth2_redirect_uri"; // this is the redirect_uri you used in step 1
// application settings
<span class="variable">$client_id</span> = 123456789;
<span class="variable">$client_secret</span> = "1a3b5c7d9";
// change to useProduction for live environments
Wepay::useStaging($client_id, $client_secret);
$wepay = new WePay(NULL); // we don't have an access_token yet so we can pass NULL here
// create an account for a user
$response = WePay::getToken($code, $redirect_uri);
// display the response
print_r($response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment