Sign withdrawals and refunds with RFC 8785 JCS and HMAC-SHA256.
Requests that move funds require an additional signature. This protects the
HTTP method, exact route, timestamp, request ID, and complete JSON body from
tampering.The following endpoints require signing:
POST /public/v1/withdrawals/create
POST /public/v1/refunds/refundCrypto
POST /public/v1/refunds/refundFiat
Invoice creation and read-only endpoints continue to use the API key without
these additional signing headers.The official TypeScript,
Python, and
PHP SDKs calculate these signatures
automatically when you configure the original API secretKey. Use the manual
procedure below for direct HTTP integrations.
Required headers
x-api-key: <merchant API key>x-billions-timestamp: <current Unix time in seconds>x-billions-request-id: <UUID for this logical operation>x-billions-request-signature: v1=<64 lowercase HMAC hex characters>content-type: application/json
The timestamp must be within five minutes of Billions server time. The request
ID provides idempotency and becomes request.id in a successful response.
Signature calculation
Parse the body as JSON and canonicalize it using
RFC 8785 JCS. The exact route
path must include /public/v1 and must not include the hostname or query string.
Use the original secretKey returned once when the API key was created as
UTF-8 text. Although it looks like a 64-character hexadecimal value, do not
hex-decode it. Older API keys that were issued before signed operations were
introduced must be revoked and reissued.
Use an RFC 8785-compatible library to produce $canonicalJson; ordinary
json_encode() with sorted top-level keys is not sufficient.
<?php$path = '/public/v1/withdrawals/create';$body = [ 'currency' => 'EUR', 'amount' => '70', 'withdrawalMethodId' => 123,];$timestamp = (string) time();// uuid_create() is provided by the PECL UUID extension. Any RFC 4122 UUID v4// generator can be used here.$requestId = uuid_create(UUID_TYPE_RANDOM);// Produce this with an RFC 8785 JCS implementation.$canonicalJson = $jcsCanonicalizer->canonicalize($body);$message = "POST\n{$path}\n{$timestamp}\n{$requestId}\n{$canonicalJson}";$signature = hash_hmac('sha256', $message, $secretKey);$headers = [ 'Content-Type: application/json', 'x-api-key: ' . $apiKey, 'x-billions-timestamp: ' . $timestamp, 'x-billions-request-id: ' . $requestId, 'x-billions-request-signature: v1=' . $signature,];
Safe retries
For a retry caused by a timeout or lost response:
reuse the same request ID;
reuse the identical JSON body and endpoint;
calculate a fresh timestamp and signature if the old timestamp expired.
With an SDK, persist the request ID before the first call and pass that same ID
and payload on retry. The SDK creates a fresh timestamp and signature for each
call.Retrying an identical completed operation returns the original request without
creating another debit or payout. Reusing a request ID with another body or
endpoint returns 409. If the original request is still running or requires
reconciliation, the retry also returns 409.
Common responses
Status
Meaning
400
The signed JSON is valid, but operation data or business validation failed
401
API key, timestamp, request ID format, or signature is missing or invalid
403
The API key must be reissued before signed operations can be used
409
The request ID was reused with different data, or the original operation is still being reconciled
Never generate a new request ID only because the response was lost. A new ID
authorizes a new financial operation.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Billions","description":"Integrate Billions payments into your application, store, or billing platform.","colors":{"primary":"#FC4C07","light":"#FC4C07","dark":"#FF7138"},"logo":{"light":"https://mintcdn.com/billions/GmnorJJmmpzZPFoc/logo/logo-black.svg?fit=max\u0026auto=format\u0026n=GmnorJJmmpzZPFoc\u0026q=85\u0026s=e47ff33b3137a04e2ae4b8773ec5e5af","dark":"https://mintcdn.com/billions/GmnorJJmmpzZPFoc/logo/logo-white.svg?fit=max\u0026auto=format\u0026n=GmnorJJmmpzZPFoc\u0026q=85\u0026s=81016c8b19a97e7ddecb5ae8a5681578","href":"https://billions.works"},"api":{"playground":{"display":"simple"}},"appearance":{"default":"system","strict":false},"background":{"color":{"light":"#FFFFFF","dark":"#111110"}},"navbar":{"links":[{"href":"https://app.billions.works","label":"Dashboard"}]},"footer":{"socials":{"github":"https://github.com/billions-works"}},"seo":{"metatags":{"og:image":"https://billions.works/images/og/og-image.png","twitter:image":"https://billions.works/images/og/og-image.png","twitter:card":"summary_large_image"},"indexing":"all"},"fonts":{"family":"Instrument Sans"},"styling":{"eyebrows":"breadcrumbs","codeblocks":{"theme":{"light":"github-dark","dark":"github-dark"}},"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"billions","hasAudioNarration":false,"actualSubdomain":"billions","customDomains":["docs.billions.works"],"gitSource":{"type":"github","owner":"billions-works","repo":"mintlify-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":"","_id":"6b10f86c9ffae5051c41a66c"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6b00203dde75caffbb015865","clientVersion":"0.0.4453","searchFilterCounts":[{"language":"default","tag":"Developer","count":25},{"language":"default","tag":"Integration guide","count":6},{"language":"default","tag":"Public API","count":5},{"language":"default","tag":"Platform integrations","count":5},{"language":"default","tag":"SDKs","count":4},{"language":"default","tag":"Examples","count":3},{"language":"default","tag":"Legal","count":2},{"language":"default","tag":"Overview","count":1},{"language":"default","tag":"Introduction","count":1},{"language":"default","tag":"Testing","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":"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":"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":"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":"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":"turbopuffer-dual-write","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":"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":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":":root{--billions-accent: #fc4c07;--billions-accent-hover: #e24406;--billions-accent-soft: #f6e4dd;--billions-background: #ffffff;--billions-surface: #fafafa;--billions-surface-raised: #ffffff;--billions-border: #ededed;--billions-heading: #000000;--billions-text: #555555;--billions-muted: #737373;--billions-code: #222221;--billions-shadow: 0 10px 30px rgb(0 0 0 / 4%)}html.dark{--billions-accent: #ff7138;--billions-accent-hover: #ff8657;--billions-accent-soft: rgb(252 76 7 / 16%);--billions-background: #111110;--billions-surface: #181817;--billions-surface-raised: #1e1e1c;--billions-border: #30302d;--billions-heading: #ffffff;--billions-text: #c8c8c8;--billions-muted: #92928d;--billions-code: #222221;--billions-shadow: 0 12px 36px rgb(0 0 0 / 24%)}html,body,#body-content{background-color:var(--billions-background)}body{color:var(--billions-text);font-variation-settings:\"wdth\" 100;text-rendering:optimizeLegibility}#navbar{min-height:76px;border-bottom-color:var(--billions-border);background-color:color-mix(in srgb, var(--billions-background) 92%, transparent);backdrop-filter:blur(16px)}#sidebar-content{scrollbar-color:var(--billions-border) transparent}#sidebar-content li[data-active]{color:var(--billions-accent);background:var(--billions-accent-soft);border-radius:10px}toc-item[data-active],toc-item[data-active-deepest]{color:var(--billions-accent)}[data-component-name=\"theme-toggle\"],#topbar-cta-button{border-color:var(--billions-border);border-radius:16px}#topbar-cta-button{box-shadow:none}#content-area{padding-top:48px}#content{max-width:712px}#page-title{color:var(--billions-heading);font-size:clamp(2.5rem, 4vw, 3rem);font-weight:500;line-height:1.04;letter-spacing:-0.035em}#content h2{color:var(--billions-heading);font-size:2rem;font-weight:500;line-height:1.125;letter-spacing:-0.025em}#content h3,#content h4{color:var(--billions-heading);font-weight:550;letter-spacing:-0.015em}#content p,#content li{line-height:1.625}#content a:not([class]){text-decoration-color:color-mix(in srgb, var(--billions-accent) 38%, transparent);text-underline-offset:3px}html[data-current-path$=\"/integration/unified-merchant-api\"] #content [data-as=\"p\"]:has(>em:only-child){color:var(--billions-muted);font-size:0.75rem}card,.card{border-color:var(--billions-border)!important;border-radius:24px!important;background:var(--billions-surface)!important;box-shadow:none!important;transition:border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease}card:hover,.card:hover{border-color:color-mix(in srgb, var(--billions-accent) 38%, var(--billions-border))!important;box-shadow:var(--billions-shadow)!important;transform:translateY(-1px)}callout,.callout{border-radius:16px!important;border-width:1px!important;border-style:solid!important}.callout[data-callout-type=\"note\"]{border-color:#bfd4ff!important}.callout[data-callout-type=\"tip\"]{border-color:#9edfc4!important}.callout[data-callout-type=\"info\"]{border-color:#d4d4d4!important}.callout[data-callout-type=\"warning\"]{border-color:#f3c985!important}.callout[data-callout-type=\"danger\"]{border-color:#f4aaa6!important}html.dark .callout[data-callout-type=\"note\"]{border-color:#315ca8!important}html.dark .callout[data-callout-type=\"tip\"]{border-color:#277253!important}html.dark .callout[data-callout-type=\"info\"]{border-color:#575757!important}html.dark .callout[data-callout-type=\"warning\"]{border-color:#8c5c17!important}html.dark .callout[data-callout-type=\"danger\"]{border-color:#963e39!important}steps,.steps{--tw-prose-counters: var(--billions-accent)}.step [data-component-part=\"step-line\"]{display:none}.step [data-component-part=\"step-number\"]{color:inherit;background:transparent;border:0;border-radius:0}.step [data-component-part=\"step-number\"]>div{width:28px;height:28px;color:var(--billions-accent);background:var(--billions-accent-soft);border:0;border-radius:9999px}code-block,code-group,.code-block,.code-group{overflow:hidden;border-color:color-mix(in srgb, var(--billions-code) 82%, white)!important;border-radius:12px!important;background:var(--billions-code)!important}#content .code-block [data-component-part=\"code-block-root\"],#content .code-group [data-component-part=\"code-block-root\"],.code-block pre.shiki,.code-group pre.shiki{color:var(--shiki-dark, #d4d4d4)!important;background-color:var(--billions-code)!important}.code-block pre.shiki span,.code-group pre.shiki span{color:var(--shiki-dark, inherit)!important}.code-block [data-fade-overlay],.code-group [data-fade-overlay]{--fade-color-light: var(--billions-code) !important;--fade-color-dark: var(--billions-code) !important}.code-block [data-floating-buttons] button,.code-group [data-floating-buttons] button{color:#a3a3a3;background:var(--billions-code)!important}.code-block [data-floating-buttons] button:hover,.code-group [data-floating-buttons] button:hover{color:#ffffff}.code-block [data-floating-buttons] button svg,.code-group [data-floating-buttons] button svg{color:inherit!important}#content :not(pre)>code{color:var(--billions-heading);background:var(--billions-surface);border:1px solid var(--billions-border);border-radius:7px}#content table{overflow:hidden;border:1px solid var(--billions-border);border-radius:16px;border-collapse:separate;border-spacing:0}#content thead{color:var(--billions-heading);background:var(--billions-surface)}#content th,#content td{border-color:var(--billions-border)}#content th{padding-top:8px}#content th:first-child,#content td:first-child{padding-left:16px}#content th:last-child,#content td:last-child{padding-right:16px}::selection{color:var(--billions-heading);background:var(--billions-accent-soft)}@media (max-width: 1023px){#content-area{padding-top:36px}}@media (max-width: 767px){#navbar{min-height:64px}#content-area{padding-top:28px}#page-title{font-size:2.25rem;line-height:1.08}#content h2{font-size:1.75rem}card,.card{border-radius:20px!important}}@media (prefers-reduced-motion: reduce){card,.card{transition:none}}"}]}
{"page":{"pagePath":"api/request-signing","slug":"/api/request-signing","pageMetadata":{"title":"Request signing","description":"Sign withdrawals and refunds with RFC 8785 JCS and HMAC-SHA256.","icon":"signature","href":"/api/request-signing"},"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: \"Sign withdrawals and refunds with RFC 8785 JCS and HMAC-SHA256.\"\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,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Requests that move funds require an additional signature. This protects the\nHTTP method, exact route, timestamp, request ID, and complete JSON body from\ntampering.`}),`\n`,_jsx(_components.p,{children:`The following endpoints require signing:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`POST /public/v1/withdrawals/create`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`POST /public/v1/refunds/refundCrypto`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`POST /public/v1/refunds/refundFiat`})}),`\n`]}),`\n`,_jsx(_components.p,{children:`Invoice creation and read-only endpoints continue to use the API key without\nthese additional signing headers.`}),`\n`,_jsxs(_components.p,{children:[`The official `,_jsx(_components.a,{href:`/sdks/typescript#withdrawals-and-refunds`,children:`TypeScript`}),`,\n`,_jsx(_components.a,{href:`/sdks/python#withdrawals-and-refunds`,children:`Python`}),`, and\n`,_jsx(_components.a,{href:`/sdks/php#withdrawals-and-refunds`,children:`PHP`}),` SDKs calculate these signatures\nautomatically when you configure the original API `,_jsx(_components.code,{children:`secretKey`}),`. Use the manual\nprocedure below for direct HTTP integrations.`]}),`\n`,_jsx(Heading,{level:`2`,id:`required-headers`,children:`Required headers`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-dark github-dark`,style:{backgroundColor:`#24292e`,\"--shiki-dark-bg\":`#24292e`,color:`#e1e4e8`,\"--shiki-dark\":`#e1e4e8`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`x-api-key: \u003cmerchant API key>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`x-billions-timestamp: \u003ccurrent Unix time in seconds>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`x-billions-request-id: \u003cUUID for this logical operation>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`x-billions-request-signature: v1=\u003c64 lowercase HMAC hex characters>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`content-type: application/json`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`The timestamp must be within five minutes of Billions server time. The request\nID provides idempotency and becomes `,_jsx(_components.code,{children:`request.id`}),` in a successful response.`]}),`\n`,_jsx(Heading,{level:`2`,id:`signature-calculation`,children:`Signature calculation`}),`\n`,_jsxs(_components.p,{children:[`Parse the body as JSON and canonicalize it using\n`,_jsx(_components.a,{href:`https://www.rfc-editor.org/rfc/rfc8785.html`,children:`RFC 8785 JCS`}),`. The exact route\npath must include `,_jsx(_components.code,{children:`/public/v1`}),` and must not include the hostname or query string.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-dark github-dark`,style:{backgroundColor:`#24292e`,\"--shiki-dark-bg\":`#24292e`,color:`#e1e4e8`,\"--shiki-dark\":`#e1e4e8`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`canonical = RFC8785_JCS(parsed_request_json)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`message = \"POST\\\\n\" + path + \"\\\\n\" + timestamp + \"\\\\n\" + requestId + \"\\\\n\" + canonical`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`signature = lowercase_hex(HMAC_SHA256(UTF8(secretKey), UTF8(message)))`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`header = \"v1=\" + signature`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Use the original `,_jsx(_components.code,{children:`secretKey`}),` returned once when the API key was created as\nUTF-8 `,_jsx(_components.strong,{children:`text`}),`. Although it looks like a 64-character hexadecimal value, do not\nhex-decode it. Older API keys that were issued before signed operations were\nintroduced must be revoked and reissued.`]}),`\n`,_jsx(Heading,{level:`3`,id:`typescript-/-node-js`,children:`TypeScript / Node.js`}),`\n`,_jsx(_components.p,{children:`Install an RFC 8785 implementation:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-dark github-dark`,style:{backgroundColor:`#24292e`,\"--shiki-dark-bg\":`#24292e`,color:`#e1e4e8`,\"--shiki-dark\":`#e1e4e8`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:`npm`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` install`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` canonicalize`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`33`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-dark github-dark`,style:{backgroundColor:`#24292e`,\"--shiki-dark-bg\":`#24292e`,color:`#e1e4e8`,\"--shiki-dark\":`#e1e4e8`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`33`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` { createHmac, randomUUID } `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`from`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'node:crypto'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` canonicalize `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`from`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'canonicalize'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`function`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:` signBillionsRequest`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#FFAB70`,\"--shiki-dark\":`#FFAB70`},children:` path`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`:`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` string`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#FFAB70`,\"--shiki-dark\":`#FFAB70`},children:` body`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`:`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` unknown`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#FFAB70`,\"--shiki-dark\":`#FFAB70`},children:` apiKey`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`:`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` string`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#FFAB70`,\"--shiki-dark\":`#FFAB70`},children:` secretKey`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`:`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` string`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#FFAB70`,\"--shiki-dark\":`#FFAB70`},children:` requestId`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` =`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:` randomUUID`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`) {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` const`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` timestamp`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` =`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:` String`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(Math.`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:`floor`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(Date.`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:`now`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`() `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`/`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` 1000`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`));`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` const`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` canonicalBody`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` =`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:` canonicalize`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(body);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` if`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` (canonicalBody `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`===`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` undefined`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` throw`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` new`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:` Error`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`'Body is not valid RFC 8785 JSON'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` const`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` message`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` =`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:\" `POST\"}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:\"${\"}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`path`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`}`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:\"${\"}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`timestamp`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`}`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:\"${\"}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`requestId`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`}`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:\"${\"}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`canonicalBody`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:\"}`\"}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` const`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` signature`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` =`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:` createHmac`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`'sha256'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`, secretKey)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` .`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:`update`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(message, `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`'utf8'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` .`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:`digest`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`'hex'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` return`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` requestId,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` headers: {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'content-type'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`'application/json'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'x-api-key'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: apiKey,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'x-billions-timestamp'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: timestamp,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'x-billions-request-id'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: requestId,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'x-billions-request-signature'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:\"`v1=${\"}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`signature`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:\"}`\"}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` };`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`php`,children:`PHP`}),`\n`,_jsxs(_components.p,{children:[`Use an RFC 8785-compatible library to produce `,_jsx(_components.code,{children:`$canonicalJson`}),`; ordinary\n`,_jsx(_components.code,{children:`json_encode()`}),` with sorted top-level keys is not sufficient.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`25`,language:`php`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-dark github-dark`,style:{backgroundColor:`#24292e`,\"--shiki-dark-bg\":`#24292e`,color:`#e1e4e8`,\"--shiki-dark\":`#e1e4e8`},language:`php`,children:_jsxs(_components.code,{language:`php`,numberOfLines:`25`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`\u003c?`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`php`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$path `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` '/public/v1/withdrawals/create'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$body `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'currency'`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` =>`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'EUR'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'amount'`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` =>`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` '70'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'withdrawalMethodId'`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` =>`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` 123`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`];`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$timestamp `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` (`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`string`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`) `}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`time`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`// uuid_create() is provided by the PECL UUID extension. Any RFC 4122 UUID v4`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`// generator can be used here.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$requestId `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:` uuid_create`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`UUID_TYPE_RANDOM`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`// Produce this with an RFC 8785 JCS implementation.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$canonicalJson `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` $jcsCanonicalizer`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`->`}),_jsx(_components.span,{style:{color:`#B392F0`,\"--shiki-dark\":`#B392F0`},children:`canonicalize`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`($body);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$message `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` \"POST`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`{`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$path`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`}`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`{`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$timestamp`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`}`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`{`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$requestId`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`}`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`{`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$canonicalJson`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`}\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$signature `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#79B8FF`,\"--shiki-dark\":`#79B8FF`},children:` hash_hmac`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`(`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`'sha256'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`, $message, $secretKey);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`$headers `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'Content-Type: application/json'`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'x-api-key: '`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` .`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` $apiKey,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'x-billions-timestamp: '`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` .`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` $timestamp,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'x-billions-request-id: '`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` .`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` $requestId,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'x-billions-request-signature: v1='`}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:` .`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` $signature,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`];`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`safe-retries`,children:`Safe retries`}),`\n`,_jsx(_components.p,{children:`For a retry caused by a timeout or lost response:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`reuse the same request ID;`}),`\n`,_jsx(_components.li,{children:`reuse the identical JSON body and endpoint;`}),`\n`,_jsx(_components.li,{children:`calculate a fresh timestamp and signature if the old timestamp expired.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`With an SDK, persist the request ID before the first call and pass that same ID\nand payload on retry. The SDK creates a fresh timestamp and signature for each\ncall.`}),`\n`,_jsxs(_components.p,{children:[`Retrying an identical completed operation returns the original request without\ncreating another debit or payout. Reusing a request ID with another body or\nendpoint returns `,_jsx(_components.code,{children:`409`}),`. If the original request is still running or requires\nreconciliation, the retry also returns `,_jsx(_components.code,{children:`409`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`common-responses`,children:`Common responses`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Status`}),_jsx(_components.th,{children:`Meaning`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`400`})}),_jsx(_components.td,{children:`The signed JSON is valid, but operation data or business validation failed`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`401`})}),_jsx(_components.td,{children:`API key, timestamp, request ID format, or signature is missing or invalid`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`403`})}),_jsx(_components.td,{children:`The API key must be reissued before signed operations can be used`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`409`})}),_jsx(_components.td,{children:`The request ID was reused with different data, or the original operation is still being reconciled`})]})]})]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Never generate a new request ID only because the response was lost. A new ID\nauthorizes a new financial operation.`})})]})}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":{"codeStyling":{"theme":{"light":"github-dark","dark":"github-dark"}},"config":{},"pageMetadata":{"title":"Request signing","description":"Sign withdrawals and refunds with RFC 8785 JCS and HMAC-SHA256.","icon":"signature","href":"/api/request-signing"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Required headers","slug":"required-headers","depth":2,"children":[]},{"title":"Signature calculation","slug":"signature-calculation","depth":2,"children":[{"title":"TypeScript / Node.js","slug":"typescript-/-node-js","depth":3,"children":[]},{"title":"PHP","slug":"php","depth":3,"children":[]}]},{"title":"Safe retries","slug":"safe-retries","depth":2,"children":[]},{"title":"Common responses","slug":"common-responses","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"billions","siteName":"Billions","title":"Request signing - Billions","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-15T19:29:34.139Z","originalFileLocation":"api/request-signing.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=\"Sign withdrawals and refunds with RFC 8785 JCS and HMAC-SHA256.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Billions\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/billions/_generated/favicon/apple-touch-icon.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/billions/_generated/favicon/favicon-32x32.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/billions/_generated/favicon/favicon-16x16.png?v=3\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/billions/_generated/favicon/favicon.ico?v=3\">\u003cmeta data-mint-head property=\"og:title\" content=\"Request signing - Billions\">\u003cmeta data-mint-head property=\"og:description\" content=\"Sign withdrawals and refunds with RFC 8785 JCS and HMAC-SHA256.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Billions\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.billions.works/api/request-signing\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://billions.works/images/og/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=\"Request signing - Billions\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Sign withdrawals and refunds with RFC 8785 JCS and HMAC-SHA256.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://billions.works/images/og/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=\"https://mintlify.s3.us-west-1.amazonaws.com/billions/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Billions\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FC4C07\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.billions.works/api/request-signing\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api/request-signing.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.billions.works/#organization\",\"name\":\"Billions\",\"url\":\"https://docs.billions.works\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/billions/GmnorJJmmpzZPFoc/logo/logo-black.svg?fit=max\u0026auto=format\u0026n=GmnorJJmmpzZPFoc\u0026q=85\u0026s=e47ff33b3137a04e2ae4b8773ec5e5af\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.billions.works#website\",\"name\":\"Billions\",\"url\":\"https://docs.billions.works\",\"publisher\":{\"@id\":\"https://docs.billions.works/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.billions.works/api/request-signing#webpage\",\"url\":\"https://docs.billions.works/api/request-signing\",\"name\":\"Request signing\",\"description\":\"Sign withdrawals and refunds with RFC 8785 JCS and HMAC-SHA256.\",\"dateModified\":\"2026-10-15T19:29:34.139Z\",\"isPartOf\":{\"@id\":\"https://docs.billions.works#website\"},\"breadcrumb\":{\"@id\":\"https://docs.billions.works/api/request-signing#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.billions.works/api/request-signing#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Public API\",\"item\":\"https://docs.billions.works/api/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Request signing\",\"item\":\"https://docs.billions.works/api/request-signing\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.billions.works/api/request-signing#article\",\"headline\":\"Request signing\",\"name\":\"Request signing\",\"description\":\"Sign withdrawals and refunds with RFC 8785 JCS and HMAC-SHA256.\",\"url\":\"https://docs.billions.works/api/request-signing\",\"mainEntityOfPage\":{\"@id\":\"https://docs.billions.works/api/request-signing#webpage\"},\"image\":\"https://billions.works/images/og/og-image.png\",\"dateModified\":\"2026-10-15T19:29:34.139Z\",\"publisher\":{\"@id\":\"https://docs.billions.works/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.billions.works#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Billions\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Billions\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api/request-signing.md","siteName":"Billions","nav":{"global":null,"tabs":[{"tab":"Introduction","pages":[{"title":"Introduction","href":""}]},{"tab":"Developer","groups":[{"group":"Overview","pages":[{"title":"Developer documentation","icon":"code","href":"/developer/overview"}]},{"group":"Integration guide","pages":[{"title":"Integration overview","icon":"diagram-project","href":"/integration/overview"},{"title":"Prerequisites","icon":"list-check","href":"/integration/prerequisites"},{"title":"Payment flow","icon":"credit-card","href":"/integration/payment-flow"},{"title":"Unified Merchant API","icon":"plug","href":"/integration/unified-merchant-api"},{"title":"Callbacks and security","icon":"shield-halved","href":"/integration/callbacks-and-security"},{"title":"Go-live checklist","icon":"rocket","href":"/integration/go-live-checklist"}]},{"group":"Testing","pages":[{"title":"Sandbox testing","icon":"flask","href":"/integration/sandbox-testing"}]},{"group":"Public API","pages":[{"title":"Public API overview","icon":"brackets-curly","href":"/api/overview"},{"title":"Create an invoice API","icon":"file-invoice","href":"/api/create-invoice"},{"title":"Statuses and lifecycle","description":"Understand invoice, withdrawal, and refund statuses returned by the Public API.","icon":"list-check","href":"/api/statuses"},{"title":"Request signing","icon":"signature","href":"/api/request-signing"},{"title":"Withdrawals and refunds","description":"Create signed withdrawal, crypto refund, and fiat refund requests.","icon":"money-bill-transfer","href":"/api/withdrawals-and-refunds"}]},{"group":"Examples","pages":[{"title":"Create an invoice","icon":"file-invoice","href":"/examples/create-an-invoice"},{"title":"Handle a callback","icon":"webhook","href":"/examples/handle-a-callback"},{"title":"Get invoices from the API","icon":"rotate","href":"/examples/get-invoices-from-api"}]},{"group":"SDKs","pages":[{"title":"SDK overview","icon":"boxes-stacked","href":"/sdks/overview"},{"title":"TypeScript SDK","icon":"js","href":"/sdks/typescript"},{"title":"Python SDK","icon":"python","href":"/sdks/python"},{"title":"PHP SDK","icon":"php","href":"/sdks/php"}]},{"group":"Platform integrations","pages":[{"title":"Platform integrations","icon":"store","href":"/store-integrations/overview"},{"title":"WooCommerce","icon":"wordpress","href":"/store-integrations/woocommerce"},{"title":"BILLmanager","icon":"server","href":"/store-integrations/billmanager"},{"title":"WHMCS","icon":"server","href":"/store-integrations/whmcs"},{"title":"Tilda","icon":"cart-shopping","href":"/store-integrations/tilda"}]}]},{"tab":"Legal","pages":[{"title":"Legal","href":"/legal/overview"}]}]},"basePath":"","title":"Request signing - Billions","deploymentId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","buildId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","dynamics":[],"chunks":[]}