Banco BCT Logo
RefundsTokenization

Country:

Webhooks Guide

DOCUMENTATION/webhooks

Webhooks Guide

Webhooks allow your application to receive real-time notifications about events in our payment system. This guide covers how to set up and handle webhooks.

What are Webhooks?

Webhooks are HTTP POST requests that our system sends to your application when certain events occur. Instead of repeatedly polling our API for changes, webhooks allow us to push updates to you as they happen.

Setting Up Webhooks

To receive webhooks, you'll need to:

  1. Create an endpoint on your server to receive webhook requests
  2. Configure the webhook URL in your dashboard
  3. Verify the webhook signature to ensure authenticity
  4. Process the event data according to your business logic

Common Events

Here are the most common webhook events you might want to handle:

Payment Events

  • payment.created - A new payment has been initiated
  • payment.succeeded - A payment has been successfully processed
  • payment.failed - A payment attempt has failed
  • payment.refunded - A payment has been refunded

Customer Events

  • customer.created - A new customer has been created
  • customer.updated - Customer information has been updated

Example Webhook Handler

[object Object], express = ,[object Object],(,[object Object],);
,[object Object], crypto = ,[object Object],(,[object Object],);

,[object Object], app = ,[object Object],();

app.,[object Object],(,[object Object],, express.,[object Object],({ ,[object Object],: ,[object Object], }), ,[object Object], {
  ,[object Object], payload = req.,[object Object],;
  ,[object Object], signature = req.,[object Object],[,[object Object],];

  ,[object Object],
  ,[object Object], expectedSignature = crypto
    .,[object Object],(,[object Object],, process.,[object Object],.,[object Object],)
    .,[object Object],(payload)
    .,[object Object],(,[object Object],);

  ,[object Object], (signature !== expectedSignature) {
    ,[object Object], res.,[object Object],(,[object Object],).,[object Object],(,[object Object],);
  }

  ,[object Object], event = ,[object Object],.,[object Object],(payload);

  ,[object Object],
  ,[object Object], (event.,[object Object],) {
    ,[object Object], ,[object Object],:
      ,[object Object],.,[object Object],(,[object Object],, event.,[object Object],);
      ,[object Object],;
    ,[object Object], ,[object Object],:
      ,[object Object],.,[object Object],(,[object Object],, event.,[object Object],);
      ,[object Object],;
    ,[object Object],:
      ,[object Object],.,[object Object],(,[object Object],, event.,[object Object],);
  }

  res.,[object Object],(,[object Object],).,[object Object],(,[object Object],);
});

Security Considerations

Always verify webhook signatures to ensure the requests are coming from our system and haven't been tampered with.

Did this page help you?

Your feedback helps us improve our documentation.