Premium Fraud Management Tools
Webhooks
Once you're set up to receive webhooks, you can collect information from them to create reports based on different triggers. For example, you could collect the information on notifications for:
- Fraud Protection to be notified when a transaction marked for review has been approved or rejected
- Dispute Opened to compare opened disputes with your transactions sales and create a report on your chargeback ratio
- Disbursement to create a funding report
General workflow
- Set up at least one destination URL to receive webhooks from the gateway
- Parse the contents of the webhook notifications
-
Create logic to store the details of the
WebhookNotification
objects for a specific kind of trigger
Fraud Protection
When a transaction has been formally reviewed in the Fraud Protection Advanced dashboard, we'll send
a TRANSACTION_REVIEWED
webhook containing information that you can use to update your
records:
- PHP
if (
isset($_POST["bt_signature"]) &&
isset($_POST["bt_payload"])
) {
$webhookNotification = $gateway->webhookNotification()->parse(
$_POST["bt_signature"], $_POST["bt_payload"]
);
// Example values for webhook notification properties
$message = $webhookNotification->kind; // "transaction_reviewed"
$message = $webhookNotification->transactionReview->transactionId; // "123abc"
$message = $webhookNotification->timestamp->format('D M j G:i:s T Y'); // "Sun Jan 1 00:00:00 UTC 2012"
file_put_contents("/tmp/webhook.log", $message, FILE_APPEND);
header("HTTP/1.1 200 OK");
}
Notice how we are using file_put_contents
to store the result of the received Webhooks
to /tmp/webhooks.log
.
You can use the transaction ID provided in the webhook's payload to make a Transaction.find API call and retrieve additional information if needed:
- PHP
$transaction = $gateway->transaction()->find('the_transaction_id');