PHP code example of sq-dev / wallex-sdk

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

    

sq-dev / wallex-sdk example snippets


use Wallex\Widget;

$widget = new Widget(1, 'secret_key');

$url = $widget->cretePayment(
  '[email protected]',
  'Xiaomi 9T',
  1000,
  1,
  'Hello thanks for order',
  'Xiaomi 9T',
  'USDT',
  'rub',
  'ru'
); // Returns payment url

use Wallex\Webhook;

$payment = new Webhook($_POST);
if ($payment->isVerified('secret_key') && $payment->isSuccess()) {
    // Payment success logic
    //F.e:
    $client = $payment->getClient(); // Get client email
    User::where('email', $client)
        ->update(['balance' => $payment->getAmount()]);
}

use Wallex\Payout;

$payout = new Payout($merchantId, $secretKey);

$payout->cryptoPay($address, $amount, $currency);