How to generate the cap-signature header for POST and GET requests.
To ensure the security and integrity of every transaction, the CommercePay API requires a digital signature in the cap-signature header for all API requests except Authentication endpoint. This signature allows our server to verify that the request body has not been tampered with and originated from an authorized source.
Field name matching is case-insensitive, so your actual HTTP request body does not strictly
need to use camelCase keys. What matters is that the signature calculation below is always
performed on a camelCase, recursively-sorted representation of your payload — we still recommend
sending your request body in camelCase too, simply to avoid confusion between what you send and
what you sign.
Encoding rules for the string you sign
Do not escape non-ASCII characters. Sign the raw characters (e.g. 陈大文, Café), not
\uXXXX escape sequences. Many JSON libraries escape non-ASCII by default (for example Python’s
json.dumps — set ensure_ascii=False; .NET’s System.Text.Json — use an unescaped encoder).
The signature is verified against the unescaped form, so an escaped string will be rejected
with “Invalid Signature”. Your actual HTTP body may contain either form; only the string you
sign matters.
Do not escape anything beyond what JSON requires. Only ", \ and control characters are
escaped. Characters such as +, <, >, & and ' must appear as-is (some serializers,
e.g. System.Text.Json by default, turn a+b@x.com into a+b@x.com).
Encode as UTF-8. Convert both the final string and your Secret Key to UTF-8 bytes before
computing HMAC-SHA256.
Lowercasing applies to every character, including non-ASCII letters (e.g. É becomes é).
Use a Unicode-aware lowercase function, not an A–Z-only one.
POST Signature Generation
GET Signature Generation
POST Signature Generation
Follow these 6 steps to generate the cap-signature for your request.
1
Construct JSON (camelCase)
Prepare your request payload as a JSON object. Ensure all property names use camelCase (e.g., currencyCode, referenceCode).Omit any field that is null or was not provided — at every level, including inside nested
objects. Do not include it as "key": null; leave it out of the JSON entirely before you move
to the next step. (An empty string "" is a value, not null, and must be kept.)
2
Recursive Sorting (Ascending)
Sort all keys in the JSON object in ascending (A-Z) alphabetical order.Important: This must be done recursively. If your payload contains nested objects (like the customer object), their internal keys must also be sorted alphabetically.
3
Form the Signature String
Concatenate the Full Endpoint URL and the Sorted JSON string from Step 2 into one continuous string. Do NOT add any spaces between the URL and the JSON.Format: [FULL_URL][SORTED_JSON_STRING]
4
Normalize to Lowercase
Convert the entire combined string from Step 3 to lowercase. This ensures that minor casing differences in URLs or data do not cause a signature mismatch.
5
Generate HMAC-SHA256 Hash
Sign the lowercased string using the HMAC-SHA256 algorithm. Use your Secret Key as the cryptographic key.
6
Set the Header
Convert the resulting hash into a hexadecimal string. Place this value in the cap-signature header of your HTTP request.
Sorted JSON (raw UTF-8, not escaped): {"amount":100,"currencyCode":"MYR","customer":{"email":"test.user@example.com","name":"陈大文 Café"},"referenceCode":"TEST-111"}
3 & 4
Combined and lowercased: https://staging-payments.commerce.asia/api/services/app/paymentgateway/requestpayment{"amount":100,"currencycode":"myr","customer":{"email":"test.user@example.com","name":"陈大文 café"},"referencecode":"test-111"}
5 & 6
Final Hash: d6bb6d6b0e502ff08161655323df67deefddddb92088d2e144194ebfd18ead28
If you escape the non-ASCII characters ("name":"陈大文 café") you will
compute 3ae10f257f2f5a85716f875132801794bf61c3c5688905fea51d9d29d7402768 instead, which the
server rejects as an invalid signature.
Troubleshooting “Invalid Signature”
If you are receiving a 401 Unauthorized or Signature Mismatch error, check the following:
Minification: Ensure your JSON string is “minified” (no extra spaces, tabs, or newlines). The signature for {"a":1} is different from {"a": 1}.
Full URL: Ensure you are using the absolute URL (including https://) exactly as it is sent in the request.
Nested Keys: Double-check that nested objects like customer or billingAddress are sorted internally.
Lowercasing: Ensure the entire concatenated string (URL + JSON) is passed through a lowercase function before hashing.
Secret Key: Verify that you are using the correct Secret Key for the environment (Staging vs. Production).
For GET requests, the cap-signature is generated by converting your URL query parameters into a canonical JSON format before hashing. This ensures that the parameters cannot be tampered with in the URL.Follow these steps precisely to generate the signature for any GET request.
1
Convert Query Parameters to JSON (camelCase)
Take all parameters from your query string and represent them as a JSON object. Ensure all keys are in camelCase.Original URL: …?merchantId=MICH-01&amount=100Result:{"merchantId":"MICH-01","amount":100}Omit any parameter that is null or was not supplied — at every level, including inside nested
objects. Do not include it as "key": null; leave it out of the JSON entirely. (An empty
string "" is a value, not null, and must be kept.)
2
Recursive Sorting (Ascending)
Sort all keys in the JSON object in ascending (A-Z) alphabetical order. If any parameters contain nested objects or arrays, these must also be sorted internally.
3
Form the Signature String
Concatenate the Full Endpoint URL (excluding the query string itself) and the Sorted JSON string from Step 2.Format: [FULL_URL_WITHOUT_QUERY_STRING][SORTED_JSON_STRING]
4
Normalize to Lowercase
Convert the entire combined string from Step 3 to lowercase.
5
Generate HMAC-SHA256 Hash
Sign the lowercased string using the HMAC-SHA256 algorithm with your Secret Key.
6
Set the Header
Convert the resulting hash into a hexadecimal string and place it in the cap-signature header.
GET Integration Example
Base URL:https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QuerySecret Key:bd90787d8e2340b49757438d66eed86d209e6a36a32d865a8287f90b033b815dQuery Params:?TransactionNumber=20003D2625A16279BAB260115&Timestamp=1621851652617
Transformation Walkthrough
Step
Output / Action
1 & 2
Convert Query Params and Sorted JSON: {"timestamp":1621851652617,"transactionNumber":"20003D2625A16279BAB260115"}
Final cap-signature: a4f50b21c6e29ea7d93357906637a90a5ccf01016a61c52c218686b7ab0d2798
Troubleshooting GET Requests “Invalid Signature”
The “Base URL” Rule: When forming the string in Step 3, do NOT include the ? or the parameters in the URL portion. The parameters are only represented within the JSON string.
Minification: Ensure your JSON string contains NO extra whitespace (spaces, tabs, or newlines). {"a":1} is valid; {"a": 1} will fail.
Data Types: Numeric values (like timestamp or amount) should be represented as numbers in the JSON, not strings (no quotes), unless specified otherwise.
Case Sensitivity: Step 4 (Lowercasing) is mandatory. Even if your URL is already lowercase, the entire concatenated string must be processed through a lowercase function.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"CommercePay","colors":{"primary":"#5D40E6","light":"#9546E9","dark":"#5834E9"},"logo":{"light":"https://mintcdn.com/commercepay/zbo4Bt5Hnzxuhmp1/logo/commercepay-logo-cropped.png?fit=max\u0026auto=format\u0026n=zbo4Bt5Hnzxuhmp1\u0026q=85\u0026s=2818942319162624de2b3de633ee42ed","dark":"https://mintcdn.com/commercepay/zbo4Bt5Hnzxuhmp1/logo/commercepay-logo-cropped.png?fit=max\u0026auto=format\u0026n=zbo4Bt5Hnzxuhmp1\u0026q=85\u0026s=2818942319162624de2b3de633ee42ed"},"favicon":"https://mintcdn.com/commercepay/7PrnGTffSwt18xAA/favicon.ico?fit=max\u0026auto=format\u0026n=7PrnGTffSwt18xAA\u0026q=85\u0026s=5bc0f4406b0009f6658b13dd37c95f37","api":{"playground":{"display":"simple"}},"navbar":{"links":[{"href":"mailto:payments@commerce.asia","label":"Support"}]},"seo":{"metatags":{"google-site-verification":"dUzHLcHfcaknXY13Nu97zc6gj2DguWeqMvoJWcgBCa4","og:image":"/images/commercepay-og-image.png","twitter:image":"/images/commercepay-og-image.png"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"commercepay","hasAudioNarration":false,"actualSubdomain":"commercepay","customDomains":["docs.commercepay.asia"],"gitSource":{"type":"github","owner":"commerceasia","repo":"commercepay-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"DISABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6ae2d375bf78690ab5d17709","clientVersion":"0.0.4128","searchFilterCounts":[{"language":"default","tag":"API Reference","count":17},{"language":"default","tag":"Documentation","count":15},{"language":"default","tag":"All APIs","count":13},{"language":"default","tag":"PaymentGateway","count":10},{"language":"default","tag":"Get Started","count":7},{"language":"default","tag":"Payout APIs","count":3},{"language":"default","tag":"Payins","count":3},{"language":"default","tag":"Payouts","count":3},{"language":"default","tag":"Channel","count":2},{"language":"default","tag":"Payin APIs","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"img.nav-logo{height:2.25rem!important;width:auto!important}"}],"page":{"pagePath":"generate-signature","slug":"/generate-signature","pageMetadata":{"title":"Generate Signature","description":"How to generate the cap-signature header for POST and GET requests.","href":"/generate-signature"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"How to generate the cap-signature header for POST and GET requests.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Step,Steps,Tab,Table,Tabs,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`To ensure the security and integrity of every transaction, the CommercePay API requires a digital signature in the cap-signature header for all API requests except Authentication endpoint. This signature allows our server to verify that the request body has not been tampered with and originated from an authorized source.`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`Field name matching is case-insensitive, so your actual HTTP request body does not strictly\nneed to use camelCase keys. What matters is that the `,_jsx(_components.strong,{children:`signature calculation`}),` below is always\nperformed on a camelCase, recursively-sorted representation of your payload — we still recommend\nsending your request body in camelCase too, simply to avoid confusion between what you send and\nwhat you sign.`]})}),`\n`,_jsxs(Warning,{children:[_jsx(Heading,{level:`4`,id:`encoding-rules-for-the-string-you-sign`,children:`Encoding rules for the string you sign`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Do not escape non-ASCII characters.`}),` Sign the raw characters (e.g. `,_jsx(_components.code,{children:`陈大文`}),`, `,_jsx(_components.code,{children:`Café`}),`), not\n`,_jsx(_components.code,{children:`\\\\uXXXX`}),` escape sequences. Many JSON libraries escape non-ASCII by default (for example Python’s\n`,_jsx(_components.code,{children:`json.dumps`}),` — set `,_jsx(_components.code,{children:`ensure_ascii=False`}),`; .NET’s `,_jsx(_components.code,{children:`System.Text.Json`}),` — use an unescaped encoder).\nThe signature is verified against the unescaped form, so an escaped string will be rejected\nwith “Invalid Signature”. Your actual HTTP body may contain either form; only the string you\nsign matters.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Do not escape anything beyond what JSON requires.`}),` Only `,_jsx(_components.code,{children:`\"`}),`, `,_jsx(_components.code,{children:`\\\\`}),` and control characters are\nescaped. Characters such as `,_jsx(_components.code,{children:`+`}),`, `,_jsx(_components.code,{children:`\u003c`}),`, `,_jsx(_components.code,{children:`>`}),`, `,_jsx(_components.code,{children:`\u0026`}),` and `,_jsx(_components.code,{children:`'`}),` must appear as-is (some serializers,\ne.g. `,_jsx(_components.code,{children:`System.Text.Json`}),` by default, turn `,_jsx(_components.code,{children:`a+b@x.com`}),` into `,_jsx(_components.code,{children:`a+b@x.com`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Encode as UTF-8.`}),` Convert both the final string and your Secret Key to UTF-8 bytes before\ncomputing HMAC-SHA256.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Lowercasing applies to every character, including non-ASCII letters`}),` (e.g. `,_jsx(_components.code,{children:`É`}),` becomes `,_jsx(_components.code,{children:`é`}),`).\nUse a Unicode-aware lowercase function, not an A–Z-only one.`]}),`\n`]})]}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`POST Signature Generation`,id:`post-signature-generation`,\"data-child-heading-ids\":`[\"post-signature-generation\",\"integration-example\",\"transformation-walkthrough\",\"example-with-non-ascii-characters\",\"troubleshooting-%E2%80%9Cinvalid-signature%E2%80%9D\"]`,children:[_jsx(Heading,{level:`2`,id:`post-signature-generation`,children:`POST Signature Generation`}),_jsx(_components.p,{children:`Follow these 6 steps to generate the cap-signature for your request.`}),_jsxs(Steps,{children:[_jsxs(Step,{title:`Construct JSON (camelCase)`,children:[_jsx(_components.p,{children:`Prepare your request payload as a JSON object. Ensure all property names use camelCase (e.g., currencyCode, referenceCode).`}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Omit any field that is null or was not provided — at every level, including inside nested\nobjects.`}),` Do not include it as `,_jsx(_components.code,{children:`\"key\": null`}),`; leave it out of the JSON entirely before you move\nto the next step. (An empty string `,_jsx(_components.code,{children:`\"\"`}),` is a value, not null, and must be kept.)`]})]}),_jsxs(Step,{title:`Recursive Sorting (Ascending)`,children:[_jsx(_components.p,{children:`Sort all keys in the JSON object in ascending (A-Z) alphabetical order.`}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Important:`}),` This must be done recursively. If your payload contains nested objects (like the customer object), their internal keys must also be sorted alphabetically.`]})]}),_jsxs(Step,{title:`Form the Signature String`,children:[_jsxs(_components.p,{children:[`Concatenate the Full Endpoint URL and the Sorted JSON string from Step 2 into one continuous string. Do `,_jsx(_components.strong,{children:`NOT`}),` add any spaces between the URL and the JSON.`]}),_jsxs(_components.p,{children:[`Format: `,_jsx(_components.code,{children:`[FULL_URL][SORTED_JSON_STRING]`})]})]}),_jsx(Step,{title:`Normalize to Lowercase`,children:_jsx(_components.p,{children:`Convert the entire combined string from Step 3 to lowercase. This ensures that minor casing differences in URLs or data do not cause a signature mismatch.`})}),_jsx(Step,{title:`Generate HMAC-SHA256 Hash`,children:_jsx(_components.p,{children:`Sign the lowercased string using the HMAC-SHA256 algorithm. Use your Secret Key as the cryptographic key.`})}),_jsx(Step,{title:`Set the Header`,children:_jsx(_components.p,{children:`Convert the resulting hash into a hexadecimal string. Place this value in the cap-signature header of your HTTP request.`})})]}),_jsx(Heading,{level:`3`,id:`integration-example`,children:`Integration Example`}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Staging URL:`}),` `,_jsx(_components.a,{href:`https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RequestPayment`,children:`https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RequestPayment`})]}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Secret Key:`}),` bd90787d8e2340b49757438d66eed86d209e6a36a32d865a8287f90b033b815d`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Raw Request Payload`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"currencyCode\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"MYR\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"amount\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"referenceCode\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"TEST-111\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"customer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Test User\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"email\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"test.user@example.com\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`transformation-walkthrough`,children:`Transformation Walkthrough`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Step`}),_jsx(_components.th,{children:`Output / Action`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1 \u0026 2`}),_jsxs(_components.td,{children:[`Sorted JSON: `,_jsx(_components.code,{children:`{\"amount\":100,\"currencyCode\":\"MYR\",\"customer\":{\"email\":\"test.user@example.com\",\"name\":\"Test User\"},\"referenceCode\":\"TEST-111\"}`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`3`}),_jsxs(_components.td,{children:[`Combined: `,_jsx(_components.code,{children:`https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RequestPayment{\"amount\":100,\"currencyCode\":\"MYR\",\"customer\":{\"email\":\"test.user@example.com\",\"name\":\"Test User\"},\"referenceCode\":\"TEST-111\"}`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`4`}),_jsxs(_components.td,{children:[`Lowercased: `,_jsx(_components.code,{children:`https://staging-payments.commerce.asia/api/services/app/paymentgateway/requestpayment{\"amount\":100,\"currencycode\":\"myr\",\"customer\":{\"email\":\"test.user@example.com\",\"name\":\"test user\"},\"referencecode\":\"test-111\"}`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`5 \u0026 6`}),_jsxs(_components.td,{children:[`Final Hash: `,_jsx(_components.code,{children:`477d7efe6d3c319a722bd202d3434dbfde3fe19877febb0e5c62ef85e7d30efd`})]})]})]})]}),_jsx(Heading,{level:`3`,id:`example-with-non-ascii-characters`,children:`Example with non-ASCII characters`}),_jsxs(_components.p,{children:[`Same endpoint and Secret Key as above, with `,_jsx(_components.code,{children:`customer.name`}),` changed to `,_jsx(_components.code,{children:`陈大文 Café`}),`.`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Raw Request Payload`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"currencyCode\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"MYR\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"amount\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"referenceCode\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"TEST-111\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"customer\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"陈大文 Café\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"email\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"test.user@example.com\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Step`}),_jsx(_components.th,{children:`Output / Action`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1 \u0026 2`}),_jsxs(_components.td,{children:[`Sorted JSON (raw UTF-8, `,_jsx(_components.strong,{children:`not`}),` escaped): `,_jsx(_components.code,{children:`{\"amount\":100,\"currencyCode\":\"MYR\",\"customer\":{\"email\":\"test.user@example.com\",\"name\":\"陈大文 Café\"},\"referenceCode\":\"TEST-111\"}`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`3 \u0026 4`}),_jsxs(_components.td,{children:[`Combined and lowercased: `,_jsx(_components.code,{children:`https://staging-payments.commerce.asia/api/services/app/paymentgateway/requestpayment{\"amount\":100,\"currencycode\":\"myr\",\"customer\":{\"email\":\"test.user@example.com\",\"name\":\"陈大文 café\"},\"referencecode\":\"test-111\"}`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`5 \u0026 6`}),_jsxs(_components.td,{children:[`Final Hash: `,_jsx(_components.code,{children:`d6bb6d6b0e502ff08161655323df67deefddddb92088d2e144194ebfd18ead28`})]})]})]})]}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`If you escape the non-ASCII characters (`,_jsx(_components.code,{children:`\"name\":\"陈大文 café\"`}),`) you will\ncompute `,_jsx(_components.code,{children:`3ae10f257f2f5a85716f875132801794bf61c3c5688905fea51d9d29d7402768`}),` instead, which the\nserver rejects as an invalid signature.`]})}),_jsxs(Warning,{children:[_jsx(Heading,{level:`4`,id:`troubleshooting-“invalid-signature”`,children:`Troubleshooting “Invalid Signature”`}),_jsxs(_components.p,{children:[`If you are receiving a `,_jsx(_components.strong,{children:`401 Unauthorized`}),` or `,_jsx(_components.strong,{children:`Signature Mismatch`}),` error, check the following:`]}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Minification:`}),` Ensure your JSON string is “minified” (no extra spaces, tabs, or newlines). The signature for `,_jsx(_components.code,{children:`{\"a\":1}`}),` is different from `,_jsx(_components.code,{children:`{\"a\": 1}`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Full URL:`}),` Ensure you are using the absolute URL (including https://) exactly as it is sent in the request.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Nested Keys:`}),` Double-check that nested objects like customer or billingAddress are sorted internally.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Lowercasing:`}),` Ensure the entire concatenated string (URL + JSON) is passed through a lowercase function before hashing.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Secret Key:`}),` Verify that you are using the correct Secret Key for the environment (Staging vs. Production).`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Investigate payment signatures via the `,_jsx(_components.a,{href:`https://staging-backoffice-payments.commerce.asia/app/paymentgateway/signaturevalidator`,children:`Signature Validator Tool`}),`.`]}),`\n`]}),`\n`]})]})]}),_jsxs(Tab,{title:`GET Signature Generation`,id:`get-signature-generation`,\"data-child-heading-ids\":`[\"get-signature-generation\",\"get-integration-example\",\"transformation-walkthrough-2\",\"troubleshooting-get-requests-%E2%80%9Cinvalid-signature%E2%80%9D\"]`,children:[_jsx(Heading,{level:`2`,id:`get-signature-generation`,children:`GET Signature Generation`}),_jsx(_components.p,{children:`For GET requests, the cap-signature is generated by converting your URL query parameters into a canonical JSON format before hashing. This ensures that the parameters cannot be tampered with in the URL.`}),_jsx(_components.p,{children:`Follow these steps precisely to generate the signature for any GET request.`}),_jsxs(Steps,{children:[_jsxs(Step,{title:`Convert Query Parameters to JSON (camelCase)`,children:[_jsx(_components.p,{children:`Take all parameters from your query string and represent them as a JSON object. Ensure all keys are in camelCase.`}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Original URL:`}),` …?merchantId=MICH-01\u0026amount=100`]}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Result:`}),` `,_jsx(_components.code,{children:`{\"merchantId\":\"MICH-01\",\"amount\":100}`})]}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Omit any parameter that is null or was not supplied — at every level, including inside nested\nobjects.`}),` Do not include it as `,_jsx(_components.code,{children:`\"key\": null`}),`; leave it out of the JSON entirely. (An empty\nstring `,_jsx(_components.code,{children:`\"\"`}),` is a value, not null, and must be kept.)`]})]}),_jsx(Step,{title:`Recursive Sorting (Ascending)`,children:_jsx(_components.p,{children:`Sort all keys in the JSON object in ascending (A-Z) alphabetical order. If any parameters contain nested objects or arrays, these must also be sorted internally.`})}),_jsxs(Step,{title:`Form the Signature String`,children:[_jsx(_components.p,{children:`Concatenate the Full Endpoint URL (excluding the query string itself) and the Sorted JSON string from Step 2.`}),_jsxs(_components.p,{children:[`Format: `,_jsx(_components.code,{children:`[FULL_URL_WITHOUT_QUERY_STRING][SORTED_JSON_STRING]`})]})]}),_jsx(Step,{title:`Normalize to Lowercase`,children:_jsx(_components.p,{children:`Convert the entire combined string from Step 3 to lowercase.`})}),_jsx(Step,{title:`Generate HMAC-SHA256 Hash`,children:_jsx(_components.p,{children:`Sign the lowercased string using the HMAC-SHA256 algorithm with your Secret Key.`})}),_jsx(Step,{title:`Set the Header`,children:_jsx(_components.p,{children:`Convert the resulting hash into a hexadecimal string and place it in the cap-signature header.`})})]}),_jsx(Heading,{level:`3`,id:`get-integration-example`,children:`GET Integration Example`}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Base URL:`}),` `,_jsx(_components.code,{children:`https://staging-payments.commerce.asia/api/services/app/PaymentGateway/Query`})]}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Secret Key:`}),` `,_jsx(_components.code,{children:`bd90787d8e2340b49757438d66eed86d209e6a36a32d865a8287f90b033b815d`})]}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Query Params:`}),` `,_jsx(_components.code,{children:`?TransactionNumber=20003D2625A16279BAB260115\u0026Timestamp=1621851652617`})]}),_jsx(Heading,{level:`3`,id:`transformation-walkthrough-2`,children:`Transformation Walkthrough`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Step`}),_jsx(_components.th,{children:`Output / Action`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1 \u0026 2`}),_jsxs(_components.td,{children:[`Convert Query Params and Sorted JSON: `,_jsx(_components.code,{children:`{\"timestamp\":1621851652617,\"transactionNumber\":\"20003D2625A16279BAB260115\"} `})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`3`}),_jsxs(_components.td,{children:[`Combined: `,_jsx(_components.code,{children:`https://staging-payments.commerce.asia/api/services/app/PaymentGateway/Query{\"timestamp\":1621851652617,\"transactionNumber\":\"20003D2625A16279BAB260115\"}`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`4`}),_jsxs(_components.td,{children:[`Lowercased: `,_jsx(_components.code,{children:`https://staging-payments.commerce.asia/api/services/app/paymentgateway/query{\"timestamp\":1621851652617,\"transactionnumber\":\"20003d2625a16279bab260115\"}`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`5 \u0026 6`}),_jsxs(_components.td,{children:[`Final `,_jsx(_components.code,{children:`cap-signature: a4f50b21c6e29ea7d93357906637a90a5ccf01016a61c52c218686b7ab0d2798`})]})]})]})]}),_jsxs(Warning,{children:[_jsx(Heading,{level:`4`,id:`troubleshooting-get-requests-“invalid-signature”`,children:`Troubleshooting GET Requests “Invalid Signature”`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`The “Base URL” Rule:`}),` When forming the string in Step 3, do `,_jsx(_components.strong,{children:`NOT`}),` include the ? or the parameters in the URL portion. The parameters are only represented within the JSON string.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Minification:`}),` Ensure your JSON string contains `,_jsx(_components.strong,{children:`NO extra whitespace`}),` (spaces, tabs, or newlines). `,_jsx(_components.code,{children:`{\"a\":1}`}),` is valid; `,_jsx(_components.code,{children:`{\"a\": 1}`}),` will fail.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Data Types:`}),` Numeric values (like timestamp or amount) should be represented as numbers in the JSON, not strings (no quotes), unless specified otherwise.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Case Sensitivity:`}),` Step 4 (Lowercasing) is mandatory. Even if your URL is already lowercase, the entire concatenated string must be processed through a lowercase function.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Investigate payment signatures via the `,_jsx(_components.a,{href:`https://staging-backoffice-payments.commerce.asia/app/paymentgateway/signaturevalidator`,children:`Signature Validator Tool`}),`.`]}),`\n`]}),`\n`]})]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Generate Signature","description":"How to generate the cap-signature header for POST and GET requests.","href":"/generate-signature"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Encoding rules for the string you sign","slug":"encoding-rules-for-the-string-you-sign","depth":4,"children":[]},{"title":"POST Signature Generation","slug":"post-signature-generation","depth":2,"children":[{"title":"Integration Example","slug":"integration-example","depth":3,"children":[],"tabId":"post-signature-generation"},{"title":"Transformation Walkthrough","slug":"transformation-walkthrough","depth":3,"children":[],"tabId":"post-signature-generation"},{"title":"Example with non-ASCII characters","slug":"example-with-non-ascii-characters","depth":3,"children":[],"tabId":"post-signature-generation"},{"title":"Troubleshooting “Invalid Signature”","slug":"troubleshooting-“invalid-signature”","depth":4,"children":[],"tabId":"post-signature-generation"}],"tabId":"post-signature-generation"},{"title":"GET Signature Generation","slug":"get-signature-generation","depth":2,"children":[{"title":"GET Integration Example","slug":"get-integration-example","depth":3,"children":[],"tabId":"get-signature-generation"},{"title":"Transformation Walkthrough","slug":"transformation-walkthrough-2","depth":3,"children":[],"tabId":"get-signature-generation"},{"title":"Troubleshooting GET Requests “Invalid Signature”","slug":"troubleshooting-get-requests-“invalid-signature”","depth":4,"children":[],"tabId":"get-signature-generation"}],"tabId":"get-signature-generation"}],"codeExamples":{}},"jsLinks":[],"subdomain":"commercepay","siteName":"CommercePay","title":"Generate Signature - CommercePay","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-29T09:31:13.132Z","originalFileLocation":"generate-signature.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"How to generate the cap-signature header for POST and GET requests.\">\u003cmeta data-mint-head name=\"application-name\" content=\"CommercePay\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Generate Signature - CommercePay\">\u003cmeta data-mint-head property=\"og:description\" content=\"How to generate the cap-signature header for POST and GET requests.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"CommercePay\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.commercepay.asia/generate-signature\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://commercepay.mintlify.site/images/commercepay-og-image.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Generate Signature - CommercePay\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"How to generate the cap-signature header for POST and GET requests.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://commercepay.mintlify.site/images/commercepay-og-image.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/commercepay/GH8Bb27qvn280PyP/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"CommercePay\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#5D40E6\">\u003cmeta data-mint-head name=\"google-site-verification\" content=\"dUzHLcHfcaknXY13Nu97zc6gj2DguWeqMvoJWcgBCa4\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.commercepay.asia/generate-signature\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/generate-signature.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.commercepay.asia/#organization\",\"name\":\"CommercePay\",\"url\":\"https://docs.commercepay.asia\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/commercepay/zbo4Bt5Hnzxuhmp1/logo/commercepay-logo-cropped.png?fit=max\u0026auto=format\u0026n=zbo4Bt5Hnzxuhmp1\u0026q=85\u0026s=2818942319162624de2b3de633ee42ed\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.commercepay.asia#website\",\"name\":\"CommercePay\",\"url\":\"https://docs.commercepay.asia\",\"publisher\":{\"@id\":\"https://docs.commercepay.asia/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.commercepay.asia/generate-signature#webpage\",\"url\":\"https://docs.commercepay.asia/generate-signature\",\"name\":\"Generate Signature\",\"description\":\"How to generate the cap-signature header for POST and GET requests.\",\"dateModified\":\"2026-09-29T09:31:13.132Z\",\"isPartOf\":{\"@id\":\"https://docs.commercepay.asia#website\"},\"breadcrumb\":{\"@id\":\"https://docs.commercepay.asia/generate-signature#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.commercepay.asia/generate-signature#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Get Started\",\"item\":\"https://docs.commercepay.asia/get-started\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Generate Signature\",\"item\":\"https://docs.commercepay.asia/generate-signature\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.commercepay.asia/generate-signature#article\",\"headline\":\"Generate Signature\",\"name\":\"Generate Signature\",\"description\":\"How to generate the cap-signature header for POST and GET requests.\",\"url\":\"https://docs.commercepay.asia/generate-signature\",\"mainEntityOfPage\":{\"@id\":\"https://docs.commercepay.asia/generate-signature#webpage\"},\"image\":\"https://docs.commercepay.asia/images/commercepay-og-image.png\",\"dateModified\":\"2026-09-29T09:31:13.132Z\",\"publisher\":{\"@id\":\"https://docs.commercepay.asia/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.commercepay.asia#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"CommercePay\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"CommercePay\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/generate-signature.md","siteName":"CommercePay","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Overview","href":"/overview"},{"group":"Get Started","pages":[{"title":"Setup Guide","href":"/get-started"},{"title":"API Credentials","href":"/api-credentials"},{"title":"Service Environments","href":"/service-environments"},{"title":"Request Headers","description":"Required headers for every CommercePay API request.","href":"/request-headers"},{"title":"Generate Signature","href":"/generate-signature"},{"title":"Callback Notifications","description":"How CommercePay notifies your server of payment status changes via signed host-to-host callbacks.","href":"/callback-notifications"},{"title":"Channel List","href":"/channel-list"}]},{"group":"Payins","pages":[{"title":"Direct Integration","href":"/direct-integration"},{"title":"Hosted Session Checkout","href":"/hosted-session-checkout"},{"title":"Recurring Payments","href":"/recurring-payments"}]},{"group":"Payouts","pages":[{"title":"Payout Integration","href":"/payout-integration"},{"title":"Payout Provider Channel Code","href":"/payout-provider-channel"},{"title":"Payout Test Accounts","href":"/payout-test-account"}]},{"group":"Refunds","pages":[{"title":"Refund Integration","href":"/refund-integration"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/get-access-token"}]}]},"basePath":"","title":"Generate Signature - CommercePay","buildId":"dpl_5tKr6cUUeuVJdEZ9JAEY3h4soMJ8","deploymentId":"dpl_5tKr6cUUeuVJdEZ9JAEY3h4soMJ8","dynamics":[],"chunks":[]}