Developers
The IP address of the server sending notification to SCI: 188.166.102.33. The current list of IP can be obtained in text format via the URL: https://berty.cash/ips.txt or in JSON format: https://berty.cash/ips.php
PHP classes
Download and connect PHP classes for accepting payments and payouts.
Invoicing for payment
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/BertyAPI.php';
$berty_shop_id = 'your_shop_id';
$berty_secret_key = 'your_secret_key';
$BC = new BertyAPI($berty_shop_id, $berty_secret_key);
$params = [
'amount' => 100, // required parameter, payment amount
'currency' => 'USD', // required parameter, currency, example: USD
'order_id' => 1, // mandatory parameter, the unique numeric identifier of the payment in your system, example: 105485
'comment' => 'comment', // optional parameter, payment text comment, example: service Order #150800
];
$response = $BC->create_order($params);
if ($response['error']) { // $res['error'] - true if an error occurs
echo $response['message']; // $res['message'] - the text of the error message
// actions in case of an error
} else {
// creating a payment form
?>
<form action="<?php echo $response['data']['url']; ?>" method="post">
<button>To pay</button>
</form>
<?php } ?>
Payment verification
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/BertyAPI.php';
$berty_shop_id = 'your_shop_id';
$berty_secret_key = 'your_secret_key';
$BC = new BertyAPI($berty_shop_id, $berty_secret_key);
$response = $BC->confirm_order($_POST);
if ($response['error']) { // $res['error'] - true if an error occurs
echo $response['message']; // $res['message'] - the text of the error message
// actions in case of an error
} else {
$id = $response['data']['order_id']; // unique numeric identifier of the payment in your system, example: 150800
$hash = $response['data']['hash']; // hash, example: bde834a2f48143f733fcc9684e4ae0212b370d015cf6d3f769c9bc695ab078d1
$currency = $response['data']['currency']; // the currency of payment example: USD
$system = $response['data']['system']; // system, example: Berty
$amount = (float) $response['data']['amount']; // invoice amount, example: 1.0000000
$transaction = $response['data']['transaction']; // transaction number in the system Berty: 96401
echo $id . '|success'; // required to confirm that the payment has been credited
}
Instant payments
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/BertyAPI.php';
$berty_shop_id = 'your_shop_id';
$berty_secret_key = 'your_secret_key';
$BC = new BertyAPI($berty_shop_id, $berty_secret_key);
$params = [
'email' => 'user@mail.ru', // required parameter, email пользователя
'amount' => 100, // mandatory parameter, the amount of the payment
'currency' => 'USD', // required parameter, currency
'comment' => 'comment', // required parameter, comment
];
$response = $BC->user_transfer($params);
if ($response['error']) { // $res['error'] - true if an error occurs
echo $response['message']; // $res['message'] - the text of the error message
// actions in case of an error
} else {
$transaction = $response['data']['transaction']; // transaction number in the system Berty: 96401
}
The balance of the purse
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/BertyAPI.php';
$berty_shop_id = 'your_shop_id';
$berty_secret_key = 'your_secret_key';
$BC = new BertyAPI($berty_shop_id, $berty_secret_key);
$response = $BC->balances();
if ($response['error']) { // $res['error'] - true if an error occurs
echo $response['message']; // $res['message'] - the text of the error message
// actions in case of an error
} else {
print_r($response['data']);
}