Methods

List of available API methods. Before starting read about making requests.

Table of contents:

createPayment

Parameters
Name Type Description Required
titlestringtitle of the paymentyes
descriptionstringdescription of the paymentno
currencystringcurrency of the payment (USD, TON etc)yes
amountstringamount of the payment (in nanos)yes
timeoutinttimeout of the payment (default 15)no
payloadstringpayload of the payment (max length 2048)no
redirect_urlstringurl to redirect after payment (successful or failed)no
testbooluse testnetno
Result

Type: PaymentResult

Example
PHP
use Payhook\Sdk\Payhook;

$payhook = new Payhook('your_api_key');

$paymentResult = $payhook->createPayment([
    'title' => 'Test payment',
    'currency' => 'USD',
    'amount' => Payhook::moneyToNanos('3.14'),
]);

var_dump($paymentResult);

getPayment

Parameters
Name Type Description Required
idintid of the paymentyes
Result

Type: PaymentResult

Example
PHP
use Payhook\Sdk\Payhook;

$payhook = new Payhook('your_api_key');

$paymentResult = $payhook->getPayment(1);

var_dump($paymentResult);

deletePayment

Parameters
Name Type Description Required
idintid of the paymentyes
Result

Type: bool - always true

Example
PHP
use Payhook\Sdk\Payhook;

$payhook = new Payhook('your_api_key');

$isDeleted = $payhook->deletePayment(1);

var_dump($isDeleted);
Last Updated:
Contributors: Davyd Kohut, Davyd Kohut