# Add e-signatures and clickwrap with Laravel

> Build a signup clickwrap in Laravel with one controller, a config file and the HTTP client, calling the Esign Comply REST API. No Composer package.

Source: https://esigncomply.com/docs/quickstart/laravel

Last updated November 26, 2026

To add e-signatures and clickwrap with Laravel, call the REST API from a controller with Laravel's HTTP client and the secret key: there is no Composer package. One action creates the session and pins the versions in the session, another confirms the record, and the browser SDK attaches to your checkbox. Esign Comply seals each acceptance as an independent record.

Follow the steps and each signature your app records is a valid electronic signature under the ESIGN Act, state UETA laws and New York's ESRA, and your clickwrap is built the way courts require: clear notice of the terms, an unmistakable act of assent, and a sealed record of both.

Paste this prompt into Cursor, Claude Code or another AI coding tool to have it build the same integration:

```text copy="Copy prompt" open="cursor"
Add Esign Comply clickwrap to my Laravel 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/laravel.md (the steps and the tested code for Laravel)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

Laravel facts
- There is no Esign Comply Composer package. Do not install or invent one. A controller calls the REST API at https://esigncomply.com/v1 with the Http facade, withToken and the secret key.
- The browser SDK is a script tag: https://esigncomply.com/sdk/v1/esigncomply.js. It defines the global EsignComply.
- The secret key is ESIGNCOMPLY_API_KEY in .env. Read it through a config file and config(), never with env() in a controller: env() returns null once the configuration is cached. Never print the key.
- Define the routes in routes/web.php, so they carry the session and the request forgery check. The page sends the token from the csrf-token meta tag in the X-CSRF-TOKEN header.
- Keep the pinned version IDs in the session.
- Print the registered document HTML with {!! !!}. With {{ }} Blade escapes the tags and the page no longer matches the registered version.
- The page is on screen before the script has a session: render the checkbox disabled and enable it when observeAssent has resolved.

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. Action for POST /api/ceremony: call POST /v1/sessions with an Idempotency-Key, save the pinned version IDs in the session, and return only clientToken, apiUrl and documents.
4. Action for GET /legal/{slug}: render the html from GET /v1/documents/{id}/versions/{version_id}/content inside <article data-esc-document>, unmodified.
5. Browser: EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }), then complete() from the user's real click.
6. Action for POST /api/signup/confirm: call GET /v1/records/{id} and require: 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:8000/signup --callback http://localhost:8000/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.md
```

