Generate or verify a PayHere signature
generate_signatureComputes a PayHere MD5 hash for checkout submissions or validates incoming notify URL signatures, returning verification result if expected signature provided.
Instructions
Computes a PayHere MD5 hash for either checkout submission (mode='checkout') or notify URL validation (mode='notify'). For notify mode, pass expectedMd5Sig to verify an incoming signature in one shot. Uses the merchant secret from the server's environment — never include the secret in tool arguments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | Which hash variant to compute | |
| merchantId | No | Merchant ID. Defaults to PAYHERE_MERCHANT_ID env var. | |
| orderId | Yes | ||
| amount | No | Required for mode='checkout'. Formatted to 2dp internally. | |
| currency | No | Required for mode='checkout'. ISO 4217 (e.g. LKR). | |
| payhereAmount | No | Required for mode='notify'. As sent by PayHere. | |
| payhereCurrency | No | Required for mode='notify'. As sent by PayHere. | |
| statusCode | No | Required for mode='notify'. PayHere status_code value. | |
| expectedMd5Sig | No | Optional for mode='notify'. If provided, returns verification result instead of just the hash. |