Methods
List of available API methods. Before starting read about making requests.
Table of contents:
createPayment
Parameters
Name | Type | Description | Required |
title | string | title of the payment | yes |
description | string | description of the payment | no |
currency | string | currency of the payment (USD, TON etc) | yes |
amount | string | amount of the payment (in nanos) | yes |
timeout | int | timeout of the payment (default 15) | no |
payload | string | payload of the payment (max length 2048) | no |
redirect_url | string | url to redirect after payment (successful or failed) | no |
test | bool | use testnet | no |
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 |
id | int | id of the payment | yes |
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 |
id | int | id of the payment | yes |
Result
Type: bool
- always true
Example
PHP
use Payhook\Sdk\Payhook;
$payhook = new Payhook('your_api_key');
$isDeleted = $payhook->deletePayment(1);
var_dump($isDeleted);