Log payments into database

Log payments into your database/app via your callback URL

Details sent to your callback URL

$address = $_POST["address"];
$amount = $_POST["amount"];
$confirmations = $_POST["confirmations"];
$hash = $_POST["hash"];
$auth_hmac = $_POST["auth_hmac"];

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

include_once("sendbit.inc.php"); //libaray
define("API_KEY", "YOUR_API_KEY");
define("API_SECRET", "YOUR_API_SECRET");
$transaction_id = $_POST["transaction_id"];
$address = $_POST["address"];
$amount = $_POST["amount"];
$confirmations = $_POST["confirmations"];
$hash = $_POST["hash"];
$auth_hmac = $_POST["auth_hmac"];
$api_client = new SendBitApi(API_KEY, API_SECRET);
$valid = $api_client->validatePayment($hash, $auth_hmac);
if($valid == true) {
// Process the payment.
// We recommend you add a parameter here to check if payment record exists
// so you dont log the same payment each time you get a callback notification.
// callback notifications are sent every minute up until three confirmations.
} else {
exit("Could not verify the payment.");
// Log for manual verification
}

Now let's move on to sending payments via our API