Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.98 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         include('./wepay.php');
  2.         $wePay = new WePay();
  3.         $wePay->useStaging($client_id, $client_secret);  //connects properly on other pages
  4.  
  5. try {
  6.         $checkout = $wepay->request('/checkout/create', array(
  7.                         'account_id' => $account_id, // ID properly pulled from DB
  8.                         'amount' => 100, //dollar amount you want to charge the user
  9.                         'short_description' => "this is a test payment",
  10.                         'type' => "PERSONAL",
  11.                         'app_fee'=>'5.5',
  12.                         'redirect_uri'=> $redirect_uri,
  13.                         'mode' => "regular"
  14.                 )
  15.         );
  16. } catch (WePayException $e) { // if the API call returns an error, get the error message for display later
  17.         $error = $e->getMessage();
  18. }
  19.  
  20. //////////////////////////////////////////////////////////////////////////////////////////////////////
  21. ////redirect_uri page
  22.                 if(!empty($_GET['error']) and !empty($_GET['code']))
  23. {
  24.                 $info = $wePay->getToken($_GET['code'], $redirect_uri);
  25.                 if ($info) {
  26.                        
  27.                         $checkoutID = $info->checkout_id;                      
  28.                         $checkoutURI = $info->checkout_uri;    
  29. }
  30. }