API Reference

Validate Webhook

Sample Request

<?php
// Get the request body
$rawData = file_get_contents('php://input');

// Parse the JSON data
$data = json_decode($rawData, true);

// Check if JSON data was successfully parsed
if ($data === null) {
    http_response_code(400); // Bad Request
    die("Invalid JSON data");
}

// Handle the webhook data
echo "Webhook Data Received:\n";
print_r($data);

// You can now process the data as needed
const express = require('express');
const app = express();
const port = 3000; // You can choose any available port


// Middleware to parse JSON
app.use(express.json());

// Webhook endpoint
app.post('/webhook', (req, res) => {
  // Webhook data
  const webhookData = req.body;

  // Handle the webhook data
  console.log('Webhook Data Received:');
  console.log(webhookData);

  // You can now process the data as needed

  res.status(200).send('Webhook received successfully');
});

app.listen(port, () => {
  console.log(`Webhook server is running on port ${port}`);
});
from flask import Flask, request, abort, jsonify

app = Flask(__name__)


# Webhook endpoint
@app.route('/webhook', methods=['POST'])
def webhook():
    # Get and parse the JSON data
    try:
        webhook_data = request.get_json()
    except ValueError:
        abort(400)  # Bad Request

    # Handle the webhook data
    print('Webhook Data Received:')
    print(webhook_data)

    # You can now process the data as needed

    return 'Webhook received successfully', 200

if __name__ == '__main__':
    app.run(debug=True)

Sample Response

{
  "fullname": "John Doe",
  "emailaddress": "[email protected]",
  "amount": "100.00",
  "fees": "0.00",
  "metadata": {
    "user_id": "10",
    "order_id": "50"
  },
  "paymentMethod": "bkash",
  "transactionID": "TESTTRANS1",
  "date": "2023-01-07 14:00:50",
  "status": "completed"
}