The rest of this page is the same integration by hand, in eight steps. The full application, with a model for the acceptance, the registration form and the webhook, is in [Clickwrap in Laravel](https://esigncomply.com/guides/laravel-clickwrap).

## Before you start

- A test API key. [Create an account](https://esigncomply.com/signup) with your email, no card, then choose **Create test key** in the dashboard. The key is shown once and starts with `esc_test_`. An AI agent with an agent token creates it with `POST /v1/agent/api-keys`: see the [agent account API](https://esigncomply.com/docs/api/agent.md).
- Nothing else from Esign Comply. Test mode works on `localhost` with no card and no domain, and the Free plan includes it in full.
- PHP and Composer. This page was run on Laravel 13.44.1 with PHP 8.5.13.
- `curl` and `jq` for steps 2 and 3, and Node.js 20.19 or later for the conformance check in step 7.

## Step 1. Install

No package needed. The server SDK exists for Node.js only, so a Laravel app calls the REST API directly with the HTTP client that ships with the framework. To follow along in a new app:

```bash
composer create-project laravel/laravel esigncomply-quickstart
cd esigncomply-quickstart
```

`create-project` also creates the SQLite database and runs the migrations, which gives the session its table.

## Step 2. Set the key

Add the key to the `.env` file Laravel created. Laravel reads this file itself. The key stays on the server and never reaches the page.

```bash
# .env (never commit this file)
ESIGNCOMPLY_API_KEY=esc_test_us_...
```

Load the file into your shell for the commands in steps 2, 3 and 7, then check that the key works:

```bash
set -a; . ./.env; set +a
curl -s ${ESIGNCOMPLY_API_URL:-https://esigncomply.com/v1}/usage \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" | jq '{plan_name, test_events}'
```

```json
{
  "plan_name": "Free",
  "test_events": {
    "used_this_month": 0,
    "quota_per_month": 500
  }
}
```

A `401` means the key is wrong or revoked: see [`invalid_api_key`](https://esigncomply.com/docs/api/errors.md#invalid_api_key). The rules for handling keys are in [/auth.md](https://esigncomply.com/auth.md).

## Step 3. Register a document version

Every record pins the exact version of each document by hash, so the documents are registered first. This block registers a Terms of Service and a Privacy Notice with one version each, and creates a profile: the Federal pack, a checkbox with a button, level L1. It is the same for every stack and needs `curl` and `jq`.

```bash
ESC=${ESIGNCOMPLY_API_URL:-https://esigncomply.com/v1}
KEY="Authorization: Bearer $ESIGNCOMPLY_API_KEY"
JSON="Content-Type: application/json"

# Two sample documents, one version each.
TERMS=$(curl -s $ESC/documents -H "$KEY" -H "$JSON" \
  -d '{"name":"Terms of Service","type":"terms"}' | jq -r .id); sleep 1
curl -s $ESC/documents/$TERMS/versions -H "$KEY" -H "$JSON" \
  -d '{"version_label":"1","language":"en","content":{"format":"markdown","text":"# Terms of Service\n\nThese are sample terms for a test."},"material_change":true}' \
  | jq -r .id; sleep 1
PRIVACY=$(curl -s $ESC/documents -H "$KEY" -H "$JSON" \
  -d '{"name":"Privacy Notice","type":"privacy_notice"}' | jq -r .id); sleep 1
curl -s $ESC/documents/$PRIVACY/versions -H "$KEY" -H "$JSON" \
  -d '{"version_label":"1","language":"en","content":{"format":"markdown","text":"# Privacy Notice\n\nThis is a sample privacy notice for a test."}}' \
  | jq -r .id; sleep 1

# A profile: Federal pack, checkbox plus button, L1.
PROFILE=$(curl -s $ESC/profiles -H "$KEY" -H "$JSON" \
  -d '{"name":"Signup","jurisdictions":["US-FED"],"method":"checkbox","assurance_level":"L1"}' | jq -r .id)

printf 'ESIGNCOMPLY_PROFILE_ID=%s\nESIGNCOMPLY_TERMS_ID=%s\nESIGNCOMPLY_PRIVACY_ID=%s\n' "$PROFILE" "$TERMS" "$PRIVACY"
```

It prints the two version IDs, then three lines with your own IDs:

```text
dv_YiWs9cmWoVSGp7ALPeZS
dv_bAYeA7QigKUH0iLhPpV7
ESIGNCOMPLY_PROFILE_ID=prof_SPVEgBT8a8Ror3mJ8M99
ESIGNCOMPLY_TERMS_ID=doc_bDgYFndAoC8tkeYibAVy
ESIGNCOMPLY_PRIVACY_ID=doc_mb2hnWKS0Qa7SKtucDW9
```

Add the three lines to `.env`. The pauses keep the script under the Free plan's 2 requests per second. Keep the names `Terms of Service` and `Privacy Notice`: the notice on your page names each document by its registered name, and rule [CR-02](https://esigncomply.com/docs/conformance.md#cr-02) checks that it does. With your own documents, publish the text you already have and change the notice to match. See [Documents](https://esigncomply.com/docs/api/documents.md) and [Profiles](https://esigncomply.com/docs/api/profiles.md).

## Step 4. Create a session on the server

One config file brings the values from `.env` into the application. The controller reads them with `config()`, never with `env()`: once the configuration is cached, `env()` returns nothing for a variable that lives only in `.env`.

```php file="config/esigncomply.php"
<?php
// config/esigncomply.php

return [
    'url' => env('ESIGNCOMPLY_API_URL', 'https://esigncomply.com/v1'),
    'key' => env('ESIGNCOMPLY_API_KEY'),
    'live' => env('ESIGNCOMPLY_LIVE', false), // set ESIGNCOMPLY_LIVE=true in production only
    'profile' => env('ESIGNCOMPLY_PROFILE_ID'),
    'documents' => [
        'terms' => env('ESIGNCOMPLY_TERMS_ID'),
        'privacy' => env('ESIGNCOMPLY_PRIVACY_ID'),
    ],
];
```

One controller carries the integration: the signup page, the document pages, the session and the confirmation. The `ceremony` action creates the session and returns three values to the browser: the client token, the API URL and the pinned documents. The version IDs it pinned go into the Laravel session.

```php file="app/Http/Controllers/SignupController.php"
<?php
// app/Http/Controllers/SignupController.php

namespace App\Http\Controllers;

use Illuminate\Http\Client\PendingRequest;
use Illuminate\Http\Client\RequestException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;

class SignupController extends Controller
{
    private const SEALED = ['recorded', 'timestamped', 'anchored'];

    // The signer. In your app this is $request->user(), or the account you are about to create.
    private const SIGNER = [
        'external_id' => 'user_7c1d',
        'email' => 'dana@example.org',
        'name' => 'Dana Whitfield',
        'class' => 'consumer',
        'country' => 'US',
        'region' => 'US-CA',
    ];

    // There is no Composer package: these are plain HTTPS calls with the secret key.
    private function esc(): PendingRequest
    {
        return Http::withToken(config('esigncomply.key'))->baseUrl(config('esigncomply.url'))->acceptJson()->timeout(10)
            // Over the rate limit: wait for Retry-After (1 to 5 seconds) and try again, twice at most. Nothing else is retried.
            ->retry(
                3,
                fn (int $attempt, RequestException $e) => 1000 * min(max((int) $e->response->header('Retry-After'), 1), 5),
                fn ($e) => $e instanceof RequestException && $e->response->status() === 429,
                throw: false, // every other answer stays a response to read
            );
    }

    public function show()
    {
        return view('signup');
    }

    // The document pages: each one renders a registered version, unmodified.
    public function legal(Request $request, string $slug)
    {
        $documentId = config("esigncomply.documents.$slug");
        abort_unless($documentId, 404);

        $version = rawurlencode($request->query('v', 'current'));
        $content = $this->esc()->get("/documents/$documentId/versions/$version/content");
        abort_unless($content->ok(), 404);

        return view('legal', ['versionId' => $content['version_id'], 'html' => $content['html']]);
    }

    // Step 4: create the session with the secret key. The browser gets the client token only.
    public function ceremony(Request $request)
    {
        $origin = $request->header('Origin') ?? $request->getSchemeAndHttpHost();
        $session = $this->esc()
            ->withHeaders(['Idempotency-Key' => 'signup-'.self::SIGNER['external_id'].'-'.Str::uuid()])
            ->post('/sessions', [
                'profile' => config('esigncomply.profile'),
                'signer' => self::SIGNER,
                'documents' => [
                    ['document' => config('esigncomply.documents.terms'), 'version' => 'current'],
                    ['document' => config('esigncomply.documents.privacy'), 'version' => 'current'],
                ],
                'context' => ['url' => "$origin/signup", 'locale' => 'en-US', 'purpose' => 'account_signup'],
            ]);
        if ($session->status() !== 201) {
            return response()->json(['error' => $session->json('error.code')], 502);
        }

        // The Laravel session is stored on the server: the browser holds only its ID, in an encrypted cookie.
        $request->session()->put('pinned_versions', collect($session['documents'])->pluck('version_id')->sort()->values()->all());

        return response()->json([
            'clientToken' => $session['client_token'],
            'apiUrl' => $session['api_url'],
            'documents' => $session['documents'],
        ]);
    }

    // Step 6: confirm the record with the secret key before the account exists.
    public function confirm(Request $request)
    {
        // An empty or malformed body carries no record ID. Refuse it here: an empty ID would ask the API for the list of records.
        $recordId = $request->input('recordId');
        if (! is_string($recordId) || $recordId === '') {
            return response()->json(['confirmed' => false], 409);
        }

        $record = $this->esc()->get('/records/'.rawurlencode($recordId));
        $confirmed = $record->ok()
            && in_array($record->json('status'), self::SEALED, true) // null when the answer is not a record
            && $record['livemode'] === (bool) config('esigncomply.live')
            && $record['signer']['external_id'] === self::SIGNER['external_id']
            && collect($record['documents'])->pluck('version_id')->sort()->values()->all() === $request->session()->get('pinned_versions');
        Log::info($confirmed ? "confirmed {$record['id']} ({$record['status']})" : 'refused');
        if (! $confirmed) {
            return response()->json(['confirmed' => false], 409);
        }

        // Only now create the account, and store $record['id'] and $record['receipt'] with it.
        return response()->json(['confirmed' => true, 'recordId' => $record['id']]);
    }
}
```

Every call goes through the client that `esc()` builds, and its `retry` covers one case: when the API answers `429`, Laravel waits for the seconds in `Retry-After`, 1 at least and 5 at most, and sends the request again, up to twice. `throw: false` keeps every other answer a response to read. `php artisan serve` answered one request at a time in the test, so the wait held the whole server: page requests sent during a burst of four confirmations waited up to 1.9 seconds.

Route the four actions in `routes/web.php`, where every route carries the session and the request forgery check. This replaces the file `create-project` wrote:

```php file="routes/web.php"
<?php
// routes/web.php

use App\Http\Controllers\SignupController;
use Illuminate\Support\Facades\Route;

Route::get('/signup', [SignupController::class, 'show']);
Route::get('/legal/{slug}', [SignupController::class, 'legal']);
Route::post('/api/ceremony', [SignupController::class, 'ceremony']);
Route::post('/api/signup/confirm', [SignupController::class, 'confirm']);
```

The signer is a fixed test person here. In your app it is `$request->user()` or the account you are about to create.

## Step 5. Attach the ceremony in the browser

The browser SDK renders nothing. It observes the checkbox, the notice, the links and the button you built, and reports each step from the signer's browser straight to Esign Comply. Save the view as `resources/views/signup.blade.php`:

```html file="resources/views/signup.blade.php"
{{-- resources/views/signup.blade.php --}}
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Create account</title>
    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <style>
      body { font: 16px/1.5 system-ui, sans-serif; max-width: 480px; margin: 48px auto; padding: 0 20px; }
      a { color: #0b57d0; text-decoration: underline; }
      button { font: inherit; padding: 10px 16px; }
    </style>
  </head>
  <body>
    <h1>Create account</h1>
    <form id="signup">
      <div id="assent">
        <!-- The page is on screen before the script has a session, so the box stays disabled until the SDK watches it. -->
        <label><input id="agree" type="checkbox" disabled /> 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 id="tos-link" href="/legal/terms">Terms of Service</a> and acknowledge the
          <a id="privacy-link" href="/legal/privacy">Privacy Notice</a>.
        </p>
        <button id="create-account" type="submit" disabled>Create account</button>
      </div>
      <p id="message" role="alert"></p>
    </form>

    <script src="https://esigncomply.com/sdk/v1/esigncomply.js"></script>
    <script type="module">
      const agree = document.querySelector("#agree");
      const submit = document.querySelector("#create-account");
      const message = document.querySelector("#message");
      // Laravel checks this token on every POST. It comes from the meta tag in the head.
      const csrf = document.querySelector('meta[name="csrf-token"]').content;

      // Your server creates the session and returns only the client token and the pinned documents.
      const response = await fetch("/api/ceremony", { method: "POST", headers: { "X-CSRF-TOKEN": csrf } });
      const { clientToken, apiUrl, documents } = await response.json();

      const ceremony = await EsignComply.attach({ clientToken, apiUrl });
      ceremony.on("change", ({ remainingSteps }) => {
        submit.disabled = remainingSteps.some((step) => step !== "signature.applied");
      });

      // Point each link at the exact version this session pinned, then report it.
      const links = [document.querySelector("#tos-link"), document.querySelector("#privacy-link")];
      for (const [i, link] of links.entries()) {
        link.search = "?v=" + documents[i].version_id;
        await ceremony.presentDocument({ versionId: documents[i].version_id, mode: "hyperlink", link });
      }
      await ceremony.observeAssent({
        region: document.querySelector("#assent"), // notice, links, checkbox, button
        checkbox: agree,
        submit,
      });
      agree.disabled = false; // the SDK watches the box from here on. Only the user ticks it.

      document.querySelector("#signup").addEventListener("submit", async (event) => {
        event.preventDefault();
        try {
          const result = await ceremony.complete(); // the signing act, from the signer's own click
          // The result came to the browser. Your server confirms the record before anything is granted.
          const confirmed = await fetch("/api/signup/confirm", {
            method: "POST",
            headers: { "Content-Type": "application/json", "X-CSRF-TOKEN": csrf },
            body: JSON.stringify({ recordId: result.recordId }),
          });
          message.textContent = confirmed.ok
            ? `Account created. Record ${result.recordId}`
            : "We could not confirm whether your acceptance was recorded. Please wait while we check.";
        } catch (error) {
          message.textContent = error.message;
        }
      });
    </script>
  </body>
</html>
```

The checkbox starts unchecked and disabled. The page is on screen before the script has a session, and the script enables the box once the SDK observes it: a box ticked before that fails [CR-01](https://esigncomply.com/docs/conformance.md#cr-01). In a test with the session request held back, a click on the box did nothing.

The meta tag carries the CSRF token, and the script sends it back in the `X-CSRF-TOKEN` header on both POST requests.

Each link opens a document page on your own server. Its view prints the registered HTML with `{!! !!}`, so Blade does not escape it:

```html file="resources/views/legal.blade.php"
{{-- resources/views/legal.blade.php --}}
<!doctype html>
<meta charset="utf-8">
{{-- The registered HTML goes out unescaped: it was sanitized by Esign Comply. --}}
<article data-esc-document="{{ $versionId }}">{!! $html !!}</article>
```

Start the server and open [http://localhost:8000/signup](http://localhost:8000/signup):

```bash
php artisan serve
```

The button stays disabled until the box is ticked. Tick it, click **Create account**, and the page shows a line such as:

```text
Account created. Record rec_4UbtJCK59iPAgJ1CKD58
```

## Step 6. Confirm the record on the server

The result of `complete()` was delivered to the browser, so your server does not trust it. The `confirm` action reads the record with the secret key and grants access only when four things hold: the status is `recorded`, `timestamped` or `anchored`; `livemode` is what this deployment expects; the signer is the one this server created the session for; and the document versions are exactly the ones in the session. This step is never optional.

`storage/logs/laravel.log` has one line for each confirmation:

```text
local.INFO: confirmed rec_4UbtJCK59iPAgJ1CKD58 (recorded)
```

A POST that carries neither a same-origin browser header nor the CSRF token never reaches the action: Laravel answers `419`. With the token, a record ID that was made up is refused with status `409`:

```bash
TOKEN=$(curl -s -c jar.txt http://localhost:8000/signup | grep -o 'name="csrf-token" content="[^"]*"' | sed 's/.*content="//; s/"$//')
curl -s -b jar.txt -X POST http://localhost:8000/api/signup/confirm \
  -H "X-CSRF-TOKEN: $TOKEN" -H "Content-Type: application/json" -d '{"recordId":"rec_made_up"}'
```

```json
{"confirmed":false}
```

See [Server confirmation](https://esigncomply.com/docs/guides/server-confirmation.md) for the webhook that backs this action up when the browser closes early.

## Step 7. Check the result

Open the dashboard and choose **Records**. The test record is there with what was observed, what was asserted, and its evidence report, watermarked TEST.

Then run the conformance check against the page. It opens the page in headless Chromium at three window sizes, signs as a visitor would, and tries four things that must be refused. One of them posts a made-up record ID to your confirm route. The checker is a Node.js command line tool, so it needs Node.js 20.19 or later, in a folder of its own:

```bash
mkdir -p esc-check && cd esc-check
npm init -y && npm install esigncomply playwright
npx playwright install chromium
npx esigncomply check --url http://localhost:8000/signup --callback http://localhost:8000/api/signup/confirm
```

The report for this page's code, shortened:

```text
Violations that must be refused
  REFUSED   Submit with the checkbox untouched      No record was made.
  REFUSED   Completion from another origin          The API answered 403 domain_mismatch.
  REFUSED   Programmatic click                      No record was made.
  REFUSED   Forged success posted to your callback  http://localhost:8000/api/signup/confirm answered 419.

Ceremonies
  390x844    record rec_4UbtJCK59iPAgJ1CKD58  session ses_0L8WBhodStHwFJAE9Qhh, 5 events
  768x1024   record rec_b4bQ6hvSXJZRv9uccBMH  session ses_Dg6nmeb3kqx3hT8iUXXG, 5 events
  1440x900   record rec_g8f0SBM2rxfH2Di1E6aC  session ses_9xWomhgKhE5ucu3LJmUw, 5 events

Summary: 0 block, 0 warn, 27 pass.
```

The forged callback is answered `419` here, not `409`: it comes from outside a browser with no CSRF token, so Laravel refuses it before the action runs.

Fix every finding marked `block` and read every finding marked `warn`. Each one names the rule the screen missed, the measurement and the fix. In test mode a finding never stops a record from being sealed, so read the report. The rules are on [Conformance rules](https://esigncomply.com/docs/conformance.md), and every flag of the command is on the [CLI page](https://esigncomply.com/docs/sdk/cli.md).

## Step 8. Go live

Going live takes three steps on the Esign Comply side. There is no plan to choose and no checkout: the Free plan records 10 live signatures a month.

1. Register your production domain and verify it. See [Register a domain](https://esigncomply.com/docs/guides/domains.md).
2. Add your organization's legal name, country and address under **Go live** in the dashboard.
3. Create a live key. It is shown once and starts with `esc_live_`.

Test and live share nothing, so create the documents and the profile again with the live key, or copy them to live from the dashboard, and use the live IDs in production.

Then switch the app over:

- Set the live key as `ESIGNCOMPLY_API_KEY` and set `ESIGNCOMPLY_LIVE=true` in the production `.env` only. From then on the `confirm` action refuses every test record there.
- Run `php artisan config:cache` in your deployment, as Laravel's documentation recommends. The controller keeps working because it reads `config('esigncomply.key')`, not `env()`.
- Store the record ID and the receipt in a model beside the user. [Clickwrap in Laravel](https://esigncomply.com/guides/laravel-clickwrap) has the model and the webhook.

In live mode `context.url` must be inside your registered domain, and browser calls are accepted only from it. By default a live signature with a finding at Block level is recorded and you are told at once which rule failed. Turn on blocking, on the dashboard's Conformance page, and it is refused before it is sealed. Run the check from step 7 until no finding is at Block level before you switch keys.

## Troubleshooting

- **`419` on a POST.** The request failed Laravel's request forgery check: it had no CSRF token and did not come from the same origin in a browser. Send the token from the meta tag in the `X-CSRF-TOKEN` header, as the page does. The Esign Comply API is not involved: the request never left Laravel.
- **`missing_api_key` or `invalid_api_key` after a deployment.** The code reads the key with `env()` and the configuration is cached. In the test, `env('ESIGNCOMPLY_API_KEY')` returned null after `php artisan config:cache` while `config('esigncomply.key')` still held the key. See [`missing_api_key`](https://esigncomply.com/docs/api/errors.md#missing_api_key).
- **The document page shows tags as text.** The view prints the HTML with `{{ }}`, which escapes it: in the test run the page came back as `&lt;h1&gt;Terms of Service`. The text then differs from the registered version, which is what [`render_mismatch`](https://esigncomply.com/docs/api/errors.md#render_mismatch) is about. Print the registered HTML with `{!! !!}`.
- **`429` when the `confirm` action reads the record.** The client that `esc()` builds carries `retry`: on `429` Laravel waits for the seconds in `Retry-After`, 1 at least and 5 at most, and sends the request again, up to twice. Nothing else is retried. In the test, four confirmations sent at once from the session that signed all answered `200`, one of them 1.5 seconds after the others. Four reads sent in a row through the same client showed why: the fourth got `429` with `Retry-After: 1` and passed on the next attempt. See [`rate_limit_exceeded`](https://esigncomply.com/docs/api/errors.md#rate_limit_exceeded).

## Questions about the Laravel quickstart

### Is there a Composer package for Esign Comply?

No. The server SDK exists for Node.js only. A Laravel app calls the REST API directly, and this quickstart does it with the `Http` facade that ships with the framework, so `composer.json` does not change.

### Why does the quickstart add a config file?

So the key is read with `config()`. Laravel's documentation says to call `env()` only from configuration files, because once the configuration is cached the `.env` file is no longer loaded. In the test, `env()` returned null after `config:cache` and `config('esigncomply.key')` did not.

### Where are the pinned versions kept in Laravel?

In the session, with `$request->session()->put()`. A new Laravel app stores sessions in the database, and the browser holds a cookie that was `HttpOnly` in the test run. The visitor cannot read or change what the server pinned.

### How is this different from the Laravel guide?

The quickstart is the shortest path to a sealed test record: one controller, one config file, two views and a fixed test signer. The guide is a whole registration flow, with a model that stores the acceptance and the `record.completed` webhook.

### Does the Laravel quickstart need a domain or a card?

No. Test mode works on `localhost` with a test key, no card and no domain. You register and verify a domain only when you go live, and the Free plan then records 10 live signatures a month.

## Next steps

- [E-signatures and clickwrap for Laravel](https://esigncomply.com/laravel): what the integration gives you on this stack, with the things to watch for.
- [Clickwrap in Laravel](https://esigncomply.com/guides/laravel-clickwrap): the full app with the model, the controllers and the webhook.
- [Server confirmation](https://esigncomply.com/docs/guides/server-confirmation.md): the checks in step 6 and the `record.completed` webhook.
- [Sessions API](https://esigncomply.com/docs/api/sessions.md) and [Records API](https://esigncomply.com/docs/api/records.md): every field of the two calls this app makes.
- [All quickstarts](https://esigncomply.com/docs/quickstart.md#quickstarts-by-stack-and-platform).
