Download the PHP package plisio/plisio-api-php without Composer
On this page you can find all versions of the php package plisio/plisio-api-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package plisio-api-php
This PHP SDK project for Plisio Api Support
This is fully object-oriented php's composer package, developed to work with Plisio's cryptocurrency payment-gateway.
InteractionInterface methods description:
-
getBalance(string $currency)
Let's see yourself cryptocurrency balance in Bitcoin (BTC), for example. Also supports 9 cryptocurrencies.
$balance = $this->interaction->getBalance(Currencies::BTC);
-
getOperationById(string $id)
Returns information about concrete transaction by transaction identifier, example:
$operation = $this->interaction->getOperationById('61e9384388ecfd3ea775dfb2');
-
getCommission(CommissionQuery $query)
Estimates cryptocurrency fee and Plisio commission, accepts CommissionQuery class, example:
$commission = $this->interaction->getCommission(new CommissionQuery(Currencies::BTC));
Also commission query class has nullable parameters:
$addresses
- Wallet address or comma separated addresses when estimating fee for mass withdrawal$amounts
- Amount or comma separated amount that will be sent in case of mass withdraw$type
- Operation type, such as: 'cash_out' or 'mass_cash_out'$feePlan
- The name of fee plan
-
getCurrencyInfoByFiat(string $fiat)
Provides current rate of exchange supported cryptocurrencies to the definite fiat currency, needs to send the request to API by the method with selected fiat currency.
Let's get the rate of Australian Dollar (AUD), for instance. By the way, if there is not selected any of fiat currency, is rate of United States Dollar (USD), by default. The response is a list of models that consist rates of exchanges:
$info = $this->interaction->getCurrencyInfoByFiat(FiatCurrencies::AUD);
-
getFeePlanByPsyscid(string $psyscid)
Returns the model with fee plans by selected
cryptocurrency
. Also, this model has additional fields pointed what your fee plan is.Example:
$feePlan = $this->interaction->getFeePlanByPsyscid(Currencies::BTC);
-
withdraw(WithdrawQuery $withdrawQuery) If you want to withdraw, you should call
withdraw
method that accepts WithdrawQueryClass:$psyscid
— a name of cryptocurrency;$to
— hash or multiple comma separated hashes pooled for the mass_cash_out;$amount
— any comma separated float values for the mass_cash_out in the order that hashes are into
parameter;$feePlan
— a name of the one of fee plans;$feeRate
— custom feeRate. conf_target (blocks) for BTC like cryptocurrencies or gasPrice in GWAI for ETH based cryptocurrencies;$type
— operation type (it's an optional parameter).
Example:
-
createInvoice(InvoiceQuery $invoiceQuery)
Let us coming go to the creation of invoices, first you need to build InvoiceQuery class:
The query needs to receive the next required parameters:
$currency
— the name of cryptocurrency;$orderName
— merchant internal order name;$orderNumber
— merchant internal order number.
Beside these params, there are additional such as:
$amount
— any cryptocurrency float value. If you want to convert a fiat currency, you should skip current field and use the next two fields instead it;$sourceCurrency
— the name of the fiat currency;$sourceAmount
— any float value;$allowedPsyscids
— comma-separated list of cryptocurrencies that allowed for payment. Also, you will be able to select one of them. Example: 'BTC,ETH,TZEC';$description
— merchant invoice description;$callbackUrl
— merchant full URL to get invoice updates. The POST request will be sent to this URL. If this parameter isn’t set, a callback will be sent to URL that can be set under profile in API settings, that has got 'Status URL' field;$email
— an autofill invoice email. You will be asked to insert their email where a notification will be sent;$language
— en_US (now supports English only);$plugin
— Plisio’s internal field to determine integration plugin;$version
— Plisio’s internal field to determine integration plugin version.
Example:
-
getFee(FeeQuery $feeQuery)
To estimate fee you should create FeeQuery class with parameters:
$psyscid
— a name of cryptocurrency;$addresses
— wallet address or comma separated addresses when estimating fee for mass withdrawal;$amounts
— amount or comma separated amount that will be sent in case of mass withdraw;$feePlan
— a name of the one of fee plans (it is not required).
Example:
Entrypoint oh php's sdk is represented with singleton-class PlisioPhpSdk, example:
Also, this sdk's provides suitable configuration possibility, you can create conf.yaml file like below:
To configure sdk's you need to create conf.yaml file in your's project-root directory and launch console command from vendor's directory:
php cli/console.php plisio-php-sdk:load-conf "path to conf.yaml file"
Sdk's has two working modes from the box (This functionality only concerns interaction with the api):
- Silent mode (Does not throw exception, return null in some cases), all exception writing out in .log file
- Non-silent mode (Throws exceptions), also all exceptions are logged
The sdk is logged in the plisio-php-sdk.log log file, for convenience, you can create a symbolic link from your root directory to this file. In the quality of the demonstration, all the functionality of the sdk (working with the test resource) is duplicated by console commands:
plisio-php-sdk:load-conf
plisio-php-sdk:test-balance
plisio-php-sdk:test-commission
plisio-php-sdk:test-create-invoice
plisio-php-sdk:test-currency-info
plisio-php-sdk:test-fee
plisio-php-sdk:test-fee-plan
plisio-php-sdk:test-operation
plisio-php-sdk:test-withdraw
All versions of plisio-api-php with dependencies
ext-json Version *