Webhooks
Receive real-time event notifications from Pay.com to keep your backend systems in sync with payment activity.
Webhooks let Pay.com notify your backend systems about events as they happen,
without your server having to poll the API. When something changes in your
account (a charge succeeds, a refund is processed, or a payout completes), Pay.com
sends an HTTP POST request with a JSON payload to a URL you configure.
When webhooks are required
Webhooks are useful for logging all activity, but they are required for certain asynchronous payment flows:
- 3D Secure with
confirm: true: When you configure a server-to-server 3DS flow with automatic authorization, the charge is authorized before the customer is redirected back to your site. A dropped network connection can prevent the redirect from completing, so you must listen for thecharge.succeededwebhook to finalize the order. - ACH direct debits: These payment methods don't clear
immediately. The API creates a charge with
pendingstatus, and the final outcome is delivered only via webhook once the banking network updates Pay.com. - Bank transfer payouts: Payouts start as
pending, and the finalpayout.succeededorpayout.failedevent arrives asynchronously.
Set up an endpoint in the dashboard
Create the endpoint in the Pay.com dashboard, then copy its signing secret. You can also set up an endpoint with the API.
- 1
Access the dashboard
Log in to your Pay.com dashboard. In the left sidebar, click Developers, then select Webhooks. This page lists all existing webhook endpoints configured for your account.
- 2
Create a new webhook
Click + Add Webhook. You are redirected to the Webhook Management page.

