PHP code example of codeglen / laravel-binancepay

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

    

codeglen / laravel-binancepay example snippets


use Codeglen\BinancePay\Facades\BinancePay;

$response = BinancePay::createOrder([
    'merchantTradeNo' => 'ORDER-1001',
    'orderAmount' => 25.5,
    'currency' => 'USDT',
    'goods' => [
        'goodsType' => '01',
        'goodsCategory' => 'D000',
        'referenceGoodsId' => 'SKU-1001',
        'goodsName' => 'Starter Plan',
    ],
]);

$response = BinancePay::queryOrder('ORDER-1001');

use Codeglen\BinancePay\DTO\OrderData;
use Codeglen\BinancePay\Facades\BinancePay;

$order = new OrderData(
    merchantTradeNo: 'ORDER-1002',
    currency: 'USDT',
    goodsName: 'Pro Plan',
    goodsCategory: 'D000',
    referenceGoodsId: 'SKU-1002',
    totalFee: 1000, // smallest currency unit expected by your integration
    extra: ['returnUrl' => 'https://example.com/paid']
);

$response = BinancePay::createOrder($order);
bash
php artisan vendor:publish --tag=binancepay-config