Add e-signatures and clickwrap to Vue
To add e-signatures and clickwrap to Vue, install @esigncomply/browser and call it from your own single-file component: there are no Vue bindings. Template refs name the checkbox, links and button, and onMounted attaches the ceremony. A server route creates the session with the secret key and another confirms the record. Esign Comply seals it as an independent record.
Follow the quickstart and each signature is a valid electronic signature under the U.S. ESIGN Act, state UETA laws and New York's ESRA, and each clickwrap is built the way courts require: clear notice of the terms, an unmistakable act of assent, and a sealed record of both.
$npm install @esigncomply/browser esigncomplyFree plan: 10 live signatures a month and a full test mode. No card required.
Last updated
// One session per page load. Vue calls onMounted once, in development too. onMounted(async () => { try { // Your server creates the session and returns { clientToken, apiUrl, documents }. Never the secret key. const response = await fetch("/api/ceremony", { method: "POST" }); const session = await response.json(); ceremony = await EsignComply.attach({ clientToken: session.clientToken, apiUrl: session.apiUrl }); ceremony.on("change", ({ remainingSteps }) => { canComplete.value = !remainingSteps.some((step) => step !== "signature.applied"); }); // Point each link at the exact version this session pinned, wait for Vue to patch the DOM, then report it. versions.value = session.documents.map((document) => document.version_id); await nextTick(); await ceremony.presentDocument({ versionId: versions.value[0], mode: "hyperlink", link: termsLink.value }); await ceremony.presentDocument({ versionId: versions.value[1], mode: "hyperlink", link: privacyLink.value }); await ceremony.observeAssent({ region: assent.value, // notice, links, checkbox, button checkbox: checkbox.value, submit: submit.value, }); ready.value = true; // the SDK watches the box from here on } catch (error) { message.value = error.message; } }); onUnmounted(() => ceremony?.destroy());
<template> <form class="signup" @submit.prevent="onSubmit"> <h1>Create account</h1> <div ref="assent"> <!-- The form is on screen before the component has a session, so the box stays disabled until the SDK watches it. --> <!-- No v-model and no checked attribute: only the user changes the box. --> <label><input ref="checkbox" type="checkbox" :disabled="!ready" /> I agree to the Terms of Service and Privacy Notice</label> <p> By checking the box and clicking Create account, you agree to the <a ref="terms" :href="`/legal/terms?v=${versions[0] ?? ''}`">Terms of Service</a> and acknowledge the <a ref="privacy" :href="`/legal/privacy?v=${versions[1] ?? ''}`">Privacy Notice</a>. </p> <button ref="submit" type="submit" :disabled="!canComplete">Create account</button> </div> <p role="alert">{{ message }}</p> </form> </template>
// Step 4: create the session with the secret key. The browser gets the client token only. if (req.method === "POST" && url.pathname === "/api/ceremony") { const { data: session, error } = await esc.sessions.create( { profile: process.env.ESIGNCOMPLY_PROFILE_ID, signer, documents: [ { document: DOCUMENTS.terms, version: "current" }, { document: DOCUMENTS.privacy, version: "current" }, ], // The page that runs the ceremony: the origin the browser reports, plus its path. context: { url: `${req.headers.origin ?? url.origin}/signup`, locale: "en-US", purpose: "account_signup" }, }, { idempotencyKey: `signup-${signer.external_id}-${randomUUID()}` }, ); if (error) return json(res, 502, { error: error.code }); pinned.set(signer.external_id, session.documents.map((d) => d.version_id)); return json(res, 200, { clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents });
// vite.config.js import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; // Where your backend listens in development. const API = process.env.API_ORIGIN ?? "http://localhost:3001"; export default defineConfig({ plugins: [vue()], server: { // The three server routes live in your backend. In development Vite forwards them, // so the page and the document pages share one origin. proxy: { "/api": API, "/legal": API, }, }, });
How do you integrate Esign Comply with Vue?
A Vue app is the browser half of the integration. There are no Vue bindings, so the component calls @esigncomply/browser itself: template refs name the checkbox, the links and the button, and onMounted attaches the ceremony once they exist. The secret key cannot live in a bundle, so the session comes from a server route.
Vue is a JavaScript framework for building user interfaces. It builds on top of standard HTML, CSS, and JavaScript and provides a declarative, component-based programming model.
Source: Vue documentation, Introduction, read on .- Vue componentsrc/Signup.vue
- Templatesrc/Signup.vue
- Server routeserver/index.js
- Vite proxyvite.config.js
Run on 2026-11-26 with Vue 3.5.46, Vite 8.3.8, @vitejs/plugin-vue 6.0.11, @esigncomply/browser 1.0.4, esigncomply 1.0.4 and the conformance check from esigncomply 1.0.4 (--timeout 60) on Node.js 24.22.1, against the API in test mode.
What prompt adds Esign Comply clickwrap to a Vue app?
Paste this into Cursor, Claude Code or the AI coding tool that is open on your project. It names the packages that exist, where the secret key goes in Vue, what to build and what never to do, and it ends with the rules block for your project.
The rules block lives at /rules.md. Added to your project's instruction file, it makes every later session build signing and acceptance flows the same way. The prompt generator writes the long version, with your own document and profile IDs.
Pages for each AI toolAdd Esign Comply clickwrap to my Vue app: a signup form where the user accepts the Terms of Service and the Privacy Notice with a checkbox and a button.
Read these first and follow them exactly. If something conflicts with existing code, or you are unsure how to implement a step, stop and ask. Do not invent API methods, packages or legal wording.
- https://esigncomply.com/docs/quickstart/vue.md (the steps and the tested code for Vue)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)
Vue facts
- Packages (the only ones that exist): @esigncomply/browser for the component and esigncomply (Node.js 20.19 or later) for the server. There is no Vue package: no plugin, no composable, no component. Call the browser SDK directly.
- Vue runs in the browser, so the secret key cannot live in the Vue app. It is in ESIGNCOMPLY_API_KEY on a server. Never give it a VITE_ prefix: Vite puts every VITE_ variable into the bundle.
- Use <script setup> and call the SDK inside onMounted, where the template refs hold their elements. Do not use top-level await: without <Suspense> the component renders nothing.
- After you set the reactive state that feeds the two link addresses, await nextTick() before presentDocument, or the SDK reads the links before Vue has patched them.
- The form is on screen before the component has a session: render the checkbox disabled and enable it when observeAssent has resolved.
- The page and the document pages must share one origin. In development, proxy /api and /legal from Vite to the server.
Build
1. Verify the key: GET /v1/usage with ESIGNCOMPLY_API_KEY. Stop if it fails.
2. Register the Terms of Service and the Privacy Notice as documents and publish one version of each from the documents in this project. If the project has none, register short sample documents and say so in your report. Never write or change the wording of the real documents. Create a profile: jurisdictions ["US-FED"], method "checkbox", assurance_level "L1".
3. Server: POST /api/ceremony creates the session with esc.sessions.create and an Idempotency-Key, saves the signer ID and the pinned version IDs in server-owned state, and returns only clientToken, apiUrl and documents.
4. Server: GET /legal/terms and /legal/privacy render the registered version from esc.documents.versions.getContent inside <article data-esc-document>, unmodified.
5. Vue: in onMounted, EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }) with template refs, then ceremony.complete() in the submit handler. The checkbox has no checked attribute and no v-model that starts true.
6. Server: POST /api/signup/confirm reads the record with esc.records.get and requires: status is "recorded", "timestamped" or "anchored"; livemode is as expected; the signer ID and version IDs equal the server-owned state. Only then create the account.
Never
- Never pre-check the box, auto-submit, or call .click() on the user's behalf.
- Never use "By continuing" or "By clicking below" wording. The notice names the button by its label and each document by its registered name.
- Never put the secret key, or any call that uses it, in code that reaches the browser.
- Never show "signed" or "accepted" before the server has confirmed the record.
- Never fall back to an acceptance with no record when a session is refused.
Check before you report success
- Run: npx esigncomply check --url http://localhost:5173/signup --callback http://localhost:5173/api/signup/confirm
Fix every finding marked "block". List every finding marked "warn".
- Report the files you created or changed, anything you did not implement and why, and the conformance summary.
Then add the rules block to this project's instruction file: https://esigncomply.com/rules.mdWhat goes wrong when you add e-signatures in Vue?
These are specific to Vue. Each one was seen while the quickstart's code was run, or is in Vue's own documentation.
- 01
Vue patches the document links on the next tick
The two
Source: Vue documentation, nextTick(), read on .hrefattributes come from reactive state, and Vue applies a state change to the DOM on the next tick. In a test on Vue 3.5.46 withoutawait nextTick(), the SDK read the first link too early, requested/legaland got/terms?v= 404. With the wait, both document pages answered200. - 02
Top-level await in script setup renders nothing without Suspense
Vue compiles top-level
Source: Vue documentation, script setup, top-level await, read on .awaitin<script setup>to an asyncsetup(), which must be used with<Suspense>. In a test, a component that awaited the session request at the top level left the page empty, and the session had still been created. Request the session inonMounted. - 03
Inside a component the key is undefined, and that is correct
In a test build with Vue 3.5.46 and Vite 8.3.8,
import.meta.env.ESIGNCOMPLY_API_KEYcompiled toundefinedand the key was nowhere in the bundle. A variable named with theVITE_prefix was in it. Never rename the key to make a component see it. Only the server reads it.
Where are the Vue quickstart and the API reference?
Start with the quickstart: it carries every file this page excerpts, in the order you write them.
- QuickstartVue quickstartStep by step, from install to your first sealed test record, with every file and the output of each step.Open
- ReferenceAPI referenceEvery endpoint, field and error code. Sessions, records and documents are the three this page uses.Open
- GuideServer confirmationThe one place access is granted: what to compare, and the webhook that backs the check up.Open
What does Esign Comply record for a signature in Vue?
The same record on every stack and platform. Your Vue code creates the session and confirms the record, and the browser SDK reports what happened on the page. Esign Comply seals the result where your code cannot change it. The record itself is described on Evidence and verification.
Observed and asserted fields
Every field is tagged. Observed is what the browser SDK and the API saw: the box unchecked at load, the tick from a trusted user event, the notice text, the terms version by hash, the server time. Asserted is what your app said, such as the user's email.
A signed receipt
complete()returns a receipt signed with ES256, using keys you do not hold. Your server stores it next to the user, andGET /v1returns it again./records /{id} /receipt An external timestamp
An outside authority timestamps the hash of every live record (RFC 3161), so the time on the record does not rest on your clock or on ours.
An offline verifier
Each record has an evidence report (PDF) and an evidence package (ZIP). Anyone you send the package to checks the acceptance with the open-source
esigncomply-verify, without an account.
Questions about e-signatures in Vue
Is there an Esign Comply SDK for Vue?
Not one made for Vue. There is no plugin, composable or component. A Vue component calls @esigncomply/browser directly: it is headless, so it works with the template you wrote. Your server uses esigncomply, or plain HTTPS calls in another language.
Where do I create the session in Vue?
Not in Vue. The session is created on a server with the secret key, and the component receives only the client token, the API URL and the pinned documents. Any backend can carry the route: the quickstart uses one Node.js file.
Can I bind the acceptance checkbox with v-model?
Yes, when the bound state starts false and only the user changes it. In a test, the tick of a box bound that way was recorded as intent.captured with a pass. With a ref that started true, the SDK raised a CR-01 finding at Block level before any click.
Does Vue run onMounted twice in development?
No. In the test run on Vue 3.5.46 with the Vite dev server, one page load ran the hook once and sent one POST /api, and each session recorded client.attached once. The quickstart needs no guard around the request.
Should the ceremony object be kept in a ref?
It does not have to be. The quickstart keeps it in a plain variable, because the template never reads it. In a test on Vue 3.5.46, a ceremony kept in ref() worked as well: the documents, the notice and the tick were recorded the same way.
Build the form in Vue. Leave the record to us.
Free plan: 10 live signatures a month and a full test mode. No card required.
Vue is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about Vue is from Vue's documentation or from a test run, as marked, on . /vue.md is this page as Markdown.