Log payments into database
Log payments into your database/app via your callback URL

Details sent to your callback URL

1
$address = $_POST["address"];
2
$amount = $_POST["amount"];
3
$confirmations = $_POST["confirmations"];
4
$hash = $_POST["hash"];
5
$auth_hmac = $_POST["auth_hmac"];
Copied!
The details above will be sent to your call-back URL upon receiving payments. Payment notifications are sent every minute up until the transaction gets three confirmations.
To handle call-backs we have made a small useful code to log payments into your database - please see the code below.

Log payments into your database

1
include_once("sendbit.inc.php"); //libaray
2
3
define("API_KEY", "YOUR_API_KEY");
4
define("API_SECRET", "YOUR_API_SECRET");
5
6
$transaction_id = $_POST["transaction_id"];
7
$address = $_POST["address"];
8
$amount = $_POST["amount"];
9
$confirmations = $_POST["confirmations"];
10
$hash = $_POST["hash"];
11
$auth_hmac = $_POST["auth_hmac"];
12
13
$api_client = new SendBitApi(API_KEY, API_SECRET);
14
$valid = $api_client->validatePayment($hash, $auth_hmac);
15
16
if($valid == true) {
17
18
// Process the payment.
19
20
// We recommend you add a parameter here to check if payment record exists
21
// so you dont log the same payment each time you get a callback notification.
22
// callback notifications are sent every minute up until three confirmations.
23
24
25
} else {
26
27
exit("Could not verify the payment.");
28
29
// Log for manual verification
30
31
}
Copied!
Now let's move on to sending payments via our API