Language

Overview: Webhooks

A webhook is a means of notifying a third-party application (in many cases your backend system) of the occurrence of an event with some relevant information. In the Kopo Kopo API, webhooks are currently triggered by the following resources:

  • Incoming Transactions
  • Transaction Reversals
  • Completed settlement transfers
  • Customer created

Each webhook sent by the Kopo Kopo API contains an Event with _links to: the associated resource. It is important to note that a single API request can trigger multiple webhooks to be fired, e.g. receiving a transaction from a customer to a till can create the events buygoods_transaction_received and customer_created.

  1. Webhooks are sent asynchronously and are not guaranteed to be delivered in order. We recommend that applications protect against duplicated events by making event processing idempotent.

Example webhook payload

{
  "topic": "buygoods_transaction_received",
  "id": "2133dbfb-24b9-40fc-ae57-2d7559785760",
  "created_at": "2020-10-22T10:43:20+03:00",
  "event": {
    "type": "Buygoods Transaction",
    "resource": {
      "id": "458712f-gr76y-24b9-40fc-ae57-2d35785760",
      "amount": "100.0",
      "status": "Received",
      "system": "Lipa Na M-PESA",
      "currency": "KES",
      "reference": "OJM6Q1W84K",
      "till_number": "000000",
      "sender_phone_number": "+254999999999",
      "hashed_sender_phone": "8f7bd03d28bb39ffbe7e074ad6a85352b4de2c8a8af1db7db7e5a520e37e015d",
      "origination_time": "2020-10-22T10:43:19+03:00",
      "sender_last_name": "Doe",
      "sender_first_name": "Jane",
      "sender_middle_name": null
    }
  },
  "_links": {
    "self": "https://sandbox.kopokopo.com/webhook_events/2133dbfb-24b9-40fc-ae57-2d7559785760",
    "resource": "https://sandbox.kopokopo.com/financial_transaction/458712f-gr76y-24b9-40fc-ae57-2d35785760"
  }
}