Skip to main content
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);
}