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.
mountButton: Render the Branded ZoPay Payment Button
Inject the branded ZoPay button and asset/network selector dropdowns into any DOM element. Receives the selected currency and network code in your onClick callback.
mountButton mounts a pre-built, branded ZoPay button into the DOM element you specify. It automatically fetches the list of available payment currencies and their networks, populating selectors inside a wizard flow. When a customer clicks the button, your onClick callback receives the currency and networkCodes (an array of networks) of the selected options, which you pass directly to createPaymentIntent. The button and selectors remain disabled until the catalog lists have loaded.
This method throws an Error if no element with the given elementId exists in the document at the time of the call. Ensure the target element is present in the DOM before calling mountButton.
Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
elementId | string | The id attribute of the DOM element into which the button should be mounted. Any existing content inside the element is replaced. |
options.onClick | (selection: ZopayButtonSelection) => void | A callback invoked when the customer clicks the button. Receives an object containing currency (e.g., "USDT") and networkCodes (e.g., ["SOL", "TRX"]). Use these values when calling createPaymentIntent. |
options.disabled | boolean (optional) | When true, the button and selectors are rendered in a disabled state even after loading. Useful when you need to gate the button on a form validation or terms-of-service agreement. |
options.currencies | string[] (optional) | Asset codes to offer, intersected with the API catalog. If omitted, every currency returned by the catalog is listed. |
ZopayButtonSelection
Return value
Returns the containerHTMLElement appended inside the target element. You can store this reference to remove or hide the button programmatically.
What gets rendered
The method injects up to three child elements into the target container:- Currency selector — a
<select>dropdown populated with available asset codes (hidden if only one currency is available). - Network multi-selector — a group of checkboxes populated with available networks for the chosen currency.
- Pagar button — a confirmation button inside the wizard.