Fill in the following fields:
- Webhook Name: a label to identify this endpoint in the dashboard.
- Endpoint URL: the public URL on your server that receives the
POSTrequests. - Events to send: choose All events to receive every notification, or select individual event types to limit the webhook to a specific use case.
To get an endpoint running locally, paste this minimal endpoint into a new file. It implements every step in Verify webhook signatures:
// server.js // 1) Install dependencies: npm install express // 2) Run: node server.js const express = require('express') const crypto = require('crypto') const app = express() // Your endpoint's signing secret, from your server's environment. const webhookSecret = process.env.PAY_COM_WEBHOOK_SECRET if (!webhookSecret?.trim()) throw new Error('Set PAY_COM_WEBHOOK_SECRET') // express.raw keeps the body as the exact bytes Pay.com sent, up to 5 MB. app.post('/webhook', express.raw({ type: 'application/json', limit: '5mb' }), (req, res) => { const header = req.headers['pay-signature'] if (!header) return res.status(400).send('Missing Pay-Signature header') if (!Buffer.isBuffer(req.body)) return res.status(400).send('Expected a JSON body') let timestamp const signatures = [] for (const element of header.split(',')) { const [prefix, value] = element.split('=', 2) if (prefix === 't') timestamp = value else if (prefix === 'v1' && value) signatures.push(value) } if (!timestamp || signatures.length === 0) return res.status(400).send('Malformed Pay-Signature header') const expected = Buffer.from( crypto.createHmac('sha256', webhookSecret).update(`${timestamp}.`).update(req.body).digest('hex'), 'utf8', ) const signatureMatches = signatures.some((signature) => { const received = Buffer.from(signature, 'utf8') return received.length === expected.length && crypto.timingSafeEqual(expected, received) }) if (!signatureMatches) return res.status(400).send('Invalid webhook signature') const event = JSON.parse(req.body.toString('utf8')) // Pay.com can send an event more than once: skip one whose event.id you've already handled. // Then handle it, for example by event.type. // Return a 200 response to acknowledge receipt of the event. res.status(200).send() }) app.listen(4242, () => console.log('Running on port 4242'))When you're done, click Save changes to create the webhook.
- 3
Copy your signing secret
After saving, you are redirected back to the Webhooks list. Click the webhook you created to open its detail page.
Here you can reveal and copy the signing secret for this endpoint. You use this secret to verify the signature of every incoming event. You can also edit, disable, or delete the webhook from this page.
A signing secret starts with
whsec-pay-com-live-, or withwhsec-pay-com-sandbox-in the sandbox. An endpoint made before secrets had a prefix keeps its UUID secret until you roll it.Store the signing secret securely and never expose it in client-side code or public repositories.
Set up an endpoint with the API
POST /v1/webhook_endpoints
creates an endpoint:
urlis the public URL on your server that receives the events. It must usehttps.event_typeslists the events to send, at least one.nameis optional, and defaults toAPI.
An API key can subscribe an endpoint only to events about resources it can
read. Asking for any other event returns 403 with event_type_not_allowed.
The response is the only one that carries the endpoint's signing secret, in
secret, so store it then. Listing or retrieving endpoints never returns it.
You can reveal it on the endpoint's page in the dashboard.
Monitor webhook deliveries
Select any webhook from the Developers → Webhooks page to view its delivery log. For each event you can inspect:
- The event status and HTTP status code.
- The event ID and when it was created.
- The full request payload Pay.com sent.
- The response your server returned.
- Details about the next retry attempt if the previous delivery failed.
If your server misses an event, you can manually resend it from this view.
Pay.com retries failed deliveries every 15 minutes for up to 24 hours. Retries
stop as soon as your server returns a 2xx response.
Verify webhook signatures
Pay.com signs every webhook event with an HMAC-SHA256 signature and includes
it in the Pay-Signature HTTP header. Verifying this signature confirms that
the event came from Pay.com and has not been tampered with.
The Pay-Signature header contains a timestamp (prefixed by t=), which is
when Pay.com signed the request, in milliseconds since the Unix epoch. Then it has
a signature (prefixed by v1=). For example:
Pay-Signature: t=1790928292249,v1=1aeb7cc4bf7a95b9dc91e7b72c5f675f5364cba3fc33f6444015f8195fdc7624The header can carry more than one v1 signature. Accept the event if any of
them matches.
- 1
Extract the timestamp and signatures
Split the
Pay-Signatureheader value on the,character to get a list of elements. Then split each element on the first=to separate the prefix from the value. Reject the request if the header,t, orv1is missing.- The value for prefix
tis the timestamp. - Each value for prefix
v1is a signature. Keep all of them.
Ignore any other prefixes to prevent downgrade attacks.
const header = req.headers['pay-signature'] ?? ''; let timestamp; const signatures = []; for (const element of header.split(',')) { const [prefix, value] = element.split('=', 2); if (prefix === 't') timestamp = value; else if (prefix === 'v1' && value) signatures.push(value); }header = request.headers.get("Pay-Signature", "") timestamp = None signatures = [] for element in header.split(","): prefix, _, value = element.partition("=") if prefix == "t": timestamp = value elif prefix == "v1": signatures.append(value)header := r.Header.Get("Pay-Signature") var timestamp string var signatures []string for _, element := range strings.Split(header, ",") { prefix, value, found := strings.Cut(element, "=") if !found { continue } switch prefix { case "t": timestamp = value case "v1": signatures = append(signatures, value) } } - The value for prefix
- 2
Build the signed payload string
Construct the payload that Pay.com signed (
t.payload) by concatenating:- The timestamp (as a string).
- A literal
.character. - The raw JSON request body, exactly as received and before any parsing.
Read it as bytes (for example with
express.raw()in Express orrequest.get_data()in Flask) and don't decode it. Anyone can send to your URL, so cap the body's size, at 5 MB for example.
// rawBody is the Buffer from express.raw() const signedPayload = Buffer.concat([Buffer.from(`${timestamp}.`), rawBody]);# Flask: request.get_data() returns the raw body as bytes raw_body = request.get_data() signed_payload = f"{timestamp}.".encode("utf-8") + raw_bodysignedPayload := timestamp + "." + string(rawBody) - 3
Compute the expected signature
Using your endpoint's whole signing secret as the key, prefix included, compute an HMAC with the SHA-256 hash function over the signed payload. Refuse to verify if the secret is missing or blank, because anyone can sign with a blank key.
const crypto = require('crypto'); if (!YOUR_SIGNING_SECRET?.trim()) throw new Error('Missing signing secret'); const expectedSignature = crypto .createHmac('sha256', YOUR_SIGNING_SECRET) .update(signedPayload) .digest('hex');import hmac import hashlib if not (YOUR_SIGNING_SECRET or "").strip(): raise RuntimeError("Missing signing secret") expected_signature = hmac.new( key=YOUR_SIGNING_SECRET.encode("utf-8"), msg=signed_payload, digestmod=hashlib.sha256 ).hexdigest()import ( "crypto/hmac" "crypto/sha256" "encoding/hex" "net/http" "strings" ) if strings.TrimSpace(yourSigningSecret) == "" { http.Error(w, "Missing signing secret", http.StatusInternalServerError) return } mac := hmac.New(sha256.New, []byte(yourSigningSecret)) mac.Write([]byte(signedPayload)) expectedSignature := hex.EncodeToString(mac.Sum(nil)) - 4
Compare the signatures
Use a constant-time comparison to compare the expected signature to each received
v1signature, and accept the event if any of them matches. This protects against timing attacks. In Node.js,crypto.timingSafeEqualthrows if the two values have different lengths, so check the lengths first and treat a mismatch as an invalid signature. In Python,hmac.compare_digestraises an error for text that isn't ASCII, so compare bytes.If none matches, don't return
2xx, or Pay.com won't send that event again.const crypto = require('crypto'); const expected = Buffer.from(expectedSignature, 'utf8'); const isValid = signatures.some((signature) => { const received = Buffer.from(signature, 'utf8'); return received.length === expected.length && crypto.timingSafeEqual(expected, received); }); if (!isValid) throw new Error('Invalid signature'); // Signature is valid: safe to process the event.import hmac expected = expected_signature.encode("utf-8") if not any(hmac.compare_digest(expected, s.encode("utf-8")) for s in signatures): raise ValueError("Invalid signature") # Signature is valid: safe to process the event.import ( "crypto/hmac" "net/http" ) valid := false for _, signature := range signatures { if hmac.Equal([]byte(expectedSignature), []byte(signature)) { valid = true break } } if !valid { http.Error(w, "Invalid signature", http.StatusBadRequest) return } // Signature is valid: safe to process the event. - 5
Skip events you've already handled
Keep the
idof each event you handle, and skip an event whoseidyou've already seen. This also stops a replayed request from being handled twice.
Next steps
- Webhook events: a complete list of all event types Pay.com can send, organized by resource.
- Webhook endpoints: create, list, retrieve, and delete endpoints with the API.