PHP code example of tradeprint / tradeprint-php-sdk
1. Go to this page and download the library: Download tradeprint/tradeprint-php-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tradeprint / tradeprint-php-sdk example snippets
try {
$tradeprint = new Tradeprint\TradeprintSDK('YOUR_TP_USERNAME', 'YOUR_TP_PASSWORD', 'sandbox');
$orderService = $tradeprint->getOrderService();
$result = $orderService->getOrder('YOUR_ORDER_REFERENCE');
$order = $result->toArray();
echo 'Got order => '.print_r($order, true);
} catch (Tradeprint\TpAuthorizationException $e) {
echo 'Invalid username or password';
} catch (Tradeprint\TPException $e) {
echo 'Error getting order ' . $e->getMessage() . PHP_EOL;
print_r($e->getDetails());
}
composer