Signed URLs

LaterPay’s APIs expect signed URLs. LaterPay can also redirect their users to merchant websites using signed URLs.

Merchants can sign URLs using their secret key.

When the signature is calculated using signing algorithm it is added to the url as hmac query parameter. For example if the signature for a HTTP GET request to is fakesignature then following are valid signed URLs:



LaterPay provides a /validatesignature endpoint where merchants can test if their URL signing process and their credentials are correct.

Signing algorithm

LaterPay APIs use following algorithm to calculate the signature for incoming requests:

  1. Obtain the following:


    secret string used to sign the request. Example "fakesecret".


    HTTP url consisting of scheme, host, path and without query and fragment parts. For example if a request went to the base_url would be ""


    HTTP method used in the request. Examples: "GET", "POST", "PUT", "DELETE". Must be uppercase.


    a list of key value pairs constructed from URL’s query string. There can be multiple pairs with the same key. Example (("k2", "v1"), ("k1", "v2"), ("k1", "v1")) from

  2. Make sure http_method, base_url and all params (both keys and values) are UTF-8 encoded and percent encode them. For example:

    • http_method: "GET" becomes "GET".

    • base_url: "" becomes ""

    • params:

      (("kæy", "vąl"), ("safe?", "1 + 2 = 3"), ("k1", "v2"), ("k1", "v1"))


      (("k%C3%A6y", "v%C4%85l"), ("safe%3F", "1%20%2B%202%20%3D%203"), ("k1", "v2"), ("k1", "v1"))
  3. Alphabetically sort params. First by key and if there are multiple pairs with the same key then by value as well. For example

    (("k%C3%A6y", "v%C4%85l"), ("safe%3F", "1%20%2B%202%20%3D%203"), ("k1", "v2"), ("k1", "v1"))

    should become

    (("k%C3%A6y", "v%C4%85l"), ("k1", "v1"), ("k1", "v2"), ("safe%3F", "1%20%2B%202%20%3D%203"))
  4. Join encoded and sorted params into one string by taking each key/value pair and joining it with "=" and then joining the resulting pairs with "&". For example:

    (("k%C3%A6y", "v%C4%85l"), ("k1", "v1"), ("k1", "v2"), ("safe%3F", "1%20%2B%202%20%3D%203"))


  5. Now percent encode the params string. For example



  6. Create the message for signing by joining http_method, base_url and params strings with "&". For example a message for a "GET" request toæy=vąl&safe?=1 + 2 = 3&k1=v2&k1=v1 would be

  7. Compute a HMAC using SHA-224 with secret and message. This value HEX encoded and in lowercase is the signature. Signature created using a "fakesecret" secret and our message:


    is "cc4ddc63ed0bbea9d1cfad38e4a3f511608510713b33c4585bfa86dd".

Code Libraries

This is the list of code libraries implementing the signing scheme used by LaterPay: