1. Go to this page and download the library: Download inttegro/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/ */
use Inttegro\Client;
use Inttegro\ErrorReport;
$inttegro = new Client(
apiKey: getenv('INTTEGRO_API_KEY'),
errorReporter: static fn (ErrorReport $report) => $errorCollector->enqueue($report),
);
use Inttegro\Order\Order;
use Inttegro\Payment\Payment;
use Inttegro\Payment\Status as PaymentStatus;
use Inttegro\Product\Product;
use Inttegro\Product\Type as ProductType;
$order = $inttegro->orders->lookup($orderId);
$product = $inttegro->products->lookup($productId);
assert($order instanceof Order);
assert($product instanceof Product);
assert($order->payment === null || $order->payment instanceof Payment);
if ($order->payment?->status === PaymentStatus::Paid->value) {
// Fulfill the order.
}
if ($product->type === ProductType::Digital->value) {
// Deliver the digital product.
}