Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once("lib/Twocheckout.php");
- Twocheckout::privateKey('privatekey'); //Private Key
- Twocheckout::sellerId('sellerid'); // 2Checkout Account Number
- // If you want to turn off SSL verification (Please don't do this in your production environment)
- Twocheckout::verifySSL(false); // this is set to true by default
- // To use your sandbox account set sandbox to true
- Twocheckout::sandbox(true);
- // All methods return an Array by default or you can set the format to 'json' to get a JSON response.
- Twocheckout::format('json');
- try {
- $charge = Twocheckout_Charge::auth(array(
- "merchantOrderId" => "123",
- "token" => $_POST['token'],
- "currency" => 'USD',
- "total" => '10.00',
- "billingAddr" => array(
- "name" => 'Joe Flagster',
- "addrLine1" => '123 Main Street',
- "city" => 'Townsville',
- "state" => 'OH',
- "zipCode" => '43206',
- "country" => 'USA',
- "email" => 'testingemail@gmail.com',
- "phoneNumber" => '555-555-5555'
- )
- ));
- if ($charge['response']['responseCode'] == 'APPROVED') {
- echo "Thanks for your Order!";
- echo "<h3>Return Parameters:</h3>";
- echo "<pre>";
- print_r($charge);
- echo "</pre>";
- }
- } catch (Twocheckout_Error $e) {
- print_r($e->getMessage());
- }
- Twocheckout::verifySSL(false);
- require_once("lib/Twocheckout.php");
- // Your username and password are required to make any Admin API call.
- Twocheckout::username('username');
- Twocheckout::password('password');
- Twocheckout::verifySSL(false);
Add Comment
Please, Sign In to add comment