PHP code example of oxialink / oxialink-php

1. Go to this page and download the library: Download oxialink/oxialink-php 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/ */

    

oxialink / oxialink-php example snippets


use Oxialink\OxialinkClient;

$oxialink = new OxialinkClient('API_KEY', 'API_SECRET');

$invoice = $oxialink->createInvoice([
    'amount' => 10,                 // in fiat_currency, or in the coin with amount_type => 'crypto'
    'fiat_currency' => 'USD',
    'coin' => 'USDT_TON',
    'external_id' => 'order-1234',  // echoed back in every webhook
    'callback_url' => 'https://your-site.com/webhook.php',
]);

header('Location: ' . $invoice['url']); // hosted checkout with QR + live confirmations

use Oxialink\Webhook;

$delivery = Webhook::verifyCurrentRequest('WEBHOOK_SECRET'); // throws on bad signature

if ($delivery['event'] === 'payment.completed') {
    markOrderPaid($delivery['data']['external_id'], $delivery['data']['tx_hash']);
}
bash
composer