Skip to content

Instantly share code, notes, and snippets.

@wehub
Created April 21, 2017 19:43
Show Gist options
  • Select an option

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

Select an option

Save wehub/6b09c67e34762467e64be99b03b9dea1 to your computer and use it in GitHub Desktop.
<?php
// WePay PHP SDK - http://git.io/mY7iQQ
require 'wepay.php';
// application settings
$account_id = 123456789; // your app's account_id
$client_id = 123456789;
$client_secret = "1a3b5c7d9";
$access_token = "STAGE_8a19aff55b85a436dad5cd1386db1999437facb5914b494f4da5f206a56a5d20"; // your app's access_token
// change to useProduction for live environments
Wepay::useStaging($client_id, $client_secret);
$wepay = new WePay($access_token);
// create the checkout
$response = $wepay->request('checkout/create', array(
'account_id' => $account_id,
'amount' => '50.00',
'currency' => 'USD',
'short_description' => 'Purchase from John Smith\'s Website',
'type' => 'goods',
'hosted_checkout' => array(
'require_shipping' => true,
'shipping_fee' => '1.00',
'redirect_uri' => 'http://www.example.com/payment_success'
),
'fee' => array(
'app_fee' => '2.50',
'fee_payer' => 'payee'
),
'email_message' => array(
'to_payer' => 'Items<BR>Ron Santo 1969 - $20.00<BR>Ernie Banks 1970 - $30.00<br>Tax - $2.50<br>Total: $50.00',
'to_payee' => 'Items<BR>Ron Santo 1969 - $20.00<BR>Ernie Banks 1970 - $30.00<br>Tax - $2.50<br>Total: $50.00'
)
));
// display the response
print_r($response);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment