{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"JavaScript SDK","description":"Complete documentation for integrating Cheqi's digital receipt platform","keywords":["cheqi","digital receipts","api","sdk","java","javascript"],"llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"javascript-sdk","__idx":0},"children":["JavaScript SDK"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The JavaScript SDK is a TypeScript-first, Node.js 20+ client for resolving receipt recipients and issuing end-to-end encrypted receipts and credit notes. Version ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2.2.1"]}," aligns its receipt flow and behavior with the Java SDK while using idiomatic JavaScript objects and readonly service properties."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK preserves Cheqi's zero-knowledge boundary: your integration supplies the definitive receipt values, the SDK encrypts them locally for every matched owner device, and Cheqi receives ciphertext rather than the plaintext receipt body. The SDK does not calculate, enrich, or reconcile receipt values."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Source code and releases: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/cheqi-io/cheqi-sdk-javascript"},"children":["cheqi-io/cheqi-sdk-javascript"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"requirements","__idx":1},"children":["Requirements"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Node.js 20 or newer"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["an API key, or an OAuth access token with the required permissions"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["a base64-encoded PKCS#8 RSA private key when using recipient-side decryption"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"installation","__idx":2},"children":["Installation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"npm install @cheqi/sdk@2.2.1\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"initialization","__idx":3},"children":["Initialization"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With an API key:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"import { CheqiSDK, Environment } from \"@cheqi/sdk\";\n\nconst sdk = new CheqiSDK({\n  apiEndpoint: Environment.SANDBOX,\n  apiKey: process.env.CHEQI_API_KEY\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With per-call OAuth access tokens, omit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apiKey"]}," and pass the token to the service method:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const sdk = new CheqiSDK({\n  apiEndpoint: Environment.SANDBOX\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Standard environments configure both the API endpoint and customer-facing receipt origin:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Environment"},"children":["Environment"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API endpoint"},"children":["API endpoint"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Receipt origin"},"children":["Receipt origin"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Environment.SANDBOX"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://sandbox.api.cheqi.io"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://sandbox.receipt.cheqi.io"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Environment.TEST"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://test.api.cheqi.io"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://test.receipt.cheqi.io"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Environment.PRODUCTION"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.cheqi.io"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://receipt.cheqi.io"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For a custom deployment, configure both URLs if you use download receipts:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const sdk = new CheqiSDK({\n  apiEndpoint: \"http://localhost:8080\",\n  receiptDownloadBaseUrl: \"http://localhost:5190\",\n  apiKey: process.env.CHEQI_API_KEY\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configuration also accepts ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["privateKey"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["timeoutSeconds"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["maxRetries"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["logger"]},", a Fetch-compatible ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fetch"]}," implementation, or a custom ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apiClient"]},"."," ","The current decryption methods still take ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["privateKeyBase64"]}," explicitly, even when a private key is present in the SDK configuration."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"issue-a-receipt","__idx":4},"children":["Issue a receipt"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use plain JavaScript objects for recipient-identification data and the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["createReceiptPayload"]}," validation factory for the definitive receipt payload:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"import {\n  CheqiSDK,\n  Environment,\n  PaymentType,\n  UnitCode,\n  createReceiptPayload,\n  type IdentificationDetails\n} from \"@cheqi/sdk\";\n\nconst sdk = new CheqiSDK({\n  apiEndpoint: Environment.SANDBOX,\n  apiKey: process.env.CHEQI_API_KEY\n});\n\nconst identificationDetails = {\n  paymentType: PaymentType.CARD_PAYMENT,\n  cardDetails: {\n    paymentAccountReference: \"PAR123456789\",\n    cardProvider: \"VISA\",\n    lastFourDigits: \"4242\"\n  },\n  recipientEmail: \"customer@example.com\"\n} satisfies IdentificationDetails;\n\nconst receiptPayload = createReceiptPayload({\n  documentNumber: \"POS-2026-0001\",\n  issueDate: new Date(),\n  currency: \"EUR\",\n  receiptSubtotal: \"10.00\",\n  totalBeforeTax: \"10.00\",\n  totalTaxAmount: \"2.10\",\n  totalAmount: \"12.10\",\n  taxesApplied: true,\n  paymentDetails: {\n    paymentMeansCode: \"48\",\n    description: \"Card payment\",\n    cardProvider: \"VISA\",\n    cardLastFour: \"4242\",\n    merchantId: \"MID-123\",\n    paymentTerminalId: \"TID-456\"\n  },\n  products: [{\n    name: \"Coffee beans\",\n    brandName: \"Cheqi Coffee\",\n    identifier: \"SKU-COFFEE-001\",\n    quantity: 1,\n    baseQuantity: 1,\n    unitCode: UnitCode.C62,\n    unitPrice: \"10.00\",\n    subtotal: \"10.00\",\n    total: \"12.10\",\n    taxes: [{ rate: 21, type: \"VAT\", taxableAmount: \"10.00\", amount: \"2.10\" }]\n  }],\n  taxes: [{\n    rate: 21,\n    type: \"VAT\",\n    taxableAmount: \"10.00\",\n    amount: \"2.10\",\n    label: \"VAT 21%\"\n  }]\n});\n\nconst result = await sdk.receiptService.issueReceipt(\n  identificationDetails,\n  receiptPayload\n);\n\nif (result.isAccepted()) {\n  console.log(result.cheqiReceiptId, result.deliveryRouteType);\n} else if (result.isEmailReceiptRequired()) {\n  // Generate and submit the permitted email-fallback receipt explicitly.\n} else if (result.isDownloadEnvelopeRequired()) {\n  // Generate the final ReceiptEnvelope locally, then complete the fallback.\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ReceiptPayload"]}," is definitive. Supply ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["taxesApplied"]},", totals, line values, payment presentation, and jurisdictional data yourself. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IdentificationDetails"]}," is only matching and local fallback context; the SDK does not copy it into ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ReceiptPayload.paymentDetails"]}," on the digital route."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"authentication-and-store-overloads","__idx":5},"children":["Authentication and store overloads"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The optional arguments to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["issueReceipt"]}," are:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Configured API key\nawait sdk.receiptService.issueReceipt(identificationDetails, receiptPayload);\n\n// Per-call OAuth token\nawait sdk.receiptService.issueReceipt(identificationDetails, receiptPayload, accessToken);\n\n// Store ID and per-call OAuth token\nawait sdk.receiptService.issueReceipt(identificationDetails, receiptPayload, storeId, accessToken);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When only a third string argument is present, the SDK treats a UUID as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["storeId"]}," and any other non-empty string as an access token. Pass both arguments when using a store with OAuth so the intent is explicit."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"delivery-routes-and-fallbacks","__idx":6},"children":["Delivery routes and fallbacks"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ReceiptResult.deliveryRouteType"]}," is the authoritative route:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DIGITAL"]},": the SDK encrypts the exact serialized payload independently for every matched owner device and submits it immediately."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DOWNLOAD_FALLBACK"]},": the SDK creates and uploads a client-encrypted download when ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IdentificationDetails.paymentType"]}," is available. Otherwise, it returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isDownloadEnvelopeRequired()"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["EMAIL_FALLBACK"]},": the SDK returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isEmailReceiptRequired()"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["issueReceipt"]}," does not send the email automatically."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If recipient resolution returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["routeFound: false"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["issueReceipt"]}," throws ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheqiSDKError"]}," with error code ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CUSTOMER_NOT_FOUND"]},"; it does not return a synthetic customer-not-found result."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"explicit-download-receipt","__idx":7},"children":["Explicit download receipt"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For a known customer-without-Cheqi flow, skip matching:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const result = await sdk.receiptService.issueDownloadReceipt(\n  { paymentType: PaymentType.CASH },\n  receiptPayload,\n  accessToken\n);\n\nconsole.log(result.downloadUrl);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The content key is generated locally and remains in the URL fragment; Cheqi receives only the download ID, ciphertext, and template hash. Anyone with the complete URL can decrypt the receipt, so deliver it through an appropriate customer-facing channel."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If the matched fallback needs a caller-generated final envelope, complete it with:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const completed = await sdk.receiptService.completeDownloadFallback(\n  result,\n  receiptEnvelope,\n  templateHash,\n  accessToken\n);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your integration owns durable storage, scheduling, retry, monitoring, and retention for deferred download work. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/receipts/download-fallback"},"children":["Download links"]}," for the encryption and recovery contract."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"matching-and-lower-level-encryption","__idx":8},"children":["Matching and lower-level encryption"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the service APIs when you need to control matching, encryption, or submission separately:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const resolution = await sdk.matchingService.matchCustomer(\n  identificationDetails,\n  accessToken\n);\n\nconst delivery = sdk.encryptionService.encryptReceiptForRecipient(\n  receiptPayloadJson,\n  resolution.recipients[0]\n);\n\nconst response = await sdk.receiptService.submitEncryptedReceipt({\n  matchId: resolution.matchId,\n  deviceDeliveries: [delivery]\n}, accessToken);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The caller must honor the selected route, encrypt for every owner device, and preserve identical definitive plaintext across device encryptions."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"credit-notes","__idx":9},"children":["Credit notes"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Merchant-issued credit notes use the same recipient-resolution and per-device encryption model:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const result = await sdk.creditNoteService.issueCreditNote(\n  identificationDetails,\n  parentCheqiReceiptId,\n  definitiveCreditNotePayload,\n  accessToken\n);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To associate the credit note with a store, pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["storeId"]}," before ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["accessToken"]},". The SDK serializes the supplied payload without calculations and submits it through the separate encrypted credit-note endpoint."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Customer return requests are separate from merchant-issued credit notes. Decrypt, deserialize, and validate a polling or webhook request in one call:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const request = sdk.decryptionService.decryptCreditNoteInitiationRequest(\n  webhook.data.creditNoteInitiationRequest,\n  privateKeyBase64\n);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The validation covers identifiers, positive quantities, reason codes, note lengths, refund preference, and bank-account requirements. Your integration remains responsible for eligibility, remaining quantities, accepted outcomes, taxes, and the definitive refund. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/creditnote/receiving-returns"},"children":["Receiving Return Requests"]}," and ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/creditnote/issuing-credit-notes"},"children":["Issuing Credit Notes"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"receipt-and-webhook-decryption","__idx":10},"children":["Receipt and webhook decryption"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["decryptReceipt"]}," accepts an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["EncryptedReceiptDeliveryResponse"]}," from polling or a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WebhookReceiptEnvelope"]}," from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.encryptedReceipt"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.encryptedCreditNote"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const envelope = sdk.decryptionService.decryptReceipt(\n  webhook.data.encryptedReceipt,\n  privateKeyBase64\n);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The plaintext is already a complete ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ReceiptEnvelope"]},"; no backend-context merge step is required."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"verification","__idx":11},"children":["Verification"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The verification service implements RFC 8785 canonical JSON hashing and Exclusive XML Canonicalization 1.0 hashing:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const verification = sdk.verificationService;\n\nconst cheqiHash = verification.calculateCheqiReceiptHash(cheqiReceiptJson);\nconst ublHash = verification.calculateUblHash(ublPurchaseReceiptXml);\n\nconst jsonMatches = verification.verifyJsonHash(cheqiReceiptJson, cheqiHash);\nconst xmlMatches = verification.verifyXmlHash(ublPurchaseReceiptXml, ublHash);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"store-management","__idx":12},"children":["Store management"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Store operations require an OAuth access token with the relevant store permissions:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const stores = sdk.storeService;\n\nconst store = await stores.createStore(companyId, createStoreRequest, accessToken);\nconst allStores = await stores.getStores(companyId, accessToken);\nconst activeStores = await stores.getActiveStores(companyId, accessToken);\nconst selected = await stores.getStore(companyId, storeId, accessToken);\nconst updated = await stores.updateStore(companyId, storeId, updateStoreRequest, accessToken);\n\nawait stores.activateStore(companyId, storeId, accessToken);\nawait stores.deactivateStore(companyId, storeId, accessToken);\nawait stores.deleteStore(companyId, storeId, accessToken);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"errors","__idx":13},"children":["Errors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["High-level methods throw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheqiSDKError"]},". API failures retain the error code, HTTP status, and correlation ID where available:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"import { CheqiSDKError } from \"@cheqi/sdk\";\n\ntry {\n  await sdk.receiptService.issueReceipt(\n    identificationDetails,\n    receiptPayload,\n    accessToken\n  );\n} catch (error) {\n  if (error instanceof CheqiSDKError) {\n    console.error(error.message, error.errorCode, error.httpStatusCode);\n    if (error.hasCorrelationId()) {\n      console.error(\"Correlation ID:\", error.correlationId);\n    }\n  }\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"generated-models","__idx":14},"children":["Generated models"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The root package exports typed model interfaces, validation factories, and enums. Every OpenAPI-generated model, enum, and serializer is also available under ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Generated"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"import { Generated } from \"@cheqi/sdk\";\n\nconst route = Generated.RecipientResolutionResponseDeliveryRouteTypeEnum.DIGITAL;\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"available-services","__idx":15},"children":["Available services"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheqiSDK"]}," exposes services and configuration as readonly properties:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["receiptService"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["creditNoteService"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["matchingService"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["encryptionService"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["decryptionService"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["downloadService"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verificationService"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["storeService"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apiClient"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["config"]}]}]}]},"headings":[{"value":"JavaScript SDK","id":"javascript-sdk","depth":1},{"value":"Requirements","id":"requirements","depth":2},{"value":"Installation","id":"installation","depth":2},{"value":"Initialization","id":"initialization","depth":2},{"value":"Issue a receipt","id":"issue-a-receipt","depth":2},{"value":"Authentication and store overloads","id":"authentication-and-store-overloads","depth":3},{"value":"Delivery routes and fallbacks","id":"delivery-routes-and-fallbacks","depth":2},{"value":"Explicit download receipt","id":"explicit-download-receipt","depth":3},{"value":"Matching and lower-level encryption","id":"matching-and-lower-level-encryption","depth":2},{"value":"Credit notes","id":"credit-notes","depth":2},{"value":"Receipt and webhook decryption","id":"receipt-and-webhook-decryption","depth":2},{"value":"Verification","id":"verification","depth":2},{"value":"Store management","id":"store-management","depth":2},{"value":"Errors","id":"errors","depth":2},{"value":"Generated models","id":"generated-models","depth":2},{"value":"Available services","id":"available-services","depth":2}],"frontmatter":{"title":"JavaScript SDK","description":"JavaScript and TypeScript SDK for encrypted receipts, credit notes, downloads, decryption, verification, and stores","seo":{"title":"JavaScript SDK"}},"lastModified":"2026-08-11T23:21:19.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/sdk/javascript","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}