stripe-p

Please complete the following instructions:

Copy the generated “Secret Key” below into “API Credentials”.

( “API Credentials” is located in the admin menu of your site under “Store Settings” / “Payments”, scroll down to “Stripe Settings” )

[insert_php]
define(‘CLIENT_ID’, ‘ca_85uhMuo2MEmKUREpdEzOMr6WlmjvmSAC’);
define(‘API_KEY’, ‘pk_live_4ifVH8Hgf4GunX5MwXYRj3Yv’);

define(‘TOKEN_URI’, ‘https://connect.stripe.com/oauth/token’);
define(‘AUTHORIZE_URI’, ‘https://connect.stripe.com/oauth/authorize’);

if (isset($_GET[‘code’])) { // Redirect w/ code
$code = $_GET[‘code’];

$token_request_body = array(
‘client_secret’ => ‘sk_live_50K3BW3zcgZHgEwvOmWOFtLO’,
‘grant_type’ => ‘authorization_code’,
‘client_id’ => ‘ca_85uhMuo2MEmKUREpdEzOMr6WlmjvmSAC’,
‘code’ => $code,
);

$req = curl_init(TOKEN_URI);
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($req, CURLOPT_POST, true );
curl_setopt($req, CURLOPT_POSTFIELDS, http_build_query($token_request_body));

// TODO: Additional error handling
$respCode = curl_getinfo($req, CURLINFO_HTTP_CODE);
$resp = json_decode(curl_exec($req), true);
curl_close($req);

echo $resp[‘access_token’];
} else if (isset($_GET[‘error’])) { // Error
echo $_GET[‘error_description’];
} else { // Show OAuth link
$authorize_request_body = array(
‘response_type’ => ‘code’,
‘scope’ => ‘read_write’,
‘client_id’ => ‘ca_85uhMuo2MEmKUREpdEzOMr6WlmjvmSAC’
);

$url = AUTHORIZE_URI . ‘?’ . http_build_query($authorize_request_body);
echo “Connect with Stripe“;
}

[/insert_php]

 

Copy your “Publishable Key” to the same location.

( “Publishable Key” is found within your Stripe Account. )

Be sure to click “Save Changes”