Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.clickterm.com/llms.txt

Use this file to discover all available pages before exploring further.

The ClickTerm Web SDK uses Promises to communicate results. The show() and showAcceptedContent() methods return promises that resolve on success and reject on error.

Show result

When ClicktermDialog.show() resolves:
ClicktermDialog.show({
  endUserId: "user-123",
  clickwrapTemplateId: "YOUR_TEMPLATE_ID",
}).then((result) => {
  // result.clicktermSignature — the Signature to send to your backend
  console.log("Signature:", result.clicktermSignature);
}).catch((error) => {
  // SDK or network error
  console.error("Error:", error);
});

Possible outcomes

OutcomeWhat happens
User acceptsPromise resolves with a Signature — send it to your backend
User declinesPromise resolves with a Signature — verify it to record the decline
User already acceptedPromise resolves with null Signature — no dialog was shown
ErrorPromise rejects with an error message
A null Signature means the user has already accepted the latest major version. No action is needed on your part.

Error handling

Errors are returned via the Promise .catch() handler:
ClicktermDialog.show({
  endUserId: "user-123",
  clickwrapTemplateId: "YOUR_TEMPLATE_ID",
}).catch((error) => {
  // Handle error — e.g., SDK not initialized, network issue, template not found
  console.error("Clickwrap error:", error);
});
Common error scenarios:
ErrorCause
SDK not initializedClicktermClient.initialize() was not called
Template not foundTemplate is disabled or has no effective version
Network errorCannot reach the ClickTerm API

Using async/await

try {
  const result = await ClicktermDialog.show({
    endUserId: "user-123",
    clickwrapTemplateId: "YOUR_TEMPLATE_ID",
  });

  if (result.clicktermSignature) {
    // Send to backend for verification
    await verifySignature(result.clicktermSignature);
  } else {
    // User already accepted — no action needed
  }
} catch (error) {
  console.error("Clickwrap error:", error);
}

Inline mode callbacks

Inline mode uses a different callback pattern. Instead of a single Promise from show(), you get:
  • onChange callback — fires every time the checkbox state changes (passed via options to renderInline())
  • finalize() Promise — resolves when the agreement is submitted to the backend
const handle = await ClicktermDom.renderInline('container', request, {
  onChange: (checked) => {
    // React to checkbox state changes
    submitButton.disabled = !checked;
  },
});

// Later, when the user submits your form:
const result = await handle.finalize();
if (result.status === 'ERROR') {
  console.error('Finalize failed:', result.error?.message);
}
For full details, see the ClicktermDom API reference.