Draft API Preview for the MorphosisBlock Payment API. Header names and signing rules are proposed contract material. No credential issued for another system should be used with these examples.

Morphosis HMAC v1

Each draft API request proves possession of a merchant signing secret without sending that secret over the network. Generate the signature from the exact request bytes before transmission. Five request headers identify the key, version, time, nonce, and signature. One canonical string binds them to the method, request target, and body.

Required headers

POST /v2/payments also requires an Idempotency-Key, but that header is not part of the v1 canonical string. Use a stable key for one logical payment.

Canonical request

Join these six values with a single line-feed character:
The final line is the unpadded base64url encoding of the SHA-256 digest of the exact request body bytes. For an empty body, hash an empty byte sequence. The path line contains the exact path and query transmitted on the wire. A request without a query uses /v2/payments, not a host name or full URL.

Compute the signature

JSON formatting changes the body bytes. Serialize once, sign those bytes, and send the same bytes. Do not parse and reserialize the body after signing.

Replay resistance

  • Generate a cryptographically random nonce for every request.
  • Send current Unix time in whole seconds.
  • Never reuse a nonce, even when another field changes.
  • Keep merchant clocks synchronized.
  • Compare signatures in constant time in any verification tooling.
The final accepted timestamp window and nonce retention period are launch parameters and are not promised by this draft preview.

Credential handling

Store the key identifier and signing secret in a managed secret store or local environment variables excluded from version control. Never place a live secret in browser code, mobile applications, logs, screenshots, support tickets, or documentation.