Webhooks allow you to receive real-time updates from DashX. Follow these steps to set up a webhook.
Webhooks allow you to receive real-time updates about checkout sessions and other events. Once a webhook is configured, your server will receive structured JSON payloads whenever an event occurs.
When a checkout session is completed, your webhook URL will receive a POST request with a payload similar to this:
{ "id": "d011c41f-a29f-4c44-b3de-64e234d8b269", "apiVersion": "2023-01-11", "created": 1742839610947, "object": "checkoutSession", "type": "checkout_session.completed", "data": { "object": { "id": "e0cbb984-fc53-4e38-8167-1f5f7a5d0a3c", "createdAt": "2025-03-24T18:06:45.053334Z", "amountTotal": "0.10056800", "currency": "USDC", "status": "SUCCESS", "customer_id": "6881540b-2c2c-45", "transaction_hash": "0x0e09b6fbcc79af96d192baede7d8cda9829fa3df0a01276d6d509cf9edfcb344", "payment_link_id": "516089da-904f-4588-8a5e-53f31adeda1b", "payment_link_title": "Fee check", "from_address": "0xf70da97812cb96acdf810712aa562db8dfa3dbef", "updatedAt": "2025-03-24T18:06:50.947368+00:00" } } }
When a checkout session is expired, your webhook URL will receive a POST request with a payload similar to this:
{ "id": "d011c41f-a29f-4c44-b3de-64e234d8b269", "apiVersion": "2023-01-11", "created": 1742839610947, "object": "checkoutSession", "type": "checkout_session.expired", "data": null }
When a checkout session is canceled, your webhook URL will receive a POST request with a payload similar to this:
{ "id": "d011c41f-a29f-4c44-b3de-64e234d8b269", "apiVersion": "2023-01-11", "created": 1742839610947, "object": "checkoutSession", "type": "checkout_session.canceled", "data":null }
Webhooks allow your server to listen for real-time payment events. When a checkout session is completed, your webhook URL will receive a POST request containing transaction details. Below are examples of how to handle webhook events in Python and JavaScript.
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
data = request.json
if data["type"] == "checkout_session.completed":
print("Payment successful:", data["data"]["object"])
return jsonify({"status": "received"}), 200
if __name__ == '__main__':
app.run(port=5000)
const express = require("express");
const app = express();
app.use(express.json());
app.post("/webhook", (req, res) => {
const data = req.body;
if (data.type === "checkout_session.completed") {
console.log("Payment successful:", data.data.object);
}
res.json({ status: "received" });
});
app.listen(5000, () => console.log("Webhook server running on port 5000"));
Note: Only 5 webhooks are allowed per merchant