Guest User

Untitled

a guest
Nov 18th, 2017
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. require_once("lib/Twocheckout.php");
  2.  
  3. Twocheckout::privateKey('privatekey'); //Private Key
  4.  
  5. Twocheckout::sellerId('sellerid'); // 2Checkout Account Number
  6.  
  7. // If you want to turn off SSL verification (Please don't do this in your production environment)
  8.  
  9. Twocheckout::verifySSL(false); // this is set to true by default
  10. // To use your sandbox account set sandbox to true
  11. Twocheckout::sandbox(true);
  12. // All methods return an Array by default or you can set the format to 'json' to get a JSON response.
  13.  
  14. Twocheckout::format('json');
  15.  
  16. try {
  17. $charge = Twocheckout_Charge::auth(array(
  18. "merchantOrderId" => "123",
  19. "token" => $_POST['token'],
  20. "currency" => 'USD',
  21. "total" => '10.00',
  22. "billingAddr" => array(
  23. "name" => 'Joe Flagster',
  24. "addrLine1" => '123 Main Street',
  25. "city" => 'Townsville',
  26. "state" => 'OH',
  27. "zipCode" => '43206',
  28. "country" => 'USA',
  29. "email" => 'testingemail@gmail.com',
  30. "phoneNumber" => '555-555-5555'
  31. )
  32. ));
  33.  
  34. if ($charge['response']['responseCode'] == 'APPROVED') {
  35. echo "Thanks for your Order!";
  36. echo "<h3>Return Parameters:</h3>";
  37. echo "<pre>";
  38. print_r($charge);
  39. echo "</pre>";
  40.  
  41. }
  42. } catch (Twocheckout_Error $e) {
  43. print_r($e->getMessage());
  44. }
  45.  
  46. Twocheckout::verifySSL(false);
  47.  
  48. require_once("lib/Twocheckout.php");
  49.  
  50. // Your username and password are required to make any Admin API call.
  51. Twocheckout::username('username');
  52. Twocheckout::password('password');
  53.  
  54. Twocheckout::verifySSL(false);
Add Comment
Please, Sign In to add comment