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 workflowAnchorIcon

  • 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 ProtectionAnchorIcon

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:

  1. Callbacks
  2. Promises
app.post("/webhooks", (req, res) => {
  gateway.webhookNotification.parse(
    req.body.bt_signature,
    req.body.bt_payload,
    (err, webhookNotification) => {
      console.log("[Webhook Received " + webhookNotification.timestamp + "] | Kind: " + webhookNotification.kind);

      // Example values for webhook notification properties
      console.log(webhookNotification.kind); // "transactionReviewed"
      console.log(webhookNotification.transactionReview.transactionId); // "123abc"
      console.log(webhookNotification.timestamp); // Sun Jan 1 00:00:00 UTC 2012
      res.status(200).send();
    }
  );
});
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:
  1. Callbacks
  2. Promises
gateway.transaction.find("theTransactionId", (err, transaction) => { });

See alsoAnchorIcon