PHP code example of plisio / plisio-api-php

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

    

plisio / plisio-api-php example snippets


interface InteractionInterface
{
    /**
     * @throws Throwable on errors (If silent mode turn off)
     * @return null on errors (If silent mode turn on)
     * @return BalanceApiResponse on success
     */
    public function getBalance(string $currency): ?BalanceApiResponse;

    /**
     * @throws Throwable on errors (If silent mode turn off)
     * @return null on errors (If silent mode turn on)
     * @return OperationApiResponse on success
     */
    public function getOperationById(string $id): ?OperationApiResponse;

    /**
     * @throws Throwable on errors (If silent mode turn off)
     * @return null on errors (If silent mode turn on)
     * @return CommissionApiResponse on success
     */
    public function getCommission(CommissionQuery $query): ?CommissionApiResponse;

    /**
     * @throws Throwable on errors (If silent mode turn off)
     * @return null on errors (If silent mode turn on)
     * @return CryptocurrencyApiResponse on success
     */
    public function getCurrencyInfoByFiat(string $fiat): ?CryptocurrencyApiResponse;

    /**
     * @throws Throwable on errors (If silent mode turn off)
     * @return null on errors (If silent mode turn on)
     * @return FeePlanApiResponse on success
     */
    public function getFeePlanByPsyscid(string $psyscid): ?FeePlanApiResponse;

    /**
     * @throws Throwable on errors (If silent mode turn off)
     * @return null on errors (If silent mode turn on)
     * @return WithdrawApiResponse on success
     */
    public function withdraw(WithdrawQuery $withdrawQuery): ?WithdrawApiResponse;

    /**
     * @throws Throwable on errors (If silent mode turn off)
     * @return null on errors (If silent mode turn on)
     * @return InvoiceWhiteLabelResponse on success
     */
    public function createInvoice(InvoiceQuery $invoiceQuery): ?InvoiceWhiteLabelResponse;

    /**
     * @throws Throwable on errors (If silent mode turn off)
     * @return FeeApiResponse on success
     * @return null on errors (If silent mode turn on)
     */
    public function getFee(FeeQuery $feeQuery): ?FeeApiResponse;
}

    private ?string $addresses = null;
    private ?string $amounts = null;
    private ?string $type = null;
    private ?string $feePlan = null;
   

    private string $psyscid;
    private string $to;
    private string $amount;
    private int $feeRate;
    private string $feePlan;

    private ?string $type = null;
   

   $withdraw = $this->interaction->withdraw(
            new WithdrawQuery(
                Currencies::BTC,
                '2N3cD7vQxBqmHFVFrgK2o7HonHnVoFxxDVB',
                '0.00031',
                FeePlans::NORMAL,
                1
            )
        );
    

    private string $currency;
    private string $orderName;
    private string $orderNumber;

    private ?string $amount = null;
    private ?string $sourceCurrency = null;
    private ?string $sourceAmount = null;
    private ?string $allowedPsyscids = null;
    private ?string $description = null;
    private ?string $callBackUrl = null;
    private ?string $email = null;
    private ?string $language = null;
    private ?string $plugin = null;
    private ?string $version = null;
    private ?bool $redirectToInvoice = null;
    private ?string $expireMin = null;
    

   $invoice = $this->interaction->createInvoice(
            (new InvoiceQuery(Currencies::BTC, 'some order', '234sdfsd'))
                ->setAmount('0.01')
        );
    

    private string $psyscid;
    private string $addresses;
    private string $amounts;

    private ?string $feePlan = null;
    

   $fee = $this->interaction->getFee(
            new FeeQuery(
                Currencies::BTC,
                'tb1qfqtvgh97umdum8zwyah4ztzkwz8j7qyyalgwa4',
                '0.0003'
            )
        );
    

$container = \PlisioPhpSdk\PlisioPhpSdk::get();
/** @var \PlisioPhpSdk\Http\InteractionInterface $interaction */
$interaction = $container->get(\PlisioPhpSdk\Http\InteractionInterface::class);