Parameters

webhook
dict
required

A webhook dict or json object

Response

verified
bool

If True - webhook is valid, otherwise webhook is not valid

Example:

from squaredinc_sdk import SquaredSDK


squared = SquaredSDK(
    api_key="your-api-key"
)

webhook = {
    "event": "invoice.paid",
    "invoice_id": "b0473464-120e-458b-97a3-a292504ca2a9",
    "merchant_id": "the-dev-merchant-cq8d",
    "absolute_amount": 10.0112,
    "fiat_amount_usd": 10.01,
    "payment_method": "usdt-trc20",
    "receiving_wallet": "TMvUo8nhSXzYF624QGBBU6LMKnAvReUtdr",
    "taken_fee": None,
    "invoice_title": "",
    "invoice_description": "",
    "paid_at": 1745356435,
    "simulated_invoice": None,
    "custom_data": {"some_custom_data": "..."},
    "hmac": "e9aef0c9633f683c9094665bb3681e012074b85a3d55cf60b1bfbd0c6f008bc6",
}

verified = squared.verify_webhook(webhook=webhook, raise_on_invalid=False)
if verified:
    print("Webhook verified!")
else:
    print("Webhook is not verified, hence invalid")