Request Signing
All requests to the Afterpay API must be signed and have a valid signature passed in the X-Afterpay-Request-Signature header. To generate the signature:
-
Construct the following string:
{path}\n{X-Afterpay-Request-Date}\n{body}{path}is the remainder of the URL following the host, including the query string (if present){X-Afterpay-Request-Date}is an epoch timestamp set to the current time. No more than 60 seconds should elapse between this timestamp and the time the request is made{body}is the body of the API request (this should be skipped if there is no request body)
-
Create an HMAC-SHA256 cryptographic hash where the text to hash is the string you created in step 1. The secret is the secret value associated with the API key being used to make the request.