PHP code example of medboubazine / binance-pay

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

    

medboubazine / binance-pay example snippets



use Illuminate\Support\Carbon;
use Medboubazine\BinancePay\Binance;
use Medboubazine\BinancePay\Core\Resources\Credentials;
use Medboubazine\BinancePay\Core\Resources\Order;
use Medboubazine\BinancePay\Core\Resources\Product;
use Medboubazine\BinancePay\Core\Resources\Urls;

rminalType("WEB");
//
$order = new Order();
$order->setId("test" . time())
    ->setAmount("10.22")
    ->setCurrency("USDT")
    ->setAllowedCurrencies(["BUSD", "BNB"])
    ->setExpireTime($timestamp);
//
$product = new Product;
$product->setId("steam-test-gift-card")
    ->setType("01")
    ->setCategory("6000")
    ->setName("Steam test gift card");
//
$urls = new Urls();
$urls->setReturnUrl("https://www.domain.com/back")
    ->setCancelUrl("https://www.domain.com/cancel")
    ->setWebhookUrl("https://www.domain.com/webhook");
//Create link
$payment = $binance->getCheckoutUrl($credentials,  $order,  $product,  $urls);
//redirect
$payment->getCheckoutUrl();



use Medboubazine\BinancePay\Core\Resources\Credentials;

$credentials = new Credentials();
$credentials->setApiKey("your_api_key")
    ->setApiSecret("your_api_secret")
    ->setEnvTerminalType("WEB");

$status = $binance->checkWebhook($credentials);
$pay_id = $binance->getWebhookPayId();
$payment = $binance->getPayment($credentials, $pay_id);




use Medboubazine\BinancePay\Core\Resources\Credentials;

$credentials = new Credentials();
$credentials->setApiKey("your_api_key")
    ->setApiSecret("your_api_secret")
    ->setEnvTerminalType("WEB");

$payment = $binance->getPayment($credentials, "Order ID HERE");