Documentation Index
Fetch the complete documentation index at: https://docs.zopay.cash/llms.txt
Use this file to discover all available pages before exploring further.
ZoPay Class: Initialize the SDK and Call All Methods
Instantiate the ZoPay class with your credentials to access createPaymentIntent, mountButton, mountPaymentIntentWidget, and webhook helpers.The
ZoPay class is the primary interface for the ZoPay SDK. You instantiate it once with your credentials, then call its methods to create payment intents, render UI components, and handle webhooks. The class internally delegates API calls to ZoPayClient, which is also exported for advanced use cases where you need direct access to the HTTP layer.
Constructor
ZoPayConfig object when creating an instance.
| Field | Type | Description |
|---|---|---|
apiKey | string | Your organization API key. When present, the SDK sends it as the X-API-Key header. |
baseUrl | string | Base URL for the ZoPay API. Falls back to paymentLinkBaseUrl when not set. |
paymentLinkBaseUrl | string | Base URL specifically for payment intent endpoints (e.g., https://your-api.com). Takes precedence over baseUrl for payment intent calls. |
apiTimeoutMs | number | Request timeout in milliseconds. Default: 10000. Minimum enforced: 3000 (lower values are clamped to avoid duplicate intents under poor network conditions). |
maxRetries | number | Max retries for transient network/server errors. Default: 2. |
Basic instantiation
Public methods
The table below lists every public method on theZoPay class. Follow the links for full parameter and response documentation.
| Method | Returns | Description |
|---|---|---|
createPaymentIntent(params) | Promise<CreatePaymentIntentResponse> | Creates a new payment intent and returns wallet addresses and a QR-ready payment URL. |
getPaymentIntentInfo(params) | Promise<PaymentIntentInfoResponse> | Fetches the current status, addresses, and transactions for an existing payment intent. |
mountButton(elementId, options) | HTMLElement | Renders the branded ZoPay button with a currency/network selector dropdown into a DOM element. |
mountPaymentIntentWidget(result, options) | void | Renders per-network QR codes, redacted addresses, and optional auto-polling into a DOM element. |
verifyWebhookSignature(payload, signature, secret) | Promise<boolean> | Validates the HMAC signature on an incoming webhook request. |
parseWebhookEvent(payload) | WebhookEvent | Deserializes a raw webhook payload string into a typed WebhookEvent object. |
getPaymentCatalogCurrencies() | Promise<PaymentCatalogCurrency[]> | Returns the list of available asset codes for payment links. |
getPaymentCatalogNetworks(currency) | Promise<Network[]> | Returns the list of active payment networks for the given currency. |
getAvailableNetworks() | Promise<Network[]> | Returns the list of active payment networks globally. For new integrations prefer getPaymentCatalogNetworks(currency), which scopes networks to a specific asset. |
Advanced: using ZoPayClient directly
ZoPayClient is exported alongside ZoPay for cases where you need direct control over HTTP requests — for example, in a Node.js backend that never mounts UI components.
ZoPayClient exposes the same API communication methods as ZoPay, but does not include UI helpers like mountButton or mountPaymentIntentWidget.