Signed Payment Requests: Why a Timestamp Matters
You sign every request your server sends to a payment API. The signature checks out, the request is accepted, and everything looks secure.
Yet a signature only answers one question: did this request come from someone who holds the secret key? It does not answer a second one: is this request new?
If nobody checks the second question, a copy of a valid request can be sent again later, and it may be accepted a second time. This is called a replay.
What a signature does and does not do
A typical scheme computes a signature from the request content using a shared secret. The receiver repeats the calculation and compares the result. If the values match, the content was not changed and the sender holds the secret.
That protects against tampering. It does not protect against reuse. A request that was valid yesterday is still correctly signed today. Anyone who obtains a copy, for example from a log file, a proxy or a leaked support ticket, can send the identical bytes again.
TLS reduces the chance that someone captures a request on the network, but it does not replace replay protection. A copy taken from a log or a support ticket is still a valid request.
Why AI-written code can miss this
An assistant that is asked to "sign the request" can easily do the simplest thing that produces a valid-looking signature: it signs the request body. The code runs and the gateway accepts it in testing, so nothing looks wrong.
What gets lost is everything that is not in the body: the method, the path and query, a timestamp and a unique value for each request. A signature over the body alone says nothing about when the request was made or whether it was already used.
What to check in requests you send
When you send a signed request to a payment API, check these points against the API guide of the gateway you use:
- The signature covers more than the body. A scheme can include the HTTP method and the path with its query string, so a signature for one endpoint cannot be reused on another.
- The timestamp is signed. The receiver rejects requests whose timestamp is too old or too far in the future. If the timestamp only travels in a header that is not part of the signed string, an attacker can replace it. Keep your own server clock accurate.
- The nonce is signed, and the receiver remembers it. A nonce is a random value used once per request. The receiver keeps recent nonces and rejects a repeat. It must keep each nonce for as long as a request carrying it could still pass the timestamp check. If a receiver accepts timestamps up to five minutes off in either direction, a request stamped in the future stays valid for up to ten minutes after its first use, so the nonce must be kept that long. If it forgets a nonce earlier, there is a gap where an old request has an expired nonce but a timestamp that still looks valid.
- You sign exactly the bytes you send. If your code signs one version of the body and the HTTP client sends another, for example after the JSON is re-formatted or a number such as
100.00becomes100, the signature fails or, worse, covers something else. Sign the final string. - Secrets stay out of logs. Never log the key, and think carefully before logging full signed requests.
The exact fields and format differ between gateways. Follow the API guide rather than a description from memory, and do not invent your own scheme. The list above is for reviewing the client code and your own endpoints against that guide.
Notifications you receive
The same ideas apply in the other direction. When a payment provider sends your server a notification, verify its signature and check that it is recent. By default, EPaySe signs webhook deliveries over the timestamp and the body, so check the webhook guide for the exact format. Each delivery also carries an event id header that stays the same when a delivery is retried, which is a good key for remembering what you already handled.
Also make your handler safe to run twice, because notifications can be delivered more than once. Marking an order as paid twice should not ship the goods twice. For incoming notifications this usually means remembering which events you have already handled, instead of relying on a nonce.
Compare signatures with the constant-time function your language provides, such as hash_equals in PHP, crypto.timingSafeEqual in Node.js or hmac.compare_digest in Python. A normal string comparison can leak how many characters matched.
How to test it
These checks are for your own signed endpoints, or to confirm that your client handles a rejection correctly. Be careful when you repeat the failing steps against a real gateway: many gateways lock an API key after several failed signatures in a short time, and EPaySe does this too. Use a test key and a few attempts, not a loop.
- Send a valid signed request and confirm it succeeds.
- Send the exact same request again after the allowed time window and confirm it is rejected.
- Send the same nonce twice inside the window and confirm the second request is rejected.
- Change one character of the path and confirm the signature check fails.
- Change the timestamp without changing the signature and confirm it fails.
- Deliver the same notification twice to your handler and confirm the order is only updated once.
If an assistant wrote the signing code, ask it to list which fields are signed and how the signed string is built. If the answer is only the body, the scheme is incomplete.
Key takeaways
- A signature proves who sent a request, not when it was sent.
- A copy of a valid request can be replayed unless a timestamp and nonce are signed and checked.
- Sign the method, the path and query, a timestamp and a nonce, as your gateway's guide describes, not only the body.
- Keep each nonce for as long as a request carrying it could still pass the timestamp check.
- Make notification handlers safe to run twice.
- Test replay on purpose, with an old request and a repeated nonce.
Related reading: Mark orders paid only after EPaySe confirms.
As of November 2026, EPaySe is onboarding merchants, reviewed and approved case by case. The API guide describes the exact signing format, and the team can help if you get stuck.
Related Articles
Payment Amount Units: Why 25 Can Mean 25 Cents
Payment APIs read amounts in different units. Learn how a checkout can charge 25 cents instead of 25 dollars, why tests miss it, and how to prevent it.
How AI routes a card payment, and how to test it before you trust it
The same card payment can often travel several routes. Here is how AI routing picks one, what promised uplifts leave out, and how to test it safely.
Why good customers get declined, and what AI risk scoring changes
A real customer blocked by a cautious fraud filter is a false decline. Here is why it happens, why it is easy to miss, and what to measure before changing anything.

Go-Live Checklist for a Checkout Your AI Assistant Built
Before real customers pay, read every line, re-run every test, move the live key to your server settings and start with one small order. A short checklist for AI-built checkouts.