Authentication parameters
The Payward Services API uses HMAC signing. Every authenticated request must include the following headers:API-KeyHTTP header parameter: your public API key.API-NonceHTTP header parameter: monotonically increasing integer nonce.API-SignHTTP header parameter: HMAC-SHA512 signature of the request.
Setting the API-Key parameter
The value for theAPI-Key HTTP header parameter is your public API key.
Contact your Payward account representative to obtain API credentials.
Setting the API-Nonce parameter
The value for theAPI-Nonce HTTP header parameter must be a monotonically increasing integer for the API key.
Use a high-resolution timestamp, such as nanoseconds since the Unix epoch, unless your integration already has a stronger monotonic counter.
Setting the API-Sign parameter
The value for theAPI-Sign HTTP header parameter is an HMAC-SHA512 signature of the request, base64-encoded.
Algorithm steps
- Choose a nonce: generate a monotonically increasing integer.
- Build the nonce payload: concatenate the nonce and the exact request body bytes.
- For requests without a body: use the nonce only.
- For requests with a body: use the exact bytes you send on the wire.
- Hash the nonce payload: generate a SHA-256 digest.
- Build the message: concatenate the URL path, including query string, and the SHA-256 digest.
- Sign: generate HMAC-SHA512 over the message using your base64-decoded secret.
- Encode: base64-encode the signature.
Examples
The following code snippets demonstrate how to generate the signature in Python and JavaScript.Complete request example
Here’s a complete example making an authenticated GET request to list assets.Query parameters in signature
When your request includes query parameters, they must be included in the URL path used for signature generation. Use the exact same path string in both the signature and the request URL.Request body in signature
For requests that send a body (POST, PUT), the body bytes used to compute the signature must match the bytes sent on the wire exactly. Differences in whitespace, key ordering, or encoding will produce a signature mismatch. The recommended pattern is to serialize the body once and reuse the same string for both signing and the HTTP request:Troubleshooting
| Error | Cause | Solution |
|---|---|---|
Invalid signature | Signature doesn’t match | Verify secret encoding, nonce, path, and body bytes |
Missing API-Key | Header not set | Check the header name is exactly API-Key |
Invalid nonce | Nonce was reused | Generate a larger nonce for every request |