-
Notifications
You must be signed in to change notification settings - Fork 66
Home
Craig Christenson edited this page Oct 26, 2012
·
3 revisions
This library provides developers with a simple set of bindings to the 2Checkout purchase routine, Instant Notification Service and Back Office API.
To use, download or clone the repository.
git clone https://github.com/2checkout/2checkout-php.git
Require in your php script.
require_once("/path/to/2checkout-php/lib/Twocheckout.php");
JSON is returned by default or you can add 'array' as an additional argument to each call to get an Array.
Full documentation for each binding can be accessed from the sidebar.
Example Request:
<?php
Twocheckout::setCredentials("APIuser1817037", "APIpass1817037");
$args = array(
'sale_id' => 4753371371,
'category' => 1,
'comment' => 'Order never sent.'
);
$result = Twocheckout_Sale::refund($args, 'array');
print_r($result);
Example Response:
Array
(
[response_code] => OK
[response_message] => refund added to invoice
)
Example Request:
<?php
$args = array(
'sid' => 532001,
'cart_order_id' => 'Example Cart ID',
'total' => '1.00'
);
Twocheckout_Charge::redirect($args);
Example Request:
<?php
$params = array();
foreach ($_REQUEST as $k => $v) {
$params[$k] = $v;
}
$passback = Twocheckout_Return::check($params, "tango", 'array');
Example Response:
Array
(
[response_code] => Success
[response_message] => Hash Matched
)
Example Request:
<?php
$params = array();
foreach ($_POST as $k => $v) {
$params[$k] = $v;
}
$passback = Twocheckout_Notification::check($params, "tango", 'array');
Example Response:
Array
(
[response_code] => Success
[response_message] => Hash Matched
)
Full documentation for each binding can be accessed from the sidebar.
Please feel free to contact 2Checkout directly for assistance with your integration.