Pay My BusinessHelp

Check a webhook came from Pay My Business

Verify the signature on every message so your system only trusts genuine ones.

Your webhook address is not a secret, so anyone could send to it. Every genuine message is signed with your secret key. Your developer should check the signature before trusting a message.

What is sent

Each message has a signature header. Its exact name is shown in the How webhooks work & how to set one up panel on the Webhook page, and the header value looks like this:

t=1737460000,v1=3a4f8c...e21b

Your secret key is never in the body. It stays on your side and is only used to check.

How to verify

  1. Read the raw body exactly as received, before any JSON parsing. Re-encoding the parsed body can change spacing or key order and the check fails. This is the most common mistake.
  2. Split the header into its t and v1 parts.
  3. Compute HMAC-SHA256 of t, a full stop and the raw body with your secret key, and hex-encode it.
  4. Compare it to v1 with a constant-time comparison (in PHP, hash_equals). Never use a plain equals.
  5. Optional: reject a message whose t is far from your clock. Keep the window generous, a few hours: deliveries are queued and can be retried, so a tight window rejects genuine messages.
  6. Answer with a 2xx for a message you accept.

The Webhook page has a How webhooks work & how to set one up panel with a PHP example you can copy.

Still stuck? Contact support.