Webhooks

Web hooks are a great way for Glyde to keep your application informed of changes that are happening in your account and transaction status updates.

When a transaction is initiated, it goes through the stages of pending, processing to failed or processed. In every of this stages we will notify the webhook URL that have submitted on your merchant account.

Webhook Setup

Log into your account, navigate to Settings > Api Kes & Webhook then update your webhook URL and copy the auto-generated crypto-graphically secure signing key.

Webhook URL

The webhook URL is a publicly accessible endpoint on your application/website that can receive a post request from Glyde. We will send updates about transactions to the endpoint.

Signing Key

The webhook signing key is a secure randomly generated string that we will use to encrypt the data we send to the webhook url. This is to ensure that the request originated from Glyde. The Signing key will be set on the webhook request header x-signature-hash to is sent to your webhook URL.

Signature Validation

<?php

if (strtoupper($_SERVER['REQUEST_METHOD']) != 'POST' || !in_array('HTTP_X_SIGNATURE_HASH', $_SERVER)) {
  exit();
}

// Get the input from the request.
$input = @file_get_contents("php://input");

// Replace SIGNING_KEY with the signing key form your account
define('GLYDE_SIGNING_KEY', 'SIGNING_KEY');

// Validate the authenticity of the data sent
if ($_SERVER['HTTP_X_SIGNATURE_HASH'] !== hash_hmac('sha256', $input, GLYDE_SIGNING_KEY)) {
  exit();
}

// Send an HTTP success response back to Glyde
http_response_code(200);

//Decode the json string and convert it to an associative array.
$event = json_decode($input, true);

// **(Optional Processing Placeholder):**
// Add your code here to process the data in the $event variable

exit();

Event Types

{
  "event-type": "disbursement.processing",
  "data": {
    "transaction": {
      "id": 313,
      "reference": "f783845d-7af5-4886-885e-0f9c746ae2ed",
      "type": "debit",
      "type_description": "Lending payout",
      "amount": "50",
      "balance_after": "36895",
      "balance_before": "36895",
      "status": "processing",
      "merchant_reference": "f7888fe3-5d0f-47b9-a3d2-efad0cc3c19e",
      "payload": null,
      "narration": "Lending payout",
      "initiated_at": "2024-02-05 15:25:18",
      "process_at": null,
      "failed_at": null,
      "processed_at": null,
      "paid_at": null,
      "wallet_id": 1,
      "session_id": null,
      "created_at": "2024-02-05 15:25:18",
      "updated_at": "2024-02-05 15:25:18"
    }
  }
}

Last updated