Webhooks

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

When a transaction is initiated, it progresses through various stages, from pending to either successful or failed. At each stage, we will send a notification to the webhook URL registered in your merchant account.

Webhook Setup

Log into your account and go to Settings > API Keys & Webhook. From there, update your webhook URL.

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 will be signed using the secret key, a secure, randomly generated string. This ensures that the request originates from Glyde. The signing key will be included in the webhook request header X-Signature-Hash when sending data 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 from 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": "transfer.successful",
  "data": {
    "reference": "fa59e3c4-14b6-370e-ab0c-a8eaa7af2056",
    "merchant_reference": "fa6ba254-ba5c-4db2-9015-8caf3107cd56",
    "type": "debit",
    "amount": 200,
    "status": "successful",
    "fee": 20,
    "created_at": "2025-03-01T21:20:54.000000Z"
  }
}

Last updated