Skip to content

Medboubazine/binance-pay-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Install

composer require medboubazine/binance-pay

How To Use

  • Redirect
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;

require "./vendor/autoload.php";

$date = new Carbon();
$timestamp = $date->addMinutes(20)->valueOf();
$timestamp = str_replace(".0", "", $timestamp);


$binance = new Binance();

//
$credentials = new Credentials();
$credentials->setApiKey("your_api_key")
    ->setApiSecret("your_api_secret")
    ->setEnvTerminalType("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();
  • Webhook
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);
  • Query order
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");

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages