@checkbox-site/node 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +112 -2
- package/dist/client.d.ts +1850 -0
- package/dist/client.js +337 -0
- package/dist/errors.d.ts +89 -0
- package/dist/errors.js +125 -0
- package/dist/generated/operations.d.ts +3341 -0
- package/dist/generated/operations.js +2990 -0
- package/dist/generated/types.d.ts +4436 -0
- package/dist/generated/types.js +57 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +15 -0
- package/dist/resource.d.ts +59 -0
- package/dist/resource.js +63 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/dist/webhooks.d.ts +40 -0
- package/dist/webhooks.js +129 -0
- package/package.json +57 -4
|
@@ -0,0 +1,4436 @@
|
|
|
1
|
+
/** The API version these types describe (sent as Checkbox-Version by default). */
|
|
2
|
+
export declare const API_VERSION = "2026-10-30";
|
|
3
|
+
/** Every API version the server knows, oldest first. */
|
|
4
|
+
export declare const API_VERSIONS: readonly ["2026-10-30"];
|
|
5
|
+
export type ApiVersion = (typeof API_VERSIONS)[number];
|
|
6
|
+
/** `T` with the keys `K` required. */
|
|
7
|
+
export type WithRequired<T, K extends keyof T> = T & {
|
|
8
|
+
[P in K]-?: Exclude<T[P], undefined>;
|
|
9
|
+
};
|
|
10
|
+
/** What the caller (often an AI agent) should do next. */
|
|
11
|
+
export interface NextAction {
|
|
12
|
+
/** Stable machine-readable action type, e.g. "verify_domain", "create_site", "wait". */
|
|
13
|
+
type: string;
|
|
14
|
+
/** One sentence telling the caller what to do next. */
|
|
15
|
+
message: string;
|
|
16
|
+
/** operationId of the API call to make next (also the SDK method name). */
|
|
17
|
+
operation_id?: string;
|
|
18
|
+
/** The MCP tool that performs operation_id on the Checkbox MCP server (`call_api` when there is no dedicated tool). */
|
|
19
|
+
mcp_tool?: string;
|
|
20
|
+
/** Documentation or dashboard URL for the step, when there is one. */
|
|
21
|
+
url?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Every non-2xx response has this shape. */
|
|
24
|
+
export interface Error {
|
|
25
|
+
/** Error details. */
|
|
26
|
+
error: {
|
|
27
|
+
/** Category of the error. */
|
|
28
|
+
type: "invalid_request_error" | "authentication_error" | "permission_error" | "rate_limit_error" | "idempotency_error" | "api_error";
|
|
29
|
+
/** Stable error code (see the error code list in the docs). Never changes meaning. */
|
|
30
|
+
code: string;
|
|
31
|
+
/** Human- and LLM-readable explanation. */
|
|
32
|
+
message: string;
|
|
33
|
+
/** The parameter the error relates to, when there is one. */
|
|
34
|
+
param?: string;
|
|
35
|
+
/** Link to the documentation of this error code. */
|
|
36
|
+
doc_url: string;
|
|
37
|
+
/** Id of the request (also in the Request-Id header). Quote it to support. */
|
|
38
|
+
request_id: string;
|
|
39
|
+
next_action?: NextAction;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** The single next thing the agent should do. */
|
|
43
|
+
export interface SetupNextAction {
|
|
44
|
+
/** Stable action type: install_snippet, set_site_url, deploy_and_verify, register_policies, fix_policy_url, verify, wait, store_stripe_test_key, register_checkout_config, start_test_run, wait_for_test_run, fix_test_run, apply_compliance_plan, review_plan, verify_domain, complete_setup, done. */
|
|
45
|
+
type: string;
|
|
46
|
+
/** One or two sentences telling the agent exactly what to do. */
|
|
47
|
+
message: string;
|
|
48
|
+
/** The API operation (SDK method) that performs or checks the step. */
|
|
49
|
+
operation_id?: string;
|
|
50
|
+
/** The MCP tool that performs operation_id (`call_api` when there is no dedicated tool). */
|
|
51
|
+
mcp_tool?: string;
|
|
52
|
+
/** The equivalent `checkbox` CLI command, when there is one. */
|
|
53
|
+
command?: string;
|
|
54
|
+
/** Documentation or dashboard URL for the step. */
|
|
55
|
+
url?: string;
|
|
56
|
+
}
|
|
57
|
+
/** A pending device login (RFC 8628 style). */
|
|
58
|
+
export interface DeviceAuthorization {
|
|
59
|
+
/** String representing the object's type. Always "device_authorization". */
|
|
60
|
+
object: "device_authorization";
|
|
61
|
+
/** Secret code the CLI polls with (keep it private). */
|
|
62
|
+
device_code: string;
|
|
63
|
+
/** Code the human sees and confirms in the browser. */
|
|
64
|
+
user_code: string;
|
|
65
|
+
/** Page the human opens. */
|
|
66
|
+
verification_uri: string;
|
|
67
|
+
/** Same page with the code filled in: open this. */
|
|
68
|
+
verification_uri_complete: string;
|
|
69
|
+
/** Seconds until the codes expire. */
|
|
70
|
+
expires_in: number;
|
|
71
|
+
/** Seconds to wait between createDeviceToken polls. */
|
|
72
|
+
interval: number;
|
|
73
|
+
next_action: SetupNextAction;
|
|
74
|
+
}
|
|
75
|
+
/** Who is setting up Checkbox. */
|
|
76
|
+
export interface SetupClient {
|
|
77
|
+
/** Client program. */
|
|
78
|
+
name?: string;
|
|
79
|
+
/** Client version. */
|
|
80
|
+
version?: string;
|
|
81
|
+
/** The AI agent driving the client, when known (shown to the human). */
|
|
82
|
+
agent?: string;
|
|
83
|
+
/** Operating system. */
|
|
84
|
+
os?: string;
|
|
85
|
+
}
|
|
86
|
+
/** What the CLI is about to set up (display only). */
|
|
87
|
+
export interface DeviceAuthorizationParams {
|
|
88
|
+
client?: SetupClient;
|
|
89
|
+
/** Site URL detected in the project (shown on the approval screen; the test-mode site is created for it). */
|
|
90
|
+
site_url?: string;
|
|
91
|
+
/** Project name. */
|
|
92
|
+
project_name?: string;
|
|
93
|
+
/** Detected framework. */
|
|
94
|
+
framework?: string;
|
|
95
|
+
/** Package manager. */
|
|
96
|
+
package_manager?: string;
|
|
97
|
+
/** Detected billing platform. */
|
|
98
|
+
billing_platform?: string;
|
|
99
|
+
/** Also ask for live-mode keys (live mode activates after domain verification). */
|
|
100
|
+
live?: boolean;
|
|
101
|
+
/** A HINT of the Stripe TEST key found in the project ("sk_test_…a1b2" — never the key). The human is asked once whether Checkbox may use it for synthetic test subscriptions. */
|
|
102
|
+
stripe_test_key_hint?: string;
|
|
103
|
+
}
|
|
104
|
+
/** Keys issued after the human approved the device login. Returned exactly once. */
|
|
105
|
+
export interface DeviceToken {
|
|
106
|
+
/** String representing the object's type. Always "device_token". */
|
|
107
|
+
object: "device_token";
|
|
108
|
+
/** Always "bearer". */
|
|
109
|
+
token_type: "bearer";
|
|
110
|
+
/** Test-mode secret key (ck_test_…), shown once. Store it in CHECKBOX_SECRET_KEY (server side only; never commit it). */
|
|
111
|
+
secret_key: string;
|
|
112
|
+
/** Test-mode publishable key (pk_test_…) for the browser. */
|
|
113
|
+
publishable_key: string;
|
|
114
|
+
/** Live-mode secret key when the human approved live keys (works for live routes after domain verification). */
|
|
115
|
+
live_secret_key: string | null;
|
|
116
|
+
/** Live-mode publishable key. */
|
|
117
|
+
live_publishable_key: string | null;
|
|
118
|
+
/** The account the keys belong to. */
|
|
119
|
+
account: {
|
|
120
|
+
/** Unique identifier of the account (acct_…). */
|
|
121
|
+
id: string;
|
|
122
|
+
/** Account (organization) name. */
|
|
123
|
+
name: string;
|
|
124
|
+
/** Email of the person who approved. */
|
|
125
|
+
email: string | null;
|
|
126
|
+
};
|
|
127
|
+
/** The setup session to continue with (retrieveSetupSession / updateSetupSession). */
|
|
128
|
+
setup_session: string;
|
|
129
|
+
/** The test-mode site created for site_url, if any. */
|
|
130
|
+
site: string | null;
|
|
131
|
+
/** What the human approved. */
|
|
132
|
+
consents: {
|
|
133
|
+
/** The human allowed Checkbox to use the project's Stripe TEST key (send it with createTestCredential). */
|
|
134
|
+
stripe_test_key: boolean;
|
|
135
|
+
/** Live keys were issued. */
|
|
136
|
+
live_keys: boolean;
|
|
137
|
+
};
|
|
138
|
+
next_action: SetupNextAction;
|
|
139
|
+
}
|
|
140
|
+
/** A subscription plan as the merchant sells it. */
|
|
141
|
+
export interface SetupPlan {
|
|
142
|
+
/** Plan name. */
|
|
143
|
+
name?: string;
|
|
144
|
+
/** Recurring charge in minor units. */
|
|
145
|
+
amount?: number;
|
|
146
|
+
/** ISO currency code. */
|
|
147
|
+
currency?: string;
|
|
148
|
+
/** Billing interval. */
|
|
149
|
+
interval?: "day" | "week" | "month" | "year";
|
|
150
|
+
/** Intervals per billing period. */
|
|
151
|
+
interval_count?: number;
|
|
152
|
+
/** Free-trial days (0 = none). */
|
|
153
|
+
trial_days?: number;
|
|
154
|
+
}
|
|
155
|
+
/** One step of the setup checklist. */
|
|
156
|
+
export interface SetupStep {
|
|
157
|
+
/** Stable step key. */
|
|
158
|
+
key: "account" | "site" | "snippet" | "policies" | "checks" | "lifecycle_test" | "fixes" | "domain" | "owner_notified";
|
|
159
|
+
/** Human-readable title. */
|
|
160
|
+
title: string;
|
|
161
|
+
/** done; pending (waiting on Checkbox or a deploy); action_required (the agent must act: see next_action); skipped; failed. */
|
|
162
|
+
status: "done" | "pending" | "action_required" | "skipped" | "failed";
|
|
163
|
+
/** What is true now, in one sentence. */
|
|
164
|
+
summary: string;
|
|
165
|
+
next_action: SetupNextAction | null;
|
|
166
|
+
}
|
|
167
|
+
/** What an AI coding agent set up for a project, as a checklist with one next_action. Loop: apply next_action, call verifySetupSession, repeat until next_action.type is "done". */
|
|
168
|
+
export interface SetupSession {
|
|
169
|
+
/** Unique identifier of the setup session (setup_…). */
|
|
170
|
+
id: string;
|
|
171
|
+
/** String representing the object's type. Always "setup_session". */
|
|
172
|
+
object: "setup_session";
|
|
173
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
174
|
+
livemode: boolean;
|
|
175
|
+
/** open while the agent works; completed after completeSetupSession (checks keep running). */
|
|
176
|
+
status: "open" | "completed" | "canceled";
|
|
177
|
+
/** When the human approved the setup. Unix timestamp in seconds. */
|
|
178
|
+
created: number;
|
|
179
|
+
/** Last change. Unix timestamp in seconds. */
|
|
180
|
+
updated: number;
|
|
181
|
+
/** The Checkbox account. */
|
|
182
|
+
account: string;
|
|
183
|
+
/** The test-mode site (null until a site URL is known). */
|
|
184
|
+
site: string | null;
|
|
185
|
+
/** The live-mode site, once created. */
|
|
186
|
+
live_site: string | null;
|
|
187
|
+
/** Who set it up. */
|
|
188
|
+
client: {
|
|
189
|
+
/** Client program. */
|
|
190
|
+
name: string | null;
|
|
191
|
+
/** Client version. */
|
|
192
|
+
version: string | null;
|
|
193
|
+
/** AI agent, when known. */
|
|
194
|
+
agent: string | null;
|
|
195
|
+
};
|
|
196
|
+
/** Facts about the codebase the agent reported (framework, layout_file, checkout_code…). */
|
|
197
|
+
project: Record<string, unknown>;
|
|
198
|
+
/** The business as registered. */
|
|
199
|
+
business: {
|
|
200
|
+
/** Site URL. */
|
|
201
|
+
site_url: string | null;
|
|
202
|
+
/** Checkout / pricing page. */
|
|
203
|
+
checkout_url: string | null;
|
|
204
|
+
/** Account page. */
|
|
205
|
+
account_url: string | null;
|
|
206
|
+
/** Terms of service. */
|
|
207
|
+
terms_url: string | null;
|
|
208
|
+
/** Privacy policy. */
|
|
209
|
+
privacy_url: string | null;
|
|
210
|
+
/** Refund policy. */
|
|
211
|
+
refund_url: string | null;
|
|
212
|
+
/** Cancellation policy. */
|
|
213
|
+
cancellation_url: string | null;
|
|
214
|
+
/** Support email. */
|
|
215
|
+
support_email: string | null;
|
|
216
|
+
/** Merchant (brand) name used in generated legal copy (the site name). */
|
|
217
|
+
merchant_name: string | null;
|
|
218
|
+
/** Billing platform. */
|
|
219
|
+
billing_platform: string | null;
|
|
220
|
+
/** Plans. */
|
|
221
|
+
plans: Array<SetupPlan>;
|
|
222
|
+
};
|
|
223
|
+
/** Policy / pricing links Checkbox found in the site's HTML (terms_url, privacy_url, refund_url, cancellation_url, pricing_url, account_url). */
|
|
224
|
+
discovered: Record<string, string>;
|
|
225
|
+
/** Install details. */
|
|
226
|
+
install: {
|
|
227
|
+
/** The exact tag to put in <head> on every page. */
|
|
228
|
+
script_tag: string | null;
|
|
229
|
+
/** Public snippet key of the site. */
|
|
230
|
+
snippet_key: string | null;
|
|
231
|
+
/** Test-mode publishable key (pk_test_…) for Checkbox Elements in the browser. */
|
|
232
|
+
publishable_key: string | null;
|
|
233
|
+
/** BCC this address on subscription emails (acknowledgment, reminders) so they are checked. */
|
|
234
|
+
inbound_email: string | null;
|
|
235
|
+
/** File the agent added the snippet to. */
|
|
236
|
+
installed_in: string | null;
|
|
237
|
+
/** Whether Checkbox saw the snippet on the live site at the last verify (null: not checked). */
|
|
238
|
+
detected_on_site: boolean | null;
|
|
239
|
+
};
|
|
240
|
+
/** Policy documents Checkbox fetched (checked by terms.* checks). */
|
|
241
|
+
policies: Array<{
|
|
242
|
+
/** terms, privacy, refund or cancellation. */
|
|
243
|
+
kind: string;
|
|
244
|
+
/** URL fetched. */
|
|
245
|
+
url: string;
|
|
246
|
+
/** Fetch result. */
|
|
247
|
+
status: "fetched" | "failed";
|
|
248
|
+
/** When it was fetched. Unix timestamp in seconds. */
|
|
249
|
+
fetched: number;
|
|
250
|
+
/** Why the fetch failed. */
|
|
251
|
+
error: string | null;
|
|
252
|
+
/** Evidence record of the stored page (ev_…). */
|
|
253
|
+
evidence: string | null;
|
|
254
|
+
}>;
|
|
255
|
+
/** Stripe test mode for lifecycle test runs. */
|
|
256
|
+
stripe: {
|
|
257
|
+
/** Whether the human allowed Checkbox to use the project's Stripe TEST key for synthetic subscriptions. */
|
|
258
|
+
test_key_consent: boolean;
|
|
259
|
+
/** Hint of the key the CLI found (never the key). */
|
|
260
|
+
test_key_hint: string | null;
|
|
261
|
+
/** Whether a Stripe test-mode key is stored for test runs. */
|
|
262
|
+
test_credential_stored: boolean;
|
|
263
|
+
/** Registered Checkout Session param sets. */
|
|
264
|
+
checkout_configs: number;
|
|
265
|
+
/** Restricted-key recommendation. */
|
|
266
|
+
restricted_key: {
|
|
267
|
+
/** true while no restricted (rk_test_) key is stored. */
|
|
268
|
+
recommended: boolean;
|
|
269
|
+
/** Why. */
|
|
270
|
+
reason: string;
|
|
271
|
+
/** Where to create it. */
|
|
272
|
+
create_url: string;
|
|
273
|
+
/** Least-privilege permissions. */
|
|
274
|
+
permissions: Array<{
|
|
275
|
+
/** Stripe resource. */
|
|
276
|
+
resource: string;
|
|
277
|
+
/** Access. */
|
|
278
|
+
access: "read" | "write";
|
|
279
|
+
}>;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
/** Latest lifecycle test run of the site. */
|
|
283
|
+
test_run: {
|
|
284
|
+
/** Unique identifier of the test run (run_…). */
|
|
285
|
+
id: string;
|
|
286
|
+
/** queued, running, succeeded, failed or canceled. */
|
|
287
|
+
status: string;
|
|
288
|
+
/** When it started. Unix timestamp in seconds. */
|
|
289
|
+
created: number;
|
|
290
|
+
} | null;
|
|
291
|
+
/** Latest verdict of the test-mode site. */
|
|
292
|
+
compliance: {
|
|
293
|
+
/** 0-100. */
|
|
294
|
+
score: number;
|
|
295
|
+
/** No critical/high failure open. */
|
|
296
|
+
insurable: boolean;
|
|
297
|
+
/** When it was evaluated. Unix timestamp in seconds. */
|
|
298
|
+
evaluated: number;
|
|
299
|
+
/** Open failing findings. */
|
|
300
|
+
failing: number;
|
|
301
|
+
/** Open needs-review findings. */
|
|
302
|
+
needs_review: number;
|
|
303
|
+
/** Most urgent open findings (details: retrieveFinding; ordered tasks: `checkbox plan --json`). */
|
|
304
|
+
top_findings: Array<{
|
|
305
|
+
/** Unique identifier of the finding (fnd_…). */
|
|
306
|
+
id: string;
|
|
307
|
+
/** Check id. */
|
|
308
|
+
check_id: string;
|
|
309
|
+
/** fail or needs_review. */
|
|
310
|
+
status: string;
|
|
311
|
+
/** critical, high, medium or low. */
|
|
312
|
+
severity: string;
|
|
313
|
+
/** What is wrong. */
|
|
314
|
+
title: string;
|
|
315
|
+
}>;
|
|
316
|
+
} | null;
|
|
317
|
+
/** The setup checklist, in order. */
|
|
318
|
+
steps: Array<SetupStep>;
|
|
319
|
+
next_action: SetupNextAction;
|
|
320
|
+
/** Whether the human got the summary email. */
|
|
321
|
+
owner_notified: boolean;
|
|
322
|
+
/** The summary email: sent, or not_configured when this deployment has no SMTP (null before completeSetupSession). */
|
|
323
|
+
owner_email: "sent" | "not_configured" | null;
|
|
324
|
+
/** Dashboard page with the setup timeline (for the human). */
|
|
325
|
+
review_url: string;
|
|
326
|
+
}
|
|
327
|
+
/** A place in the builder's code relevant to compliance. */
|
|
328
|
+
export interface SetupCodeRef {
|
|
329
|
+
/** Path relative to the project root. */
|
|
330
|
+
file: string;
|
|
331
|
+
/** 1-based line number. */
|
|
332
|
+
line?: number;
|
|
333
|
+
/** What was found: stripe_checkout_session, stripe_payment_link, stripe_pricing_table, stripe_elements, subscribe_button, shopify_checkout… */
|
|
334
|
+
kind: string;
|
|
335
|
+
/** The matching source line (trimmed). */
|
|
336
|
+
snippet?: string;
|
|
337
|
+
}
|
|
338
|
+
/** What the agent learned or changed. */
|
|
339
|
+
export interface SetupSessionUpdate {
|
|
340
|
+
/** Public URL of the site (production, or a preview deployment). */
|
|
341
|
+
site_url?: string;
|
|
342
|
+
/** Page where customers subscribe (pricing page or checkout). */
|
|
343
|
+
checkout_url?: string;
|
|
344
|
+
/** Account page where subscribers manage / cancel. */
|
|
345
|
+
account_url?: string;
|
|
346
|
+
/** Terms of service page. Checkbox fetches and checks it. */
|
|
347
|
+
terms_url?: string;
|
|
348
|
+
/** Privacy policy page. */
|
|
349
|
+
privacy_url?: string;
|
|
350
|
+
/** Refund policy page. */
|
|
351
|
+
refund_url?: string;
|
|
352
|
+
/** Cancellation policy page (if separate from the Terms). */
|
|
353
|
+
cancellation_url?: string;
|
|
354
|
+
/** Support address subscribers can write to. */
|
|
355
|
+
support_email?: string;
|
|
356
|
+
/** The brand subscribers know (it names the seller in generated disclosures and emails). Default: the site's host name, which the plan asks you to replace. */
|
|
357
|
+
merchant_name?: string;
|
|
358
|
+
/** Billing platform. */
|
|
359
|
+
billing_platform?: "stripe" | "shopify" | "recharge" | "chargebee" | "recurly" | "paddle" | "woocommerce" | "custom";
|
|
360
|
+
/** Plans and prices (sets the free-trial and term facts the law depends on). */
|
|
361
|
+
plans?: Array<SetupPlan>;
|
|
362
|
+
/** Facts about the builder's codebase. */
|
|
363
|
+
project?: {
|
|
364
|
+
/** Project name (package.json name). */
|
|
365
|
+
name?: string;
|
|
366
|
+
/** Detected framework: nextjs-app, nextjs-pages, remix, sveltekit, nuxt, astro, express, html, shopify-theme… */
|
|
367
|
+
framework?: string;
|
|
368
|
+
/** npm, pnpm, yarn or bun. */
|
|
369
|
+
package_manager?: string;
|
|
370
|
+
/** Project root (display only). */
|
|
371
|
+
root?: string;
|
|
372
|
+
/** Root layout / template where the snippet belongs. */
|
|
373
|
+
layout_file?: string;
|
|
374
|
+
/** File the keys were written to. */
|
|
375
|
+
env_file?: string;
|
|
376
|
+
/** Static files directory (for /.well-known). */
|
|
377
|
+
public_dir?: string;
|
|
378
|
+
/** Where checkout sessions / payment links are created. */
|
|
379
|
+
checkout_code?: Array<SetupCodeRef>;
|
|
380
|
+
/** Where the subscribe / pay buttons are rendered. */
|
|
381
|
+
pay_buttons?: Array<SetupCodeRef>;
|
|
382
|
+
};
|
|
383
|
+
/** File the snippet tag was added to. */
|
|
384
|
+
snippet_installed_in?: string;
|
|
385
|
+
/** File the API keys were written to (never committed). */
|
|
386
|
+
env_written?: string;
|
|
387
|
+
/** Live-mode site (site_…) you created with the live key, so the checklist tracks its domain verification. */
|
|
388
|
+
live_site?: string;
|
|
389
|
+
client?: SetupClient;
|
|
390
|
+
/** Fetch the policy pages again even when their URLs did not change (after editing them). */
|
|
391
|
+
refetch_policies?: boolean;
|
|
392
|
+
}
|
|
393
|
+
/** A page of setup sessions, newest first. */
|
|
394
|
+
export interface SetupSessionList {
|
|
395
|
+
/** String representing the object's type. Always "list". */
|
|
396
|
+
object: "list";
|
|
397
|
+
/** Setup sessions, newest first. */
|
|
398
|
+
data: Array<SetupSession>;
|
|
399
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
400
|
+
has_more: boolean;
|
|
401
|
+
/** The URL of this list. */
|
|
402
|
+
url: string;
|
|
403
|
+
}
|
|
404
|
+
/** Result of verifySetupSession, with the updated session. */
|
|
405
|
+
export interface SetupVerification {
|
|
406
|
+
/** String representing the object's type. Always "setup_verification". */
|
|
407
|
+
object: "setup_verification";
|
|
408
|
+
/** What Checkbox saw on the site. */
|
|
409
|
+
homepage: {
|
|
410
|
+
/** Whether the site loaded. */
|
|
411
|
+
ok: boolean;
|
|
412
|
+
/** Whether the snippet is live. */
|
|
413
|
+
snippet_detected: boolean | null;
|
|
414
|
+
/** Why the site could not be loaded. */
|
|
415
|
+
error: string | null;
|
|
416
|
+
};
|
|
417
|
+
/** Policies fetched now. */
|
|
418
|
+
policies: Array<{
|
|
419
|
+
/** Policy kind. */
|
|
420
|
+
kind: string;
|
|
421
|
+
/** Fetched. */
|
|
422
|
+
ok: boolean;
|
|
423
|
+
/** Error. */
|
|
424
|
+
error: string | null;
|
|
425
|
+
}>;
|
|
426
|
+
/** Synthetic-shopper scan. */
|
|
427
|
+
scan: {
|
|
428
|
+
/** Whether a scan was queued now. */
|
|
429
|
+
queued: boolean;
|
|
430
|
+
/** The queued scan (scan_…). */
|
|
431
|
+
scan: string | null;
|
|
432
|
+
/** Why not. */
|
|
433
|
+
reason: string | null;
|
|
434
|
+
};
|
|
435
|
+
/** Whether compliance was re-evaluated now. */
|
|
436
|
+
evaluated: boolean;
|
|
437
|
+
setup_session: SetupSession;
|
|
438
|
+
}
|
|
439
|
+
/** The Checkbox account behind the API key. */
|
|
440
|
+
export interface Account {
|
|
441
|
+
/** Unique identifier of the account (acct_…). */
|
|
442
|
+
id: string;
|
|
443
|
+
/** String representing the object's type. Always "account". */
|
|
444
|
+
object: "account";
|
|
445
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
446
|
+
livemode: boolean;
|
|
447
|
+
/** Organization name. */
|
|
448
|
+
name: string;
|
|
449
|
+
/** Contact email. */
|
|
450
|
+
email: string | null;
|
|
451
|
+
/** API version the account is pinned to (default for requests without Checkbox-Version). */
|
|
452
|
+
api_version: string;
|
|
453
|
+
/** Live-mode activation. Test mode never needs it. */
|
|
454
|
+
activation: {
|
|
455
|
+
/** active: live mode is on; pending: verify a site domain; suspended: contact support. */
|
|
456
|
+
status: "active" | "pending" | "suspended";
|
|
457
|
+
/** How the account was activated. */
|
|
458
|
+
method: "domain" | "staff" | "grandfathered" | null;
|
|
459
|
+
/** The verified domain that activated it. */
|
|
460
|
+
domain: string | null;
|
|
461
|
+
/** When live mode was activated. Unix timestamp in seconds. */
|
|
462
|
+
activated_at: number | null;
|
|
463
|
+
};
|
|
464
|
+
/** Fair-use limits (everything is free; these only prevent abuse). */
|
|
465
|
+
limits: {
|
|
466
|
+
/** Fair-use limit of active sites per mode. */
|
|
467
|
+
max_sites: number;
|
|
468
|
+
/** Active sites in this mode. */
|
|
469
|
+
sites: number;
|
|
470
|
+
/** Fair-use API rate limit per mode. */
|
|
471
|
+
requests_per_minute: number;
|
|
472
|
+
};
|
|
473
|
+
/** The key that made this request. */
|
|
474
|
+
key: {
|
|
475
|
+
/** Kind of key used for this request. */
|
|
476
|
+
type: "secret" | "restricted" | "publishable";
|
|
477
|
+
/** Role the key acts with. */
|
|
478
|
+
role: "admin" | "member" | "viewer";
|
|
479
|
+
/** Restricted keys: resource permissions. */
|
|
480
|
+
scopes: Record<string, "read" | "write"> | null;
|
|
481
|
+
/** A legacy sk_live_ organization key. */
|
|
482
|
+
legacy: boolean;
|
|
483
|
+
};
|
|
484
|
+
/** Publishable key (pk_…) of this mode for the browser snippet / elements. */
|
|
485
|
+
publishable_key: string;
|
|
486
|
+
/** Commercial status. */
|
|
487
|
+
billing: {
|
|
488
|
+
/** Checkbox is free to use. */
|
|
489
|
+
plan: "free";
|
|
490
|
+
/** The compliance warranty is not offered yet (waitlist only; no coverage). */
|
|
491
|
+
warranty: "coming_soon";
|
|
492
|
+
};
|
|
493
|
+
/** When the account was created. Unix timestamp in seconds. */
|
|
494
|
+
created: number;
|
|
495
|
+
next_action: NextAction | null;
|
|
496
|
+
}
|
|
497
|
+
/** Business facts that decide which legal requirements apply. */
|
|
498
|
+
export interface SiteFacts {
|
|
499
|
+
/** The offer starts with a free trial. */
|
|
500
|
+
has_free_trial?: boolean;
|
|
501
|
+
/** Trial length in days. */
|
|
502
|
+
trial_days?: number;
|
|
503
|
+
/** Billing term in months (12 for annual plans). */
|
|
504
|
+
term_months?: number;
|
|
505
|
+
/** Customers sign up online (enables online-cancellation rules). */
|
|
506
|
+
online_signup?: boolean;
|
|
507
|
+
/** The subscription ships physical goods. */
|
|
508
|
+
sells_goods?: boolean;
|
|
509
|
+
/** Notices are sent by email. */
|
|
510
|
+
notice_channel_email?: boolean;
|
|
511
|
+
/** Price increases need consent or allow a refund (NY). */
|
|
512
|
+
price_increase_consent_or_refund?: boolean;
|
|
513
|
+
/** Accepted payment methods (debit / ACH bring in Reg E). */
|
|
514
|
+
payment_methods?: Array<"card" | "debit" | "ach" | "wallet" | "other">;
|
|
515
|
+
}
|
|
516
|
+
/** Scheduled monitoring. */
|
|
517
|
+
export interface SiteMonitoring {
|
|
518
|
+
/** Scheduled re-scans are on. */
|
|
519
|
+
enabled: boolean;
|
|
520
|
+
/** Re-scan interval (0 = off). */
|
|
521
|
+
interval_minutes: number;
|
|
522
|
+
/** Monitoring waits for a verified domain: live-mode activation, or in test mode a host that is not localhost or a domain the account verified. */
|
|
523
|
+
held_for_activation: boolean;
|
|
524
|
+
/** Last scheduled or manual scan. Unix timestamp in seconds. */
|
|
525
|
+
last_scanned: number | null;
|
|
526
|
+
/** Scans and monitoring wait until every URL Checkbox visits for the site (site, checkout, account, steps) is on a domain the account verified. See verify_domains. */
|
|
527
|
+
held_for_domain_verification: boolean;
|
|
528
|
+
/** Domains to verify before Checkbox scans the site (first: createDomainVerification for the site's own domain). */
|
|
529
|
+
verify_domains: Array<string>;
|
|
530
|
+
}
|
|
531
|
+
/** Latest verdict; null until the first evaluation. */
|
|
532
|
+
export type SiteCompliance = {
|
|
533
|
+
/** Compliance score 0-100 (one decimal place). */
|
|
534
|
+
score: number;
|
|
535
|
+
/** No critical/high obligation failing or unverified. */
|
|
536
|
+
insurable: boolean;
|
|
537
|
+
/** When the latest evaluation ran. Unix timestamp in seconds. */
|
|
538
|
+
evaluated: number;
|
|
539
|
+
/** Open findings whose latest status is fail. */
|
|
540
|
+
open_findings: number;
|
|
541
|
+
/** Open findings waiting for a human look. */
|
|
542
|
+
needs_review: number;
|
|
543
|
+
} | null;
|
|
544
|
+
/** What to install on the merchant site. */
|
|
545
|
+
export interface SiteInstall {
|
|
546
|
+
/** Paste into the <head> of every page (or let `checkbox init` do it). */
|
|
547
|
+
script_tag: string;
|
|
548
|
+
/** Public key of the snippet (also the inbound email local part). */
|
|
549
|
+
snippet_key: string;
|
|
550
|
+
/** The site's inbound address (public: it is the snippet key). Emails copied here are stored as evidence. To confirm a due notice from any sender, BCC that notice's own bcc address (listDueNotices). */
|
|
551
|
+
inbound_email: string;
|
|
552
|
+
/** Billing-platform webhook URLs (platform -> URL). */
|
|
553
|
+
webhook_urls: Record<string, string>;
|
|
554
|
+
}
|
|
555
|
+
/** Most recent scan (only with expand[]=latest_scan). */
|
|
556
|
+
export interface Scan {
|
|
557
|
+
/** Unique identifier of the scan (scan_…). */
|
|
558
|
+
id: string;
|
|
559
|
+
/** String representing the object's type. Always "scan". */
|
|
560
|
+
object: "scan";
|
|
561
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
562
|
+
livemode: boolean;
|
|
563
|
+
/** The scanned site. */
|
|
564
|
+
site: string;
|
|
565
|
+
/** queued → running → completed | failed. */
|
|
566
|
+
status: "queued" | "running" | "completed" | "failed";
|
|
567
|
+
/** What started the scan. */
|
|
568
|
+
trigger: "manual" | "scheduled" | "page_changed" | "api";
|
|
569
|
+
/** States the synthetic shopper visited from (empty for evaluation-only runs). */
|
|
570
|
+
regions: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
571
|
+
/** Why the scan failed. */
|
|
572
|
+
error: string | null;
|
|
573
|
+
/** Partial failures of a scan that still produced results. */
|
|
574
|
+
warnings: Array<string>;
|
|
575
|
+
/** The evaluation this scan produced (null until evaluated). */
|
|
576
|
+
evaluation: string | null;
|
|
577
|
+
/** Score of that evaluation (0-100, one decimal place). */
|
|
578
|
+
score: number | null;
|
|
579
|
+
/** Insurable flag of that evaluation. */
|
|
580
|
+
insurable: boolean | null;
|
|
581
|
+
/** When the scan started. Unix timestamp in seconds. */
|
|
582
|
+
started: number | null;
|
|
583
|
+
/** When the scan finished. Unix timestamp in seconds. */
|
|
584
|
+
finished: number | null;
|
|
585
|
+
/** When the scan was queued. Unix timestamp in seconds. */
|
|
586
|
+
created: number;
|
|
587
|
+
}
|
|
588
|
+
/** Domain verification (only with expand[]=domain_verification). */
|
|
589
|
+
export interface DomainVerification {
|
|
590
|
+
/** Unique identifier of the domain verification (dv_…). */
|
|
591
|
+
id: string;
|
|
592
|
+
/** String representing the object's type. Always "domain_verification". */
|
|
593
|
+
object: "domain_verification";
|
|
594
|
+
/** The site. */
|
|
595
|
+
site: string;
|
|
596
|
+
/** Domain of the site URL. */
|
|
597
|
+
domain: string | null;
|
|
598
|
+
/** not_started until createDomainVerification; verified once the TXT record or file was found. */
|
|
599
|
+
status: "not_started" | "pending" | "verified";
|
|
600
|
+
/** How control was proven. */
|
|
601
|
+
method: "dns_txt" | "well_known" | null;
|
|
602
|
+
/** When it was verified. Unix timestamp in seconds. */
|
|
603
|
+
verified_at: number | null;
|
|
604
|
+
/** Last check. Unix timestamp in seconds. */
|
|
605
|
+
last_checked: number | null;
|
|
606
|
+
/** Why the last check failed. */
|
|
607
|
+
last_error: string | null;
|
|
608
|
+
/** Publish this DNS record (option 1). */
|
|
609
|
+
dns_record: {
|
|
610
|
+
/** Record type. */
|
|
611
|
+
type: "TXT";
|
|
612
|
+
/** Record name. */
|
|
613
|
+
name: string;
|
|
614
|
+
/** Record value. */
|
|
615
|
+
value: string;
|
|
616
|
+
} | null;
|
|
617
|
+
/** Or serve this file (option 2). */
|
|
618
|
+
file: {
|
|
619
|
+
/** Serve the file here. */
|
|
620
|
+
url: string;
|
|
621
|
+
/** Exact file contents. */
|
|
622
|
+
contents: string;
|
|
623
|
+
} | null;
|
|
624
|
+
/** Configured scan URLs outside the verified domain (certificates cover only the domain). */
|
|
625
|
+
scan_target_problems: Array<string>;
|
|
626
|
+
/** Whether live mode is activated for the account. */
|
|
627
|
+
account_activated: boolean;
|
|
628
|
+
/** What to do next; null when verified. */
|
|
629
|
+
next_action: {
|
|
630
|
+
/** Stable action type. */
|
|
631
|
+
type: string;
|
|
632
|
+
/** What to do next. */
|
|
633
|
+
message: string;
|
|
634
|
+
/** Operation to call next. */
|
|
635
|
+
operation_id?: string;
|
|
636
|
+
/** The MCP tool that performs operation_id (`call_api` when there is no dedicated tool). */
|
|
637
|
+
mcp_tool?: string;
|
|
638
|
+
} | null;
|
|
639
|
+
}
|
|
640
|
+
/** A subscription business Checkbox monitors. */
|
|
641
|
+
export interface Site {
|
|
642
|
+
/** Unique identifier of the site (site_…). */
|
|
643
|
+
id: string;
|
|
644
|
+
/** String representing the object's type. Always "site". */
|
|
645
|
+
object: "site";
|
|
646
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
647
|
+
livemode: boolean;
|
|
648
|
+
/** Display name. */
|
|
649
|
+
name: string;
|
|
650
|
+
/** Base URL. */
|
|
651
|
+
url: string;
|
|
652
|
+
/** Billing platform. */
|
|
653
|
+
platform: "stripe" | "shopify" | "recharge" | "chargebee" | "recurly" | "paddle" | "woocommerce" | "custom";
|
|
654
|
+
/** Evaluated jurisdictions (empty = all). */
|
|
655
|
+
jurisdictions: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
656
|
+
facts: SiteFacts;
|
|
657
|
+
/** Synthetic-shopper configuration (secrets are never returned). */
|
|
658
|
+
checkout: {
|
|
659
|
+
/** Checkout entry page. */
|
|
660
|
+
url: string;
|
|
661
|
+
/** States scanned from. */
|
|
662
|
+
regions: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
663
|
+
/** Devices scanned. */
|
|
664
|
+
devices: Array<"desktop" | "mobile">;
|
|
665
|
+
/** Number of configured checkout steps. */
|
|
666
|
+
checkout_steps: number;
|
|
667
|
+
/** A synthetic sign-up is configured. */
|
|
668
|
+
completes_purchase: boolean;
|
|
669
|
+
/** A test account for the cancellation test is configured. */
|
|
670
|
+
has_test_account: boolean;
|
|
671
|
+
/** The test account as configured (the password is write-only and never returned). */
|
|
672
|
+
test_account: {
|
|
673
|
+
/** Login page. */
|
|
674
|
+
login_url: string;
|
|
675
|
+
/** Test subscriber email. */
|
|
676
|
+
email: string;
|
|
677
|
+
} | null;
|
|
678
|
+
/** Number of explicit cancellation steps. */
|
|
679
|
+
cancel_steps: number;
|
|
680
|
+
/** Public account / cancellation page visited on every scan. */
|
|
681
|
+
account_url: string | null;
|
|
682
|
+
/** Terms of service page read on every scan. */
|
|
683
|
+
terms_url: string | null;
|
|
684
|
+
};
|
|
685
|
+
monitoring: SiteMonitoring;
|
|
686
|
+
compliance: SiteCompliance;
|
|
687
|
+
install: SiteInstall;
|
|
688
|
+
/** Archived (soft-deleted); evidence is retained. */
|
|
689
|
+
archived: boolean;
|
|
690
|
+
/** When the site was created. Unix timestamp in seconds. */
|
|
691
|
+
created: number;
|
|
692
|
+
latest_scan?: Scan;
|
|
693
|
+
domain_verification?: DomainVerification;
|
|
694
|
+
}
|
|
695
|
+
/** A page of sites, newest first. */
|
|
696
|
+
export interface SiteList {
|
|
697
|
+
/** String representing the object's type. Always "list". */
|
|
698
|
+
object: "list";
|
|
699
|
+
/** Sites, newest first. */
|
|
700
|
+
data: Array<Site>;
|
|
701
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
702
|
+
has_more: boolean;
|
|
703
|
+
/** The URL of this list. */
|
|
704
|
+
url: string;
|
|
705
|
+
}
|
|
706
|
+
/** One synthetic-shopper step. */
|
|
707
|
+
export type ScanStep = {
|
|
708
|
+
/** Navigate to a URL. */
|
|
709
|
+
action: "goto";
|
|
710
|
+
/** URL to open. */
|
|
711
|
+
url: string;
|
|
712
|
+
} | {
|
|
713
|
+
/** Click an element (by CSS selector or visible text). */
|
|
714
|
+
action: "click";
|
|
715
|
+
/** CSS selector of the element. */
|
|
716
|
+
selector?: string;
|
|
717
|
+
/** Visible text of the element (used when no selector). */
|
|
718
|
+
text?: string;
|
|
719
|
+
} | {
|
|
720
|
+
/** Type into an input (fill) or choose an option (select). */
|
|
721
|
+
action: "fill" | "select";
|
|
722
|
+
/** CSS selector of the input. */
|
|
723
|
+
selector: string;
|
|
724
|
+
/** Value; {{email}}, {{password}} and {{promoCode}} are substituted. */
|
|
725
|
+
value: string;
|
|
726
|
+
} | {
|
|
727
|
+
/** Wait for a time or an element. */
|
|
728
|
+
action: "wait";
|
|
729
|
+
/** Milliseconds to wait. */
|
|
730
|
+
ms?: number;
|
|
731
|
+
/** Wait until this element appears. */
|
|
732
|
+
selector?: string;
|
|
733
|
+
} | {
|
|
734
|
+
/** Record the current page as evidence. */
|
|
735
|
+
action: "capture";
|
|
736
|
+
/** What the page is. */
|
|
737
|
+
page_kind: "checkout" | "account" | "cancel" | "pricing" | "confirmation" | "other";
|
|
738
|
+
/** Label shown in the dashboard. */
|
|
739
|
+
label?: string;
|
|
740
|
+
};
|
|
741
|
+
/** How the synthetic shopper completes a real (free) sign-up. */
|
|
742
|
+
export interface SitePurchase {
|
|
743
|
+
/** Steps that complete a sign-up after the checkout page. */
|
|
744
|
+
steps: Array<ScanStep>;
|
|
745
|
+
/** 100%-off promo code used for the synthetic sign-up (write-only). */
|
|
746
|
+
promo_code?: string;
|
|
747
|
+
}
|
|
748
|
+
/** A test customer account the synthetic shopper uses to try cancelling online. */
|
|
749
|
+
export interface SiteTestAccount {
|
|
750
|
+
/** Login page of the test customer account. */
|
|
751
|
+
login_url: string;
|
|
752
|
+
/** Test account email. */
|
|
753
|
+
email: string;
|
|
754
|
+
/** Test account password (write-only; encrypted at rest). */
|
|
755
|
+
password: string;
|
|
756
|
+
/** Custom login steps. */
|
|
757
|
+
login_steps?: Array<ScanStep>;
|
|
758
|
+
/** Optional page on your site that re-activates the test subscription (a test-only route). The cancellation test really cancels the test account; the scanner opens this page after logging in, before cancelling, so every run starts subscribed. Without it, a run after a completed cancellation reports "already cancelled by an earlier scan" (needs review). */
|
|
759
|
+
reset_url?: string;
|
|
760
|
+
}
|
|
761
|
+
export interface CreateSiteParams {
|
|
762
|
+
/** Display name. */
|
|
763
|
+
name?: string;
|
|
764
|
+
/** Base URL of the business website. */
|
|
765
|
+
url: string;
|
|
766
|
+
/** Billing platform. */
|
|
767
|
+
platform?: "stripe" | "shopify" | "recharge" | "chargebee" | "recurly" | "paddle" | "woocommerce" | "custom";
|
|
768
|
+
/** Jurisdictions to evaluate (empty = all US laws). */
|
|
769
|
+
jurisdictions?: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
770
|
+
facts?: SiteFacts;
|
|
771
|
+
/** Page with the subscribe button (defaults to url). Not a Stripe-hosted session link. */
|
|
772
|
+
checkout_url?: string;
|
|
773
|
+
/** Public account or cancellation page. Visited on every scan, even without a test account, so offline-only cancellation instructions are seen. null clears it. */
|
|
774
|
+
account_url?: string | null;
|
|
775
|
+
/** Terms of service page. Checkbox reads it on every scan (rendering JavaScript, so single-page apps work) and checks its renewal and cancellation terms. null clears it. */
|
|
776
|
+
terms_url?: string | null;
|
|
777
|
+
/** Steps to reach the final pre-payment screen. */
|
|
778
|
+
checkout_steps?: Array<ScanStep>;
|
|
779
|
+
purchase?: SitePurchase;
|
|
780
|
+
test_account?: SiteTestAccount;
|
|
781
|
+
/** Explicit cancellation steps (otherwise auto-discovered). */
|
|
782
|
+
cancel_steps?: Array<ScanStep>;
|
|
783
|
+
/** States the synthetic shopper visits from. */
|
|
784
|
+
regions?: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
785
|
+
/** Devices to emulate. */
|
|
786
|
+
devices?: Array<"desktop" | "mobile">;
|
|
787
|
+
/** Scheduled re-scan interval (0 = off, minimum 60). Default 1440 in live mode, 0 in test mode. */
|
|
788
|
+
monitoring_interval_minutes?: number;
|
|
789
|
+
}
|
|
790
|
+
export interface UpdateSiteParams {
|
|
791
|
+
/** Display name. */
|
|
792
|
+
name?: string;
|
|
793
|
+
/** Base URL of the business website. */
|
|
794
|
+
url?: string;
|
|
795
|
+
/** Billing platform. */
|
|
796
|
+
platform?: "stripe" | "shopify" | "recharge" | "chargebee" | "recurly" | "paddle" | "woocommerce" | "custom";
|
|
797
|
+
/** Jurisdictions to evaluate (empty = all US laws). */
|
|
798
|
+
jurisdictions?: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
799
|
+
facts?: SiteFacts;
|
|
800
|
+
/** Page with the subscribe button (defaults to url). Not a Stripe-hosted session link. */
|
|
801
|
+
checkout_url?: string;
|
|
802
|
+
/** Public account or cancellation page. Visited on every scan, even without a test account, so offline-only cancellation instructions are seen. null clears it. */
|
|
803
|
+
account_url?: string | null;
|
|
804
|
+
/** Terms of service page. Checkbox reads it on every scan (rendering JavaScript, so single-page apps work) and checks its renewal and cancellation terms. null clears it. */
|
|
805
|
+
terms_url?: string | null;
|
|
806
|
+
/** Steps to reach the final pre-payment screen. */
|
|
807
|
+
checkout_steps?: Array<ScanStep>;
|
|
808
|
+
purchase?: SitePurchase;
|
|
809
|
+
test_account?: SiteTestAccount;
|
|
810
|
+
/** Explicit cancellation steps (otherwise auto-discovered). */
|
|
811
|
+
cancel_steps?: Array<ScanStep>;
|
|
812
|
+
/** States the synthetic shopper visits from. */
|
|
813
|
+
regions?: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
814
|
+
/** Devices to emulate. */
|
|
815
|
+
devices?: Array<"desktop" | "mobile">;
|
|
816
|
+
/** Scheduled re-scan interval (0 = off, minimum 60). Default 1440 in live mode, 0 in test mode. */
|
|
817
|
+
monitoring_interval_minutes?: number;
|
|
818
|
+
}
|
|
819
|
+
/** A billing-platform connection of a site. */
|
|
820
|
+
export interface Integration {
|
|
821
|
+
/** String representing the object's type. Always "integration". */
|
|
822
|
+
object: "integration";
|
|
823
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
824
|
+
livemode: boolean;
|
|
825
|
+
/** The site. */
|
|
826
|
+
site: string;
|
|
827
|
+
/** Billing platform. */
|
|
828
|
+
platform: string;
|
|
829
|
+
/** connected or error. */
|
|
830
|
+
status: string;
|
|
831
|
+
/** When the platform settings were last read. Unix timestamp in seconds. */
|
|
832
|
+
last_synced: number | null;
|
|
833
|
+
/** A problem worth fixing, e.g. a test-mode key on a live site. */
|
|
834
|
+
warning: string | null;
|
|
835
|
+
}
|
|
836
|
+
export interface ConnectBillingPlatformParams {
|
|
837
|
+
/** Billing platform. */
|
|
838
|
+
platform: "stripe" | "recharge" | "shopify";
|
|
839
|
+
/** Read-only credentials. Stripe: { "secretKey": "rk_test_…" } (a restricted key with read access; rk_test_ in test mode). Recharge: { "apiToken": "…" }. Shopify: { "shop": "store.myshopify.com", "accessToken": "shpat_…" }. */
|
|
840
|
+
credentials: Record<string, string>;
|
|
841
|
+
}
|
|
842
|
+
/** A page of scans, newest first. */
|
|
843
|
+
export interface ScanList {
|
|
844
|
+
/** String representing the object's type. Always "list". */
|
|
845
|
+
object: "list";
|
|
846
|
+
/** Scans, newest first. */
|
|
847
|
+
data: Array<Scan>;
|
|
848
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
849
|
+
has_more: boolean;
|
|
850
|
+
/** The URL of this list. */
|
|
851
|
+
url: string;
|
|
852
|
+
}
|
|
853
|
+
/** One check of an evaluation. */
|
|
854
|
+
export interface CheckSummary {
|
|
855
|
+
/** Check id. */
|
|
856
|
+
check_id: string;
|
|
857
|
+
/** Title. */
|
|
858
|
+
title: string;
|
|
859
|
+
/** Result. */
|
|
860
|
+
status: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
861
|
+
/** Severity. */
|
|
862
|
+
severity: "critical" | "high" | "medium" | "low";
|
|
863
|
+
/** Lifecycle stage. */
|
|
864
|
+
stage: "signup" | "confirmation" | "reminder" | "cancellation" | "config";
|
|
865
|
+
}
|
|
866
|
+
/** A compliance verdict for a site at a point in time. */
|
|
867
|
+
export interface Evaluation {
|
|
868
|
+
/** Unique identifier of the evaluation (eval_…). */
|
|
869
|
+
id: string;
|
|
870
|
+
/** String representing the object's type. Always "evaluation". */
|
|
871
|
+
object: "evaluation";
|
|
872
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
873
|
+
livemode: boolean;
|
|
874
|
+
/** The evaluated site. */
|
|
875
|
+
site: string;
|
|
876
|
+
/** The scan row this evaluation belongs to. */
|
|
877
|
+
scan: string;
|
|
878
|
+
/** Compliance score 0-100 (severity-weighted, one decimal place, e.g. 82.5). */
|
|
879
|
+
score: number;
|
|
880
|
+
/** No critical/high check failing, no critical check undecided, no high check without evidence. */
|
|
881
|
+
insurable: boolean;
|
|
882
|
+
/** Legal catalog / rules version used. */
|
|
883
|
+
rules_version: string;
|
|
884
|
+
/** When it was evaluated. Unix timestamp in seconds. */
|
|
885
|
+
evaluated: number;
|
|
886
|
+
/** Newest synthetic-shopper observation it used. Unix timestamp in seconds. */
|
|
887
|
+
observed: number | null;
|
|
888
|
+
/** Counts per status. */
|
|
889
|
+
summary: {
|
|
890
|
+
/** Passing checks. */
|
|
891
|
+
pass: number;
|
|
892
|
+
/** Failing checks. */
|
|
893
|
+
fail: number;
|
|
894
|
+
/** Checks needing a human look. */
|
|
895
|
+
needs_review: number;
|
|
896
|
+
/** Checks that do not apply. */
|
|
897
|
+
not_applicable: number;
|
|
898
|
+
};
|
|
899
|
+
/** Checks that keep the site from being insurable. */
|
|
900
|
+
blockers: Array<CheckSummary>;
|
|
901
|
+
/** Every check evaluated. */
|
|
902
|
+
checks: Array<CheckSummary>;
|
|
903
|
+
}
|
|
904
|
+
/** A page of evaluations, newest first. */
|
|
905
|
+
export interface EvaluationList {
|
|
906
|
+
/** String representing the object's type. Always "list". */
|
|
907
|
+
object: "list";
|
|
908
|
+
/** Evaluations, newest first. */
|
|
909
|
+
data: Array<Evaluation>;
|
|
910
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
911
|
+
has_more: boolean;
|
|
912
|
+
/** The URL of this list. */
|
|
913
|
+
url: string;
|
|
914
|
+
}
|
|
915
|
+
/** A legal requirement a finding checks. */
|
|
916
|
+
export interface RequirementRef {
|
|
917
|
+
/** Requirement id in the legal catalog. */
|
|
918
|
+
id: string;
|
|
919
|
+
/** Jurisdiction of the law. */
|
|
920
|
+
jurisdiction: "US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY";
|
|
921
|
+
/** Legal citation. */
|
|
922
|
+
citation: string;
|
|
923
|
+
/** What the law requires, in short. */
|
|
924
|
+
title: string;
|
|
925
|
+
/** Official source of the text. */
|
|
926
|
+
source_url: string;
|
|
927
|
+
}
|
|
928
|
+
/** How to fix the finding (see also the fixes resource and compliance plans). */
|
|
929
|
+
export type Remediation = {
|
|
930
|
+
/** What to change. */
|
|
931
|
+
summary: string;
|
|
932
|
+
/** Steps to fix it. */
|
|
933
|
+
steps: Array<string>;
|
|
934
|
+
/** Platform the steps are written for. */
|
|
935
|
+
platform: string | null;
|
|
936
|
+
/** Suggested disclosure text. */
|
|
937
|
+
suggested_copy: string | null;
|
|
938
|
+
/** Code snippet, when there is one. */
|
|
939
|
+
snippet: {
|
|
940
|
+
/** Language of the code. */
|
|
941
|
+
language: string;
|
|
942
|
+
/** Code to apply. */
|
|
943
|
+
code: string;
|
|
944
|
+
} | null;
|
|
945
|
+
} | null;
|
|
946
|
+
/** The latest result of one legal check for a site. */
|
|
947
|
+
export interface Finding {
|
|
948
|
+
/** Unique identifier of the finding (fnd_…). */
|
|
949
|
+
id: string;
|
|
950
|
+
/** String representing the object's type. Always "finding". */
|
|
951
|
+
object: "finding";
|
|
952
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
953
|
+
livemode: boolean;
|
|
954
|
+
/** The site. */
|
|
955
|
+
site: string;
|
|
956
|
+
/** Stable id of the legal check. */
|
|
957
|
+
check_id: string;
|
|
958
|
+
/** Short title. */
|
|
959
|
+
title: string;
|
|
960
|
+
/** What was observed. */
|
|
961
|
+
detail: string;
|
|
962
|
+
/** Lifecycle stage. */
|
|
963
|
+
stage: "signup" | "confirmation" | "reminder" | "cancellation" | "config";
|
|
964
|
+
/** Strictest severity among the applicable requirements. */
|
|
965
|
+
severity: "critical" | "high" | "medium" | "low";
|
|
966
|
+
/** Latest check result. */
|
|
967
|
+
status: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
968
|
+
/** Triage state. */
|
|
969
|
+
state: "open" | "acknowledged" | "resolved" | "accepted_risk";
|
|
970
|
+
/** Triage note. */
|
|
971
|
+
note: string | null;
|
|
972
|
+
/** Jurisdictions whose laws this check applies. */
|
|
973
|
+
jurisdictions: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
974
|
+
/** The legal requirements behind the check, with citations. */
|
|
975
|
+
requirements: Array<RequirementRef>;
|
|
976
|
+
remediation: Remediation;
|
|
977
|
+
/** Confidence 0-1 of the check result. */
|
|
978
|
+
confidence: number;
|
|
979
|
+
/** Ids of the captures / emails / evidence records supporting the result. */
|
|
980
|
+
evidence_refs: Array<string>;
|
|
981
|
+
/** Check-specific details (failing regions/devices/URLs, measurements, quotes). */
|
|
982
|
+
details: Record<string, unknown>;
|
|
983
|
+
/** Scan that produced the latest result. */
|
|
984
|
+
scan: string | null;
|
|
985
|
+
/** First time the check was evaluated. Unix timestamp in seconds. */
|
|
986
|
+
first_seen: number;
|
|
987
|
+
/** Latest evaluation. Unix timestamp in seconds. */
|
|
988
|
+
last_seen: number;
|
|
989
|
+
/** When it was resolved. Unix timestamp in seconds. */
|
|
990
|
+
resolved_at: number | null;
|
|
991
|
+
}
|
|
992
|
+
/** A page of findings, most urgent first. */
|
|
993
|
+
export interface FindingList {
|
|
994
|
+
/** String representing the object's type. Always "list". */
|
|
995
|
+
object: "list";
|
|
996
|
+
/** Findings, most urgent first. */
|
|
997
|
+
data: Array<Finding>;
|
|
998
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
999
|
+
has_more: boolean;
|
|
1000
|
+
/** The URL of this list. */
|
|
1001
|
+
url: string;
|
|
1002
|
+
}
|
|
1003
|
+
/** One legal requirement behind a task. */
|
|
1004
|
+
export interface PlanCitation {
|
|
1005
|
+
/** Requirement id in the legal catalog. */
|
|
1006
|
+
id: string;
|
|
1007
|
+
/** Jurisdiction. */
|
|
1008
|
+
jurisdiction: string;
|
|
1009
|
+
/** Legal citation. */
|
|
1010
|
+
citation: string;
|
|
1011
|
+
/** Official source. */
|
|
1012
|
+
source_url: string;
|
|
1013
|
+
}
|
|
1014
|
+
/** A machine-applicable edit of the merchant's source, anchored to an element Checkbox observed. */
|
|
1015
|
+
export interface PlanEdit {
|
|
1016
|
+
/** Edit operation for `checkbox fix --file` (or your own editor). */
|
|
1017
|
+
op: "insert_before" | "insert_after" | "remove_attribute" | "replace_text" | "append";
|
|
1018
|
+
/** The element the edit is anchored to. */
|
|
1019
|
+
target: {
|
|
1020
|
+
/** CSS selector observed on the rendered page (ids are the most stable anchor). */
|
|
1021
|
+
selector: string | null;
|
|
1022
|
+
/** Visible text of the anchor element. */
|
|
1023
|
+
text: string | null;
|
|
1024
|
+
/** HTML tag of the anchor element. */
|
|
1025
|
+
tag: string | null;
|
|
1026
|
+
};
|
|
1027
|
+
/** Markup / text to insert or the replacement text. */
|
|
1028
|
+
content: string | null;
|
|
1029
|
+
/** For remove_attribute: the attribute to remove. */
|
|
1030
|
+
attribute: string | null;
|
|
1031
|
+
}
|
|
1032
|
+
/** What the caller (usually an AI coding agent) should do next. */
|
|
1033
|
+
export interface PlanNextAction {
|
|
1034
|
+
/** Stable action type: apply_task, provide_facts, verify_task, answer_question, ask_human_to_confirm, connect_billing_in_dashboard, wait_for_verification, run_first_check, review_wont_fix, done. */
|
|
1035
|
+
type: string;
|
|
1036
|
+
/** One or two sentences telling the agent exactly what to do now. */
|
|
1037
|
+
description: string;
|
|
1038
|
+
/** The task the action is about, when there is one. */
|
|
1039
|
+
task: string | null;
|
|
1040
|
+
/** operationId of the API call to make (also the SDK method name). */
|
|
1041
|
+
operation_id: string | null;
|
|
1042
|
+
/** The MCP tool that performs operation_id (`call_api` when there is no dedicated tool). */
|
|
1043
|
+
mcp_tool?: string | null;
|
|
1044
|
+
/** HTTP method and path of that call. */
|
|
1045
|
+
endpoint: string | null;
|
|
1046
|
+
/** Equivalent CLI command. */
|
|
1047
|
+
command: string | null;
|
|
1048
|
+
}
|
|
1049
|
+
/** One ordered compliance task: the requirement, where to change, the exact change and how to verify it. */
|
|
1050
|
+
export interface Task {
|
|
1051
|
+
/** Unique identifier of the task (task_…). */
|
|
1052
|
+
id: string;
|
|
1053
|
+
/** String representing the object's type. Always "task". */
|
|
1054
|
+
object: "task";
|
|
1055
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1056
|
+
livemode: boolean;
|
|
1057
|
+
/** The site. */
|
|
1058
|
+
site: string;
|
|
1059
|
+
/** Stable key of the task within the site (the id is derived from site + key). */
|
|
1060
|
+
key: string;
|
|
1061
|
+
/** Short imperative title. */
|
|
1062
|
+
title: string;
|
|
1063
|
+
/** open (apply the change), in_progress (an agent claimed it), verifying (a verification is waiting for a confirming observation), done, wont_fix (the merchant declined, with a reason), manual (needs a human answer: see question). */
|
|
1064
|
+
status: "open" | "in_progress" | "verifying" | "done" | "wont_fix" | "manual";
|
|
1065
|
+
/** Strictest severity among the task's legal checks. */
|
|
1066
|
+
priority: "critical" | "high" | "medium" | "low";
|
|
1067
|
+
/** Position in the plan (1 = do first). Dependency-aware. */
|
|
1068
|
+
order: number;
|
|
1069
|
+
/** Legal checks this task makes pass. */
|
|
1070
|
+
check_ids: Array<string>;
|
|
1071
|
+
/** Open findings the task resolves. */
|
|
1072
|
+
findings: Array<string>;
|
|
1073
|
+
/** The legal requirement. */
|
|
1074
|
+
requirement: {
|
|
1075
|
+
/** Jurisdictions whose laws require it. */
|
|
1076
|
+
jurisdictions: Array<string>;
|
|
1077
|
+
/** Main citations, joined. */
|
|
1078
|
+
citation: string;
|
|
1079
|
+
/** Every requirement behind the task. */
|
|
1080
|
+
citations: Array<PlanCitation>;
|
|
1081
|
+
/** What the law requires, in one or two sentences. */
|
|
1082
|
+
plain_language: string;
|
|
1083
|
+
};
|
|
1084
|
+
/** What Checkbox observed (why this task exists). */
|
|
1085
|
+
why: string;
|
|
1086
|
+
/** Where to make the change. */
|
|
1087
|
+
where: {
|
|
1088
|
+
/** Where the change is made. */
|
|
1089
|
+
kind: "code" | "stripe_setting" | "email_template" | "policy_page" | "dns" | "checkbox_setting" | "billing_platform";
|
|
1090
|
+
/** Likely source file (reported by `checkbox init` / updateSetupSession, else a framework convention). */
|
|
1091
|
+
file_hint: string | null;
|
|
1092
|
+
/** Page (or settings page) where the problem was observed / the change is made. */
|
|
1093
|
+
url: string | null;
|
|
1094
|
+
/** CSS selector of the element to change, as observed on the rendered page. */
|
|
1095
|
+
selector: string | null;
|
|
1096
|
+
/** Stripe object / setting to change (stripe_setting tasks). */
|
|
1097
|
+
stripe_object: string | null;
|
|
1098
|
+
};
|
|
1099
|
+
/** The exact change. */
|
|
1100
|
+
change: {
|
|
1101
|
+
/** patch (code edit; content is a unified-diff template), copy (exact text), stripe_params (JSON to merge into a Stripe API call), config (a setting: content is the request body of operation_id), needs_facts (Checkbox needs facts before it can write exact copy: content is the body of operation_id to send them; never a patch with placeholders), manual (a human does it). */
|
|
1102
|
+
type: "patch" | "copy" | "stripe_params" | "config" | "needs_facts" | "manual";
|
|
1103
|
+
/** The change itself: unified-diff template, exact copy, or JSON params. Generated from the merchant's real terms and verified against the rules engine where possible. */
|
|
1104
|
+
content: string;
|
|
1105
|
+
/** Language of content (html, json, text, markdown, liquid, bash). */
|
|
1106
|
+
language: string | null;
|
|
1107
|
+
/** How to apply it and what must stay true. */
|
|
1108
|
+
explanation: string;
|
|
1109
|
+
/** Machine-applicable edits (`checkbox fix <task> --file <path>` turns them into an exact diff of your file). */
|
|
1110
|
+
edits: Array<PlanEdit>;
|
|
1111
|
+
/** The generated text was run through the rules engine on a model of the changed page and passes. */
|
|
1112
|
+
engine_verified: boolean;
|
|
1113
|
+
/** config / needs_facts: the API operation to send content to (its request body, validated against that operation). */
|
|
1114
|
+
operation_id: string | null;
|
|
1115
|
+
/** HTTP method and path of operation_id. */
|
|
1116
|
+
endpoint: string | null;
|
|
1117
|
+
};
|
|
1118
|
+
/** How to verify the task. */
|
|
1119
|
+
verify: {
|
|
1120
|
+
/** How Checkbox re-checks it. */
|
|
1121
|
+
method: "page_fetch" | "policy_refetch" | "stripe_params" | "email_copy" | "platform_sync" | "attestation" | "evaluation" | "test_run";
|
|
1122
|
+
/** What to call after applying the change. */
|
|
1123
|
+
how: string;
|
|
1124
|
+
/** What Checkbox must observe for the task to be done. */
|
|
1125
|
+
expected: string;
|
|
1126
|
+
};
|
|
1127
|
+
/** What Checkbox needs before it can give the exact change (observation: it has not seen the page / email yet; facts: plan, price, cancel URL or merchant name). The title stays the same either way. */
|
|
1128
|
+
blocked_on: string | null;
|
|
1129
|
+
/** Done / declined tasks: verified (its checks pass), no_longer_applicable (its checks no longer apply, e.g. the data source changed), superseded, declined. */
|
|
1130
|
+
closed_reason: "verified" | "no_longer_applicable" | "superseded" | "declined" | null;
|
|
1131
|
+
/** Tasks to finish first (their result changes this task's content). */
|
|
1132
|
+
depends_on: Array<string>;
|
|
1133
|
+
/** Unfinished tasks among depends_on. */
|
|
1134
|
+
blocked_by: Array<string>;
|
|
1135
|
+
/** For manual tasks: the human question; answer with answerTask. */
|
|
1136
|
+
question: {
|
|
1137
|
+
/** The question for the human (manual tasks only). */
|
|
1138
|
+
text: string;
|
|
1139
|
+
/** Accepted answers. */
|
|
1140
|
+
options: Array<string>;
|
|
1141
|
+
/** Why a machine cannot answer it. */
|
|
1142
|
+
why: string;
|
|
1143
|
+
/** What the answer changes. */
|
|
1144
|
+
effect: string;
|
|
1145
|
+
} | null;
|
|
1146
|
+
/** The recorded answer of a manual task. */
|
|
1147
|
+
answer: {
|
|
1148
|
+
/** The recorded answer. */
|
|
1149
|
+
value: string;
|
|
1150
|
+
/** Note given with the answer. */
|
|
1151
|
+
note: string | null;
|
|
1152
|
+
/** When it was answered. Unix timestamp in seconds. */
|
|
1153
|
+
answered: number;
|
|
1154
|
+
/** A person confirmed the answer while signed in to Checkbox (dashboard or the emailed link). Attestations ("yes", "confirmed") count only then; an API key alone cannot attest. */
|
|
1155
|
+
confirmed_by_human: boolean;
|
|
1156
|
+
/** Answer recorded by an agent and waiting for the human: the link they open to confirm it. */
|
|
1157
|
+
pending_confirmation_url: string | null;
|
|
1158
|
+
} | null;
|
|
1159
|
+
/** A decision recorded with updateTask. */
|
|
1160
|
+
decision: {
|
|
1161
|
+
/** Decision. */
|
|
1162
|
+
status: "in_progress" | "wont_fix";
|
|
1163
|
+
/** Reason given. */
|
|
1164
|
+
reason: string | null;
|
|
1165
|
+
} | null;
|
|
1166
|
+
/** The newest verification of the task (retrieveVerification for the details). */
|
|
1167
|
+
last_verification: {
|
|
1168
|
+
/** Unique identifier of the verification (ver_…). */
|
|
1169
|
+
id: string;
|
|
1170
|
+
/** Result. */
|
|
1171
|
+
status: "pending" | "passed" | "failed";
|
|
1172
|
+
/** When it was requested. Unix timestamp in seconds. */
|
|
1173
|
+
created: number;
|
|
1174
|
+
} | null;
|
|
1175
|
+
next_action: PlanNextAction;
|
|
1176
|
+
/** When the task first appeared. Unix timestamp in seconds. */
|
|
1177
|
+
first_seen: number;
|
|
1178
|
+
/** When it was done. Unix timestamp in seconds. */
|
|
1179
|
+
done_at: number | null;
|
|
1180
|
+
}
|
|
1181
|
+
/** The ordered, machine-readable list of changes that makes a site compliant, recomputed from its latest evaluation. */
|
|
1182
|
+
export interface CompliancePlan {
|
|
1183
|
+
/** Unique identifier of the compliance plan (plan_…). */
|
|
1184
|
+
id: string;
|
|
1185
|
+
/** String representing the object's type. Always "compliance_plan". */
|
|
1186
|
+
object: "compliance_plan";
|
|
1187
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1188
|
+
livemode: boolean;
|
|
1189
|
+
/** The site. */
|
|
1190
|
+
site: string;
|
|
1191
|
+
/** action_required (an agent can apply open tasks now), verifying (changes applied; waiting for confirming observations), compliant (every applicable check Checkbox could observe passes — an automated assessment, not a legal determination; see coverage for what was not observed), blocked (only human answers or declined critical tasks remain). */
|
|
1192
|
+
status: "action_required" | "verifying" | "compliant" | "blocked";
|
|
1193
|
+
/** Compliance score 0-100 of the latest evaluation. */
|
|
1194
|
+
score: number | null;
|
|
1195
|
+
/** Preview flag the planned Checkbox Warranty will key on (no checks failing at high severity). No warranty or insurance is offered yet; this is not an underwriting decision. */
|
|
1196
|
+
insurable: boolean | null;
|
|
1197
|
+
/** The evaluation the plan was built from (null before the first check). */
|
|
1198
|
+
evaluation: string | null;
|
|
1199
|
+
/** When that evaluation ran. Unix timestamp in seconds. */
|
|
1200
|
+
evaluated: number | null;
|
|
1201
|
+
/** Two or three sentences for an LLM: where the site stands and what comes next. */
|
|
1202
|
+
summary: string;
|
|
1203
|
+
/** Tasks per status. */
|
|
1204
|
+
counts: {
|
|
1205
|
+
/** Open tasks. */
|
|
1206
|
+
open: number;
|
|
1207
|
+
/** Claimed tasks. */
|
|
1208
|
+
in_progress: number;
|
|
1209
|
+
/** Tasks waiting for a confirming observation. */
|
|
1210
|
+
verifying: number;
|
|
1211
|
+
/** Tasks waiting for a human answer. */
|
|
1212
|
+
manual: number;
|
|
1213
|
+
/** Done tasks. */
|
|
1214
|
+
done: number;
|
|
1215
|
+
/** Declined tasks. */
|
|
1216
|
+
wont_fix: number;
|
|
1217
|
+
};
|
|
1218
|
+
/** Tasks in the order to do them (done tasks last). */
|
|
1219
|
+
tasks: Array<Task>;
|
|
1220
|
+
/** What the assessment rests on. Tell the human about not_observed and attested items; never call the site "compliant" without them. */
|
|
1221
|
+
coverage: {
|
|
1222
|
+
/** Lifecycle stages Checkbox observed (signup, acknowledgment_email, reminders, cancellation, policies, billing_settings). */
|
|
1223
|
+
observed: Array<string>;
|
|
1224
|
+
/** Stages Checkbox has no observation of: their checks cannot fail, so passing says nothing about them. */
|
|
1225
|
+
not_observed: Array<string>;
|
|
1226
|
+
/** Task keys resting on a human confirmation instead of an observation. */
|
|
1227
|
+
attested: Array<string>;
|
|
1228
|
+
/** A billing platform is connected (dashboard). */
|
|
1229
|
+
billing_connected: boolean;
|
|
1230
|
+
};
|
|
1231
|
+
next_action: PlanNextAction;
|
|
1232
|
+
/** Rules / catalog version of the evaluation. */
|
|
1233
|
+
rules_version: string | null;
|
|
1234
|
+
/** Automated assessment; not legal advice. */
|
|
1235
|
+
disclaimer: string;
|
|
1236
|
+
/** When the plan was computed. Unix timestamp in seconds. */
|
|
1237
|
+
generated: number;
|
|
1238
|
+
}
|
|
1239
|
+
export interface UpdateTaskParams {
|
|
1240
|
+
/** in_progress claims the task (other agents see it), wont_fix declines it (needs reason; a declined critical/high task keeps the plan from being compliant), not_applicable records that the task does not apply to this business (needs reason, e.g. "no price changes are planned"; the task closes as no_longer_applicable and does not block the plan), open clears any of them. */
|
|
1241
|
+
status: "open" | "in_progress" | "wont_fix" | "not_applicable";
|
|
1242
|
+
/** Why (required for wont_fix). */
|
|
1243
|
+
reason?: string;
|
|
1244
|
+
}
|
|
1245
|
+
export interface AnswerTaskParams {
|
|
1246
|
+
/** One of the task's question.options (yes / no, or confirmed / needs_change). */
|
|
1247
|
+
answer: string;
|
|
1248
|
+
/** Context from the human (stored with the attestation). */
|
|
1249
|
+
note?: string;
|
|
1250
|
+
}
|
|
1251
|
+
/** Expected vs observed for one check. */
|
|
1252
|
+
export interface VerificationCheck {
|
|
1253
|
+
/** Check id. */
|
|
1254
|
+
check_id: string;
|
|
1255
|
+
/** Status the task needs. */
|
|
1256
|
+
expected: string;
|
|
1257
|
+
/** Status observed (pass, fail, needs_review, not_applicable, unknown). */
|
|
1258
|
+
observed: string;
|
|
1259
|
+
/** Where the observation comes from: evaluation, static_fetch, html, stripe_params, email, policy_fetch. */
|
|
1260
|
+
source: string;
|
|
1261
|
+
/** What was observed. */
|
|
1262
|
+
detail: string;
|
|
1263
|
+
}
|
|
1264
|
+
/** A re-check of one task (or the whole site) after the agent applied changes. */
|
|
1265
|
+
export interface Verification {
|
|
1266
|
+
/** Unique identifier of the verification (ver_…). */
|
|
1267
|
+
id: string;
|
|
1268
|
+
/** String representing the object's type. Always "verification". */
|
|
1269
|
+
object: "verification";
|
|
1270
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1271
|
+
livemode: boolean;
|
|
1272
|
+
/** The site. */
|
|
1273
|
+
site: string;
|
|
1274
|
+
/** The task verified (null for a whole-site verification). */
|
|
1275
|
+
task: string | null;
|
|
1276
|
+
/** One task or the whole site. */
|
|
1277
|
+
scope: "task" | "site";
|
|
1278
|
+
/** pending (waiting for the confirming scan / re-evaluation), passed (Checkbox observed the expected result), failed (it did not: see diff). */
|
|
1279
|
+
status: "pending" | "passed" | "failed";
|
|
1280
|
+
/** How it was re-checked. */
|
|
1281
|
+
method: "page_fetch" | "policy_refetch" | "stripe_params" | "email_copy" | "platform_sync" | "attestation" | "evaluation" | "test_run";
|
|
1282
|
+
/** The fast pre-check run immediately (seconds). A failing pre-check fails the verification at once. */
|
|
1283
|
+
precheck: {
|
|
1284
|
+
/** static_fetch, html, stripe_params, email or policy_fetch. */
|
|
1285
|
+
source: string;
|
|
1286
|
+
/** Pre-check verdict for the task's checks. */
|
|
1287
|
+
verdict: "pass" | "fail" | "needs_review";
|
|
1288
|
+
/** What was fetched. */
|
|
1289
|
+
url: string | null;
|
|
1290
|
+
/** What the pre-check can and cannot confirm. */
|
|
1291
|
+
note: string;
|
|
1292
|
+
} | null;
|
|
1293
|
+
/** Confirming scan queued by the verification. */
|
|
1294
|
+
scan: string | null;
|
|
1295
|
+
/** Expected vs observed per check. */
|
|
1296
|
+
checks: Array<VerificationCheck>;
|
|
1297
|
+
/** Only the checks whose observation differs from the expectation. */
|
|
1298
|
+
diff: Array<VerificationCheck>;
|
|
1299
|
+
/** Plan status after this verification (null while pending). */
|
|
1300
|
+
plan_status: "action_required" | "verifying" | "compliant" | "blocked" | null;
|
|
1301
|
+
next_action: PlanNextAction;
|
|
1302
|
+
/** When it was requested. Unix timestamp in seconds. */
|
|
1303
|
+
created: number;
|
|
1304
|
+
/** When it resolved. Unix timestamp in seconds. */
|
|
1305
|
+
completed: number | null;
|
|
1306
|
+
/** A pending verification fails (timed_out) after this. Unix timestamp in seconds. */
|
|
1307
|
+
expires: number;
|
|
1308
|
+
}
|
|
1309
|
+
export interface VerifyTaskParams {
|
|
1310
|
+
/** page_fetch tasks: the rendered page HTML before you deploy, at most ~900 KB (request bodies are limited to 1 MB). Pre-check only; the confirming scan runs on the live page. */
|
|
1311
|
+
html?: string;
|
|
1312
|
+
/** stripe_params tasks: exactly what your code now passes to stripe.checkout.sessions.create. */
|
|
1313
|
+
stripe_checkout_session?: Record<string, unknown>;
|
|
1314
|
+
/** email_copy tasks: the new email template (pre-check; the real email confirms). */
|
|
1315
|
+
email?: {
|
|
1316
|
+
/** Email kind (default: from the task). */
|
|
1317
|
+
kind?: "acknowledgment" | "trial_reminder" | "renewal_reminder" | "price_change" | "annual_terms" | "charge_notice" | "cancellation_confirmation";
|
|
1318
|
+
/** Subject. */
|
|
1319
|
+
subject: string;
|
|
1320
|
+
/** Plain-text body. */
|
|
1321
|
+
text?: string;
|
|
1322
|
+
/** HTML body. */
|
|
1323
|
+
html?: string;
|
|
1324
|
+
};
|
|
1325
|
+
/** Re-check a task that is already done (or declined) instead of returning its last result: Checkbox evaluates the site again now and queues a confirming scan, so a regression shows up (pilot: a cancel page switched to phone-only stayed "passed"). */
|
|
1326
|
+
recheck?: boolean;
|
|
1327
|
+
}
|
|
1328
|
+
/** A page of verifications, newest first. */
|
|
1329
|
+
export interface VerificationList {
|
|
1330
|
+
/** String representing the object's type. Always "list". */
|
|
1331
|
+
object: "list";
|
|
1332
|
+
/** Verifications, newest first. */
|
|
1333
|
+
data: Array<Verification>;
|
|
1334
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
1335
|
+
has_more: boolean;
|
|
1336
|
+
/** The URL of this list. */
|
|
1337
|
+
url: string;
|
|
1338
|
+
}
|
|
1339
|
+
/** A concrete change to apply. */
|
|
1340
|
+
export interface FixArtifact {
|
|
1341
|
+
/** Artifact id. */
|
|
1342
|
+
id: string;
|
|
1343
|
+
/** Title. */
|
|
1344
|
+
title: string;
|
|
1345
|
+
/** Kind of change. */
|
|
1346
|
+
kind: "code" | "markup" | "liquid" | "script";
|
|
1347
|
+
/** Language. */
|
|
1348
|
+
language: string;
|
|
1349
|
+
/** Suggested file. */
|
|
1350
|
+
filename: string | null;
|
|
1351
|
+
/** The code / markup to apply. */
|
|
1352
|
+
code: string;
|
|
1353
|
+
/** Unified-diff view of the change. */
|
|
1354
|
+
diff: string | null;
|
|
1355
|
+
}
|
|
1356
|
+
/** An engine-verified, platform-specific fix. */
|
|
1357
|
+
export interface Fix {
|
|
1358
|
+
/** Unique identifier of the fix (fix_…). */
|
|
1359
|
+
id: string;
|
|
1360
|
+
/** String representing the object's type. Always "fix". */
|
|
1361
|
+
object: "fix";
|
|
1362
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1363
|
+
livemode: boolean;
|
|
1364
|
+
/** The site. */
|
|
1365
|
+
site: string;
|
|
1366
|
+
/** Finding this fix addresses (null for site-level fix plans). */
|
|
1367
|
+
finding: string | null;
|
|
1368
|
+
/** Area of the fix. */
|
|
1369
|
+
group: "signup" | "cancellation" | "other";
|
|
1370
|
+
/** stripe_checkout, stripe_payment_link, shopify, html or hosted_cancellation. */
|
|
1371
|
+
kind: string | null;
|
|
1372
|
+
/** Title. */
|
|
1373
|
+
title: string;
|
|
1374
|
+
/** What the fix does. */
|
|
1375
|
+
summary: string;
|
|
1376
|
+
/** Checks it addresses. */
|
|
1377
|
+
check_ids: Array<string>;
|
|
1378
|
+
/** Steps. */
|
|
1379
|
+
steps: Array<string>;
|
|
1380
|
+
/** Code / markup to apply. */
|
|
1381
|
+
artifacts: Array<FixArtifact>;
|
|
1382
|
+
/** Verified disclosure texts (snake_case keys). */
|
|
1383
|
+
texts: Record<string, unknown> | null;
|
|
1384
|
+
/** One-click option available in the dashboard, when there is one. */
|
|
1385
|
+
one_click: Record<string, unknown> | null;
|
|
1386
|
+
/** How the engine verified the fixed texts pass the checks. */
|
|
1387
|
+
verification: Record<string, unknown> | null;
|
|
1388
|
+
/** Why parts of the fix could not be generated (e.g. plan terms unknown). */
|
|
1389
|
+
problems: Array<string>;
|
|
1390
|
+
remediation: Remediation;
|
|
1391
|
+
}
|
|
1392
|
+
/** A page of fix plans. */
|
|
1393
|
+
export interface FixList {
|
|
1394
|
+
/** String representing the object's type. Always "list". */
|
|
1395
|
+
object: "list";
|
|
1396
|
+
/** Fix plans. */
|
|
1397
|
+
data: Array<Fix>;
|
|
1398
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
1399
|
+
has_more: boolean;
|
|
1400
|
+
/** The URL of this list. */
|
|
1401
|
+
url: string;
|
|
1402
|
+
}
|
|
1403
|
+
/** A record in the tamper-evident evidence vault. */
|
|
1404
|
+
export interface Evidence {
|
|
1405
|
+
/** Unique identifier of the evidence (ev_…). */
|
|
1406
|
+
id: string;
|
|
1407
|
+
/** String representing the object's type. Always "evidence". */
|
|
1408
|
+
object: "evidence";
|
|
1409
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1410
|
+
livemode: boolean;
|
|
1411
|
+
/** Site the evidence belongs to. */
|
|
1412
|
+
site: string;
|
|
1413
|
+
/** What was recorded. */
|
|
1414
|
+
kind: "screenshot" | "html" | "page_capture" | "email_raw" | "platform_config" | "lifecycle_event" | "evaluation";
|
|
1415
|
+
/** MIME type of the content. */
|
|
1416
|
+
content_type: string;
|
|
1417
|
+
/** Bytes. */
|
|
1418
|
+
size: number;
|
|
1419
|
+
/** SHA-256 of the content (hex). */
|
|
1420
|
+
sha256: string;
|
|
1421
|
+
/** Hash chaining this record to the previous one (tamper evidence). */
|
|
1422
|
+
chain_hash: string;
|
|
1423
|
+
/** Chain hash of the previous record. */
|
|
1424
|
+
prev_chain_hash: string | null;
|
|
1425
|
+
/** When it was stored. Unix timestamp in seconds. */
|
|
1426
|
+
stored: number;
|
|
1427
|
+
/** Capture metadata (URL, region, device, scan…). */
|
|
1428
|
+
meta: Record<string, unknown>;
|
|
1429
|
+
/** Download the raw content (downloadEvidenceContent, same auth). */
|
|
1430
|
+
content_url: string;
|
|
1431
|
+
}
|
|
1432
|
+
/** A page of evidence records, newest first. */
|
|
1433
|
+
export interface EvidenceList {
|
|
1434
|
+
/** String representing the object's type. Always "list". */
|
|
1435
|
+
object: "list";
|
|
1436
|
+
/** Evidence records, newest first. */
|
|
1437
|
+
data: Array<Evidence>;
|
|
1438
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
1439
|
+
has_more: boolean;
|
|
1440
|
+
/** The URL of this list. */
|
|
1441
|
+
url: string;
|
|
1442
|
+
}
|
|
1443
|
+
/** Result of re-hashing a site's evidence chain. */
|
|
1444
|
+
export interface EvidenceChainVerification {
|
|
1445
|
+
/** String representing the object's type. Always "evidence_chain_verification". */
|
|
1446
|
+
object: "evidence_chain_verification";
|
|
1447
|
+
/** Verified site. */
|
|
1448
|
+
site: string;
|
|
1449
|
+
/** Every record re-hashed and the chain is intact. */
|
|
1450
|
+
ok: boolean;
|
|
1451
|
+
/** Records checked. */
|
|
1452
|
+
checked: number;
|
|
1453
|
+
/** Id of the first record that failed verification. */
|
|
1454
|
+
broken_at: string | null;
|
|
1455
|
+
/** Why verification failed. */
|
|
1456
|
+
reason: string | null;
|
|
1457
|
+
/** Current chain head hash. */
|
|
1458
|
+
head: string | null;
|
|
1459
|
+
}
|
|
1460
|
+
/** A signed monitoring certificate: the site met every critical and high obligation for the required streak of days. It is not insurance. */
|
|
1461
|
+
export interface Certificate {
|
|
1462
|
+
/** Unique identifier of the certificate (cert_…). */
|
|
1463
|
+
id: string;
|
|
1464
|
+
/** String representing the object's type. Always "certificate". */
|
|
1465
|
+
object: "certificate";
|
|
1466
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1467
|
+
livemode: boolean;
|
|
1468
|
+
/** Certified site. */
|
|
1469
|
+
site: string;
|
|
1470
|
+
/** active while monitoring keeps the site insurable; lapses automatically otherwise. */
|
|
1471
|
+
status: "active" | "lapsed" | "revoked" | "superseded";
|
|
1472
|
+
/** Verified domain frozen into the certificate. */
|
|
1473
|
+
domain: string;
|
|
1474
|
+
/** Issue time. Unix timestamp in seconds. */
|
|
1475
|
+
issued: number;
|
|
1476
|
+
/** Expiry (renewed automatically while compliant). Unix timestamp in seconds. */
|
|
1477
|
+
valid_until: number;
|
|
1478
|
+
/** Last renewal. Unix timestamp in seconds. */
|
|
1479
|
+
renewed: number | null;
|
|
1480
|
+
/** When it lapsed or was revoked. Unix timestamp in seconds. */
|
|
1481
|
+
ended: number | null;
|
|
1482
|
+
/** Public reason code shown on the verification page when it ended. */
|
|
1483
|
+
public_reason: string | null;
|
|
1484
|
+
/** Public verification page. */
|
|
1485
|
+
verify_url: string;
|
|
1486
|
+
/** Trust badge for the merchant site. */
|
|
1487
|
+
badge: {
|
|
1488
|
+
/** Badge image. */
|
|
1489
|
+
svg_url: string;
|
|
1490
|
+
/** Badge script. */
|
|
1491
|
+
script_url: string;
|
|
1492
|
+
/** HTML to embed the badge. */
|
|
1493
|
+
embed_html: string;
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
/** A page of certificates, newest first. */
|
|
1497
|
+
export interface CertificateList {
|
|
1498
|
+
/** String representing the object's type. Always "list". */
|
|
1499
|
+
object: "list";
|
|
1500
|
+
/** Certificates, newest first. */
|
|
1501
|
+
data: Array<Certificate>;
|
|
1502
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
1503
|
+
has_more: boolean;
|
|
1504
|
+
/** The URL of this list. */
|
|
1505
|
+
url: string;
|
|
1506
|
+
}
|
|
1507
|
+
/** Checkbox Notices for a site: the legally required emails Checkbox sends on the merchant's behalf. */
|
|
1508
|
+
export interface NoticeSettings {
|
|
1509
|
+
/** Unique identifier of the notice settings (ntcs_…). */
|
|
1510
|
+
id: string;
|
|
1511
|
+
/** String representing the object's type. Always "notice_settings". */
|
|
1512
|
+
object: "notice_settings";
|
|
1513
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1514
|
+
livemode: boolean;
|
|
1515
|
+
/** The site. */
|
|
1516
|
+
site: string;
|
|
1517
|
+
/** merchant ("You send", the default): you send the required emails and Checkbox tells you what and when (listDueNotices, notice.due), checks your templates and confirms each send. checkbox: Checkbox sends them for you (enabled_kinds). */
|
|
1518
|
+
mode: "merchant" | "checkbox";
|
|
1519
|
+
/** The site's inbound address. Copies to it confirm a notice only when your sending domain authenticates them (DKIM/SPF, a trusted sending domain) and they go to the subscriber; to confirm any copy, BCC each due notice's own bcc address instead (listDueNotices / the notice.due webhook). */
|
|
1520
|
+
bcc: string;
|
|
1521
|
+
/** mode checkbox: the notices Checkbox sends for the merchant. */
|
|
1522
|
+
enabled_kinds: Array<"acknowledgment" | "trial_ending" | "renewal_reminder" | "annual_terms" | "price_change">;
|
|
1523
|
+
/** Brand shown in notices (defaults to the site name). */
|
|
1524
|
+
brand_name: string | null;
|
|
1525
|
+
/** Product name used in notices. */
|
|
1526
|
+
product_name: string | null;
|
|
1527
|
+
/** Logo URL (https). */
|
|
1528
|
+
logo_url: string | null;
|
|
1529
|
+
/** Reply-to / support address. */
|
|
1530
|
+
support_email: string | null;
|
|
1531
|
+
/** Where subscribers cancel online (site domain, hosted cancellation page or billing portal). */
|
|
1532
|
+
cancel_url: string | null;
|
|
1533
|
+
/** Hex brand colour. */
|
|
1534
|
+
brand_color: string | null;
|
|
1535
|
+
/** Mailbox name of the sender. */
|
|
1536
|
+
from_local_part: string;
|
|
1537
|
+
/** Confirmed cancellation policy (required before notices go out). */
|
|
1538
|
+
policy: {
|
|
1539
|
+
/** When a cancellation takes effect. */
|
|
1540
|
+
cancel_timing: "period_end" | "immediately";
|
|
1541
|
+
/** When the policy was confirmed. Unix timestamp in seconds. */
|
|
1542
|
+
confirmed: number;
|
|
1543
|
+
} | null;
|
|
1544
|
+
/** Sending address, when one is available. */
|
|
1545
|
+
sender: {
|
|
1546
|
+
/** From header. */
|
|
1547
|
+
from: string;
|
|
1548
|
+
/** Sent from the merchant's verified domain. */
|
|
1549
|
+
own_domain: boolean;
|
|
1550
|
+
} | null;
|
|
1551
|
+
/** Custom sending domain status (set it up in the dashboard). */
|
|
1552
|
+
sending_domain: {
|
|
1553
|
+
/** Custom sending domain. */
|
|
1554
|
+
domain: string | null;
|
|
1555
|
+
/** none, pending, verified or failed. */
|
|
1556
|
+
status: string;
|
|
1557
|
+
};
|
|
1558
|
+
/** This Checkbox deployment can send email. */
|
|
1559
|
+
delivery_configured: boolean;
|
|
1560
|
+
/** Every notice kind. */
|
|
1561
|
+
kinds: Array<{
|
|
1562
|
+
/** Notice kind. */
|
|
1563
|
+
kind: "acknowledgment" | "trial_ending" | "renewal_reminder" | "annual_terms" | "price_change";
|
|
1564
|
+
/** Label. */
|
|
1565
|
+
label: string;
|
|
1566
|
+
/** What it is and when it is sent. */
|
|
1567
|
+
description: string;
|
|
1568
|
+
/** Checkbox sends it. */
|
|
1569
|
+
enabled: boolean;
|
|
1570
|
+
/** Legal checks it satisfies. */
|
|
1571
|
+
check_ids: Array<string>;
|
|
1572
|
+
}>;
|
|
1573
|
+
/** Last change. Unix timestamp in seconds. */
|
|
1574
|
+
updated: number | null;
|
|
1575
|
+
next_action: NextAction | null;
|
|
1576
|
+
}
|
|
1577
|
+
export interface UpdateNoticeSettingsParams {
|
|
1578
|
+
/** merchant: you send the emails (Checkbox tracks them); checkbox: Checkbox sends them. Turning an enabled_kinds notice on implies checkbox. */
|
|
1579
|
+
mode?: "merchant" | "checkbox";
|
|
1580
|
+
/** Notices to send (turning one on needs cancel_url, a confirmed policy and a connected Stripe/Recharge account). trial_reminder is accepted as an alias of trial_ending. */
|
|
1581
|
+
enabled_kinds?: Array<"acknowledgment" | "trial_ending" | "renewal_reminder" | "annual_terms" | "price_change" | "trial_reminder">;
|
|
1582
|
+
/** Brand name. */
|
|
1583
|
+
brand_name?: string | null;
|
|
1584
|
+
/** Product name. */
|
|
1585
|
+
product_name?: string | null;
|
|
1586
|
+
/** Logo URL (https). */
|
|
1587
|
+
logo_url?: string | null;
|
|
1588
|
+
/** Support address. */
|
|
1589
|
+
support_email?: string | null;
|
|
1590
|
+
/** Online cancellation URL. */
|
|
1591
|
+
cancel_url?: string | null;
|
|
1592
|
+
/** Hex colour. */
|
|
1593
|
+
brand_color?: string | null;
|
|
1594
|
+
/** Sender mailbox name. */
|
|
1595
|
+
from_local_part?: string;
|
|
1596
|
+
/** Cancellation policy the notices state. */
|
|
1597
|
+
policy?: {
|
|
1598
|
+
/** When a cancellation takes effect (must match your Terms). */
|
|
1599
|
+
cancel_timing: "period_end" | "immediately";
|
|
1600
|
+
/** Confirms this matches your Terms and your cancellation flow. */
|
|
1601
|
+
confirm: true;
|
|
1602
|
+
} | null;
|
|
1603
|
+
}
|
|
1604
|
+
/** Copy-ready email for this subscriber. It passes the preflight email check for its kind when every field is filled. */
|
|
1605
|
+
export interface RenderedNoticeEmail {
|
|
1606
|
+
/** Checkbox template the email was rendered from (GET /v1/notices/templates). */
|
|
1607
|
+
template_id: string;
|
|
1608
|
+
/** Subject, merge fields filled. */
|
|
1609
|
+
subject: string;
|
|
1610
|
+
/** Plain-text body, merge fields filled. */
|
|
1611
|
+
text: string;
|
|
1612
|
+
/** HTML body, merge fields filled (values HTML-escaped). */
|
|
1613
|
+
html: string;
|
|
1614
|
+
/** Merge fields Checkbox could not fill (e.g. cancel_url until you set it); fill them before sending. */
|
|
1615
|
+
missing_fields: Array<string>;
|
|
1616
|
+
}
|
|
1617
|
+
/** An email the merchant owes a subscriber, legally required (required: true) or recommended ("You send" mode): what, when, the copy-ready email and how to confirm it was sent. */
|
|
1618
|
+
export interface DueNotice {
|
|
1619
|
+
/** Unique identifier of the due notice (ntd_…). */
|
|
1620
|
+
id: string;
|
|
1621
|
+
/** String representing the object's type. Always "due_notice". */
|
|
1622
|
+
object: "due_notice";
|
|
1623
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1624
|
+
livemode: boolean;
|
|
1625
|
+
/** The site. */
|
|
1626
|
+
site: string;
|
|
1627
|
+
/** acknowledgment, trial_ending, renewal_reminder, annual_terms, price_change or cancellation_confirmation. */
|
|
1628
|
+
kind: "acknowledgment" | "trial_ending" | "renewal_reminder" | "annual_terms" | "price_change" | "cancellation_confirmation";
|
|
1629
|
+
/** Human label of the kind. */
|
|
1630
|
+
label: string;
|
|
1631
|
+
/** true: a law in requirement_ids makes this email mandatory, and an overdue one fails the matching compliance check. false: Checkbox recommends it (cancellation confirmations: no statute sets a deadline), it never fails a check. */
|
|
1632
|
+
required: boolean;
|
|
1633
|
+
/** upcoming (not time to send yet), due (send it on send_date), sent, overdue (window closed without proof it was sent), canceled (no longer owed) or missed (you recorded that it was not sent). */
|
|
1634
|
+
status: "upcoming" | "due" | "sent" | "overdue" | "canceled" | "missed";
|
|
1635
|
+
/** Who the notice is for. */
|
|
1636
|
+
subscriber: {
|
|
1637
|
+
/** Billing platform. */
|
|
1638
|
+
platform: string;
|
|
1639
|
+
/** The subscription id on the billing platform. */
|
|
1640
|
+
subscription: string;
|
|
1641
|
+
/** The customer id on the billing platform. */
|
|
1642
|
+
customer: string | null;
|
|
1643
|
+
/** The customer's name on the billing platform, when known. */
|
|
1644
|
+
name: string | null;
|
|
1645
|
+
/** Masked recipient (Checkbox never returns the address; look it up by customer). */
|
|
1646
|
+
email_masked: string | null;
|
|
1647
|
+
/** US state of the subscriber's billing address, when the billing platform shares it. The billing address is a proxy for where the subscriber lives: when one send can satisfy every state the site sells in, the window covers them all; otherwise it is this state's. null = every state the site sells in. */
|
|
1648
|
+
region: string | null;
|
|
1649
|
+
};
|
|
1650
|
+
/** Earliest moment the notice satisfies the law (send no earlier). Equal to window_end for an "exactly N days before" rule: send on that day. Unix timestamp in seconds. */
|
|
1651
|
+
window_start: number;
|
|
1652
|
+
/** Latest moment the notice satisfies the law (send no later). Unix timestamp in seconds. */
|
|
1653
|
+
window_end: number;
|
|
1654
|
+
/** Recommended send time, inside the window (away from its edges). notice.due is delivered at this time. Unix timestamp in seconds. */
|
|
1655
|
+
send_at: number;
|
|
1656
|
+
/** Recommended send date (YYYY-MM-DD, UTC). */
|
|
1657
|
+
send_date: string;
|
|
1658
|
+
/** The event the notice announces: sign-up, trial end, renewal, new price or cancellation. Unix timestamp in seconds. */
|
|
1659
|
+
anchor: number;
|
|
1660
|
+
/** Jurisdictions whose rules set this window. */
|
|
1661
|
+
jurisdictions: Array<string>;
|
|
1662
|
+
/** Catalog requirements that make the notice mandatory. */
|
|
1663
|
+
requirement_ids: Array<string>;
|
|
1664
|
+
/** Citations of those requirements. */
|
|
1665
|
+
citations: Array<string>;
|
|
1666
|
+
email: RenderedNoticeEmail;
|
|
1667
|
+
/** This notice's own BCC address (it carries a secret token: do not publish it). BCC it when you send the email: Checkbox marks this notice sent with the copy as evidence. A copy that arrives before window_start does not count. */
|
|
1668
|
+
bcc: string;
|
|
1669
|
+
/** Proof it was sent; null until then. */
|
|
1670
|
+
sent: {
|
|
1671
|
+
/** When it was sent. Unix timestamp in seconds. */
|
|
1672
|
+
at: number;
|
|
1673
|
+
/** How Checkbox learned it was sent: your API call, a matching BCC copy, or the dashboard. */
|
|
1674
|
+
source: "api" | "bcc" | "dashboard";
|
|
1675
|
+
/** Sent after the window closed (it does not satisfy the window). */
|
|
1676
|
+
late: boolean;
|
|
1677
|
+
/** Your email provider's message id, when given. */
|
|
1678
|
+
provider_message_id: string | null;
|
|
1679
|
+
/** Evidence record of the BCC copy (ev_…), when matched by BCC. */
|
|
1680
|
+
evidence: string | null;
|
|
1681
|
+
} | null;
|
|
1682
|
+
/** Set when you recorded an overdue notice as not sent (markNoticeMissed); null otherwise. */
|
|
1683
|
+
missed: {
|
|
1684
|
+
/** When you recorded it as missed. Unix timestamp in seconds. */
|
|
1685
|
+
at: number;
|
|
1686
|
+
/** Your note, when given. */
|
|
1687
|
+
reason: string | null;
|
|
1688
|
+
} | null;
|
|
1689
|
+
/** When Checkbox first computed the notice. Unix timestamp in seconds. */
|
|
1690
|
+
created: number;
|
|
1691
|
+
/** Last change. Unix timestamp in seconds. */
|
|
1692
|
+
updated: number;
|
|
1693
|
+
next_action: NextAction | null;
|
|
1694
|
+
}
|
|
1695
|
+
/** A page of due notices, soonest send date first. */
|
|
1696
|
+
export interface DueNoticeList {
|
|
1697
|
+
/** String representing the object's type. Always "list". */
|
|
1698
|
+
object: "list";
|
|
1699
|
+
/** Due notices, soonest send date first. */
|
|
1700
|
+
data: Array<DueNotice>;
|
|
1701
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
1702
|
+
has_more: boolean;
|
|
1703
|
+
/** The URL of this list. */
|
|
1704
|
+
url: string;
|
|
1705
|
+
}
|
|
1706
|
+
/** A copy-ready email template for a required notice. Filled with representative values it passes the preflight email check for its kind in every jurisdiction. */
|
|
1707
|
+
export interface NoticeTemplate {
|
|
1708
|
+
/** Template id (`<variant>.v1`); due notices name the one they were rendered from. */
|
|
1709
|
+
id: string;
|
|
1710
|
+
/** Notice kind. */
|
|
1711
|
+
kind: "acknowledgment" | "trial_ending" | "renewal_reminder" | "annual_terms" | "price_change" | "cancellation_confirmation";
|
|
1712
|
+
/** Variant within the kind (acknowledgment vs acknowledgment_trial, cancellation_confirmation vs _immediate). */
|
|
1713
|
+
variant: string;
|
|
1714
|
+
/** Human label. */
|
|
1715
|
+
label: string;
|
|
1716
|
+
/** When this kind is sent. */
|
|
1717
|
+
when: string;
|
|
1718
|
+
/** When this variant applies. */
|
|
1719
|
+
use_when: string;
|
|
1720
|
+
/** Subject with {{merge_fields}}. */
|
|
1721
|
+
subject: string;
|
|
1722
|
+
/** Plain-text body with {{merge_fields}}. */
|
|
1723
|
+
text: string;
|
|
1724
|
+
/** HTML body with {{merge_fields}} (escape values when you fill them). */
|
|
1725
|
+
html: string;
|
|
1726
|
+
/** Merge fields the template uses. */
|
|
1727
|
+
merge_fields: Array<string>;
|
|
1728
|
+
/** The kind to pass to checkEmail (/v1/checks/email) for this template. */
|
|
1729
|
+
check_kind: string;
|
|
1730
|
+
/** BCC address for this kind (when ?site= is given). */
|
|
1731
|
+
bcc?: string;
|
|
1732
|
+
}
|
|
1733
|
+
/** Copy-ready templates for every required notice. */
|
|
1734
|
+
export interface NoticeTemplateList {
|
|
1735
|
+
/** Always "list". */
|
|
1736
|
+
object: "list";
|
|
1737
|
+
/** Every template. */
|
|
1738
|
+
data: Array<NoticeTemplate>;
|
|
1739
|
+
/** Every merge field a template may use. */
|
|
1740
|
+
merge_fields: Array<{
|
|
1741
|
+
/** Field name. */
|
|
1742
|
+
name: string;
|
|
1743
|
+
/** What it holds. */
|
|
1744
|
+
description: string;
|
|
1745
|
+
}>;
|
|
1746
|
+
/** Always false. */
|
|
1747
|
+
has_more: boolean;
|
|
1748
|
+
/** URL of this list. */
|
|
1749
|
+
url: string;
|
|
1750
|
+
}
|
|
1751
|
+
/** Result of checking a merchant's own notice template. */
|
|
1752
|
+
export interface NoticeTemplateCheck {
|
|
1753
|
+
/** Always "notice_template_check". */
|
|
1754
|
+
object: "notice_template_check";
|
|
1755
|
+
/** Notice kind checked. */
|
|
1756
|
+
kind: "acknowledgment" | "trial_ending" | "renewal_reminder" | "annual_terms" | "price_change" | "cancellation_confirmation";
|
|
1757
|
+
/** pass, fail or needs_review. */
|
|
1758
|
+
verdict: string;
|
|
1759
|
+
/** Verdict per engine check. */
|
|
1760
|
+
checks: Array<{
|
|
1761
|
+
/** Engine check. */
|
|
1762
|
+
check_id: string;
|
|
1763
|
+
/** pass, fail, needs_review or not_applicable. */
|
|
1764
|
+
status: string;
|
|
1765
|
+
/** Why. */
|
|
1766
|
+
explanation: string;
|
|
1767
|
+
}>;
|
|
1768
|
+
/** Merge fields Checkbox does not know (left unfilled). */
|
|
1769
|
+
unknown_fields: Array<string>;
|
|
1770
|
+
/** Input warnings. */
|
|
1771
|
+
warnings: Array<{
|
|
1772
|
+
/** Code. */
|
|
1773
|
+
code: string;
|
|
1774
|
+
/** Message. */
|
|
1775
|
+
message: string;
|
|
1776
|
+
}>;
|
|
1777
|
+
/** The email as checked (merge fields filled with the site's plan and sample dates). */
|
|
1778
|
+
filled: {
|
|
1779
|
+
/** Subject as checked. */
|
|
1780
|
+
subject: string;
|
|
1781
|
+
/** Text as checked. */
|
|
1782
|
+
text: string;
|
|
1783
|
+
/** HTML as checked. */
|
|
1784
|
+
html?: string;
|
|
1785
|
+
};
|
|
1786
|
+
next_action: NextAction;
|
|
1787
|
+
}
|
|
1788
|
+
/** Your template for one notice kind (text, html or both). */
|
|
1789
|
+
export interface CheckNoticeTemplateParams {
|
|
1790
|
+
/** Site whose plan, brand, cancel URL and jurisdictions fill the merge fields and scope the check. */
|
|
1791
|
+
site: string;
|
|
1792
|
+
/** Which notice the template is for. */
|
|
1793
|
+
kind: "acknowledgment" | "trial_ending" | "renewal_reminder" | "annual_terms" | "price_change" | "cancellation_confirmation";
|
|
1794
|
+
/** Your subject (merge fields allowed). */
|
|
1795
|
+
subject: string;
|
|
1796
|
+
/** Your plain-text body (merge fields allowed). */
|
|
1797
|
+
text?: string;
|
|
1798
|
+
/** Your HTML body (merge fields allowed). */
|
|
1799
|
+
html?: string;
|
|
1800
|
+
}
|
|
1801
|
+
export interface MarkNoticeSentParams {
|
|
1802
|
+
/** Your email provider's message id (Resend / Postmark / SES), stored as proof. */
|
|
1803
|
+
provider_message_id?: string;
|
|
1804
|
+
/** When it was sent (unix seconds). Default: now. A time after the window closed records the notice as sent late; a time before window_start is refused (too early to count), and so is a time before an overdue notice became overdue. */
|
|
1805
|
+
sent_at?: number;
|
|
1806
|
+
}
|
|
1807
|
+
export interface MarkNoticeMissedParams {
|
|
1808
|
+
/** Why it was not sent (kept with the record). */
|
|
1809
|
+
reason?: string;
|
|
1810
|
+
}
|
|
1811
|
+
/** One changed requirement. */
|
|
1812
|
+
export interface LawChange {
|
|
1813
|
+
/** Requirement id in the legal catalog. */
|
|
1814
|
+
requirement_id: string;
|
|
1815
|
+
/** added, removed, modified, effective or sunset. */
|
|
1816
|
+
change: string;
|
|
1817
|
+
/** Jurisdiction. */
|
|
1818
|
+
jurisdiction: "US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY";
|
|
1819
|
+
/** Legal citation. */
|
|
1820
|
+
citation: string;
|
|
1821
|
+
/** Requirement title. */
|
|
1822
|
+
title: string;
|
|
1823
|
+
/** Plain-English summary. */
|
|
1824
|
+
summary: string | null;
|
|
1825
|
+
/** Effective date (YYYY-MM-DD). */
|
|
1826
|
+
effective_date: string | null;
|
|
1827
|
+
/** Sunset date (YYYY-MM-DD). */
|
|
1828
|
+
sunset_date: string | null;
|
|
1829
|
+
/** Official source. */
|
|
1830
|
+
source_url: string | null;
|
|
1831
|
+
}
|
|
1832
|
+
/** How a law change affected one site. */
|
|
1833
|
+
export interface LawSiteImpact {
|
|
1834
|
+
/** Affected site. */
|
|
1835
|
+
site: string;
|
|
1836
|
+
/** What changed for the site. */
|
|
1837
|
+
summary: string;
|
|
1838
|
+
/** Score before the change (0-100, one decimal place). */
|
|
1839
|
+
score_before: number | null;
|
|
1840
|
+
/** Score after re-evaluation (0-100, one decimal place). */
|
|
1841
|
+
score_after: number | null;
|
|
1842
|
+
/** Checks whose result changed or that the change touches. */
|
|
1843
|
+
affected_checks: Array<{
|
|
1844
|
+
/** Check id. */
|
|
1845
|
+
check_id: string;
|
|
1846
|
+
/** Title. */
|
|
1847
|
+
title: string;
|
|
1848
|
+
/** Severity. */
|
|
1849
|
+
severity: "critical" | "high" | "medium" | "low";
|
|
1850
|
+
/** Status before. */
|
|
1851
|
+
before: "pass" | "fail" | "needs_review" | "not_applicable" | null;
|
|
1852
|
+
/** Status after. */
|
|
1853
|
+
after: "pass" | "fail" | "needs_review" | "not_applicable" | null;
|
|
1854
|
+
}>;
|
|
1855
|
+
/** When the site was re-evaluated. Unix timestamp in seconds. */
|
|
1856
|
+
evaluated: number;
|
|
1857
|
+
}
|
|
1858
|
+
/** A change in the law Checkbox applies, and its effect on your sites. */
|
|
1859
|
+
export interface LawUpdate {
|
|
1860
|
+
/** Unique identifier of the law update (law_…). */
|
|
1861
|
+
id: string;
|
|
1862
|
+
/** String representing the object's type. Always "law_update". */
|
|
1863
|
+
object: "law_update";
|
|
1864
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1865
|
+
livemode: boolean;
|
|
1866
|
+
/** catalog_change: Checkbox updated the legal catalog; effective / sunset: a dated rule started or ended. */
|
|
1867
|
+
source: "catalog_change" | "effective" | "sunset";
|
|
1868
|
+
/** Date of the change (YYYY-MM-DD). */
|
|
1869
|
+
date: string;
|
|
1870
|
+
/** What changed. */
|
|
1871
|
+
summary: string;
|
|
1872
|
+
/** Jurisdictions changed. */
|
|
1873
|
+
jurisdictions: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
1874
|
+
/** Changed requirements. */
|
|
1875
|
+
changes: Array<LawChange>;
|
|
1876
|
+
/** Effects on this account's sites (in this mode). */
|
|
1877
|
+
impacts: Array<LawSiteImpact>;
|
|
1878
|
+
/** When Checkbox recorded the change. Unix timestamp in seconds. */
|
|
1879
|
+
created: number;
|
|
1880
|
+
}
|
|
1881
|
+
/** A page of law updates, newest first. */
|
|
1882
|
+
export interface LawUpdateList {
|
|
1883
|
+
/** String representing the object's type. Always "list". */
|
|
1884
|
+
object: "list";
|
|
1885
|
+
/** Law updates, newest first. */
|
|
1886
|
+
data: Array<LawUpdate>;
|
|
1887
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
1888
|
+
has_more: boolean;
|
|
1889
|
+
/** The URL of this list. */
|
|
1890
|
+
url: string;
|
|
1891
|
+
}
|
|
1892
|
+
/** A legal requirement a check enforces. */
|
|
1893
|
+
export interface CheckRequirementRef {
|
|
1894
|
+
/** Requirement id in the legal catalog. */
|
|
1895
|
+
id: string;
|
|
1896
|
+
/** Jurisdiction. */
|
|
1897
|
+
jurisdiction: "US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY";
|
|
1898
|
+
/** Legal citation. */
|
|
1899
|
+
citation: string;
|
|
1900
|
+
/** Requirement title. */
|
|
1901
|
+
title: string;
|
|
1902
|
+
/** Official source. */
|
|
1903
|
+
source_url: string;
|
|
1904
|
+
}
|
|
1905
|
+
/** One engine check and its verdict. */
|
|
1906
|
+
export interface CheckVerdict {
|
|
1907
|
+
/** Stable id of the check. */
|
|
1908
|
+
check_id: string;
|
|
1909
|
+
/** pass, fail, needs_review (a human or more data must decide) or not_applicable. */
|
|
1910
|
+
status: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
1911
|
+
/** Severity. */
|
|
1912
|
+
severity: "critical" | "high" | "medium" | "low";
|
|
1913
|
+
/** What the check requires. */
|
|
1914
|
+
title: string;
|
|
1915
|
+
/** What the engine observed. */
|
|
1916
|
+
explanation: string;
|
|
1917
|
+
/** Confidence 0..1. */
|
|
1918
|
+
confidence: number;
|
|
1919
|
+
/** Requirements this check enforces under the requested jurisdictions. */
|
|
1920
|
+
requirements: Array<CheckRequirementRef>;
|
|
1921
|
+
/** How to fix a failing / unclear check. */
|
|
1922
|
+
fix?: string;
|
|
1923
|
+
/** Page checks on static HTML: the engine status on the estimated layout. */
|
|
1924
|
+
static_estimate?: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
1925
|
+
}
|
|
1926
|
+
/** Verdict per legal requirement. */
|
|
1927
|
+
export type CheckRequirementVerdict = CheckRequirementRef & {
|
|
1928
|
+
/** Worst status among the requirement’s checks. */
|
|
1929
|
+
status: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
1930
|
+
/** Checks that enforce it. */
|
|
1931
|
+
check_ids: Array<string>;
|
|
1932
|
+
};
|
|
1933
|
+
/** A note about the input (never a compliance verdict). */
|
|
1934
|
+
export interface CheckWarning {
|
|
1935
|
+
/** Stable warning code. */
|
|
1936
|
+
code: string;
|
|
1937
|
+
/** Explanation. */
|
|
1938
|
+
message: string;
|
|
1939
|
+
/** Related parameter. */
|
|
1940
|
+
param?: string;
|
|
1941
|
+
}
|
|
1942
|
+
/** A compliant replacement, verified by the engine. */
|
|
1943
|
+
export interface CheckReplacement {
|
|
1944
|
+
/** Compliant disclosure generated from the plan terms (locked wording). */
|
|
1945
|
+
disclosure_text: string;
|
|
1946
|
+
/** Label for the unchecked, required consent checkbox. */
|
|
1947
|
+
consent_label: string;
|
|
1948
|
+
/** Purchase button label that itself states the renewal. */
|
|
1949
|
+
button_text: string;
|
|
1950
|
+
/** Drop-in markup: disclosure (set off in a box) + unchecked required checkbox + button. */
|
|
1951
|
+
html: string;
|
|
1952
|
+
/** Placeholders left to fill (e.g. {{cancel_url}}). */
|
|
1953
|
+
placeholders: Array<string>;
|
|
1954
|
+
/** The engine passes every targeted sign-up check on a page using this replacement. */
|
|
1955
|
+
verified: boolean;
|
|
1956
|
+
/** Targeted checks that still do not pass with it (normally empty). */
|
|
1957
|
+
remaining_checks: Array<string>;
|
|
1958
|
+
/** sha256 of disclosure + consent label. */
|
|
1959
|
+
sha256: string;
|
|
1960
|
+
}
|
|
1961
|
+
/** Verdict on a checkout disclosure plus a verified replacement. */
|
|
1962
|
+
export interface DisclosureCheckResult {
|
|
1963
|
+
/** Id of this check run (chk_…). Checks are stateless and not stored. */
|
|
1964
|
+
id: string;
|
|
1965
|
+
/** String representing the object's type. Always "check_result". */
|
|
1966
|
+
object: "check_result";
|
|
1967
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
1968
|
+
livemode: boolean;
|
|
1969
|
+
/** When the check ran. Unix timestamp in seconds. */
|
|
1970
|
+
created: number;
|
|
1971
|
+
/** Which check ran. */
|
|
1972
|
+
kind: "disclosure" | "stripe_checkout_session" | "stripe_payment_link" | "email" | "page";
|
|
1973
|
+
/** Overall: fail if any check fails, else needs_review if any needs review, else pass (not_applicable when nothing applies). */
|
|
1974
|
+
verdict: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
1975
|
+
/** Counts by status. */
|
|
1976
|
+
summary: {
|
|
1977
|
+
/** Checks passing. */
|
|
1978
|
+
pass: number;
|
|
1979
|
+
/** Checks failing. */
|
|
1980
|
+
fail: number;
|
|
1981
|
+
/** Checks needing review. */
|
|
1982
|
+
needs_review: number;
|
|
1983
|
+
/** Checks not applicable. */
|
|
1984
|
+
not_applicable: number;
|
|
1985
|
+
};
|
|
1986
|
+
/** Every evaluated check. */
|
|
1987
|
+
checks: Array<CheckVerdict>;
|
|
1988
|
+
/** Verdict per legal requirement (federal first, then by state). */
|
|
1989
|
+
requirements: Array<CheckRequirementVerdict>;
|
|
1990
|
+
/** Notes about the input. */
|
|
1991
|
+
warnings: Array<CheckWarning>;
|
|
1992
|
+
/** Jurisdictions evaluated. */
|
|
1993
|
+
jurisdictions: "all" | Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
1994
|
+
/** Date the law was evaluated at. */
|
|
1995
|
+
as_of: string;
|
|
1996
|
+
/** Version of the check implementations. */
|
|
1997
|
+
rules_version: string;
|
|
1998
|
+
/** Version of the legal catalog. */
|
|
1999
|
+
catalog_version: string;
|
|
2000
|
+
/** sha256 of the canonical legal catalog. */
|
|
2001
|
+
catalog_hash: string;
|
|
2002
|
+
/** Not legal advice. */
|
|
2003
|
+
disclaimer: string;
|
|
2004
|
+
next_action: NextAction;
|
|
2005
|
+
replacement: CheckReplacement;
|
|
2006
|
+
}
|
|
2007
|
+
/** A checkout disclosure to check before it ships. */
|
|
2008
|
+
export interface DisclosureCheckParams {
|
|
2009
|
+
/** The disclosure shown next to the purchase button, exactly as rendered. */
|
|
2010
|
+
text: string;
|
|
2011
|
+
/** Brand shown to subscribers; used in generated text. */
|
|
2012
|
+
merchant_name?: string;
|
|
2013
|
+
/** Plan / product name. */
|
|
2014
|
+
plan_name?: string;
|
|
2015
|
+
/** Recurring price in major units (19.99). Or give `amount` in minor units. */
|
|
2016
|
+
price?: number | string;
|
|
2017
|
+
/** Recurring price in minor units (1999 = $19.99), Stripe style. */
|
|
2018
|
+
amount?: number;
|
|
2019
|
+
/** Three-letter ISO currency (default usd). */
|
|
2020
|
+
currency?: string;
|
|
2021
|
+
/** Billing interval: day, week, month or year (required). */
|
|
2022
|
+
interval: string;
|
|
2023
|
+
/** Number of intervals between charges (default 1). */
|
|
2024
|
+
interval_count?: number;
|
|
2025
|
+
/** Free-trial length in days (0 or absent = no trial). */
|
|
2026
|
+
trial_days?: number;
|
|
2027
|
+
/** https URL where subscribers cancel online (used in generated text; a {{cancel_url}} placeholder otherwise). */
|
|
2028
|
+
cancel_url?: string;
|
|
2029
|
+
/** When a cancellation takes effect (default period_end). */
|
|
2030
|
+
cancel_timing?: "period_end" | "immediately";
|
|
2031
|
+
/** Label of the purchase button (default "Subscribe", or "Start free trial" with a trial). */
|
|
2032
|
+
button_text?: string;
|
|
2033
|
+
/** Other text next to the button (order summary), if any. */
|
|
2034
|
+
order_summary?: string;
|
|
2035
|
+
/** Where you sell: "all" (default) or state codes ("US-CA", "CA", "US-NY"; "US-FED" is always included). */
|
|
2036
|
+
jurisdictions?: "all" | Array<string>;
|
|
2037
|
+
/** Where and how the disclosure is shown. */
|
|
2038
|
+
placement?: {
|
|
2039
|
+
/** The disclosure is shown before / above the purchase button (default true). */
|
|
2040
|
+
above_button?: boolean;
|
|
2041
|
+
/** The disclosure is on the same page as the payment form and button (default true). */
|
|
2042
|
+
same_page_as_payment?: boolean;
|
|
2043
|
+
/** Rendered font size of the disclosure (default 14). */
|
|
2044
|
+
font_size_px?: number;
|
|
2045
|
+
/** WCAG contrast ratio of the text against its background (default ≈14.7). */
|
|
2046
|
+
contrast_ratio?: number;
|
|
2047
|
+
/** The disclosure is bold / semibold. */
|
|
2048
|
+
bold?: boolean;
|
|
2049
|
+
/** The disclosure is set off in a bordered or shaded box. */
|
|
2050
|
+
boxed?: boolean;
|
|
2051
|
+
/** Font size of the surrounding body text (default 14). */
|
|
2052
|
+
body_font_size_px?: number;
|
|
2053
|
+
};
|
|
2054
|
+
/** The consent checkbox, if any. Omitted = no checkbox. */
|
|
2055
|
+
consent?: {
|
|
2056
|
+
/** A checkbox the customer must tick to agree to the renewal terms. */
|
|
2057
|
+
checkbox: boolean;
|
|
2058
|
+
/** The checkbox is ticked by default. */
|
|
2059
|
+
prechecked?: boolean;
|
|
2060
|
+
/** The checkbox label (default "I agree to the automatic renewal terms above."). */
|
|
2061
|
+
label?: string;
|
|
2062
|
+
/** The form cannot be submitted without ticking it (default true). */
|
|
2063
|
+
required?: boolean;
|
|
2064
|
+
};
|
|
2065
|
+
/** Evaluate the law as of this date (YYYY-MM-DD, default today). */
|
|
2066
|
+
as_of?: string;
|
|
2067
|
+
}
|
|
2068
|
+
/** RFC 6902 operation. */
|
|
2069
|
+
export interface JsonPatchOperation {
|
|
2070
|
+
/** JSON Patch operation. */
|
|
2071
|
+
op: "add" | "replace" | "remove";
|
|
2072
|
+
/** JSON Pointer into params. */
|
|
2073
|
+
path: string;
|
|
2074
|
+
/** Value to set. */
|
|
2075
|
+
value?: unknown;
|
|
2076
|
+
}
|
|
2077
|
+
/** Verdict on Checkout Session params plus corrected params. */
|
|
2078
|
+
export interface StripeCheckoutSessionCheckResult {
|
|
2079
|
+
/** Id of this check run (chk_…). Checks are stateless and not stored. */
|
|
2080
|
+
id: string;
|
|
2081
|
+
/** String representing the object's type. Always "check_result". */
|
|
2082
|
+
object: "check_result";
|
|
2083
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
2084
|
+
livemode: boolean;
|
|
2085
|
+
/** When the check ran. Unix timestamp in seconds. */
|
|
2086
|
+
created: number;
|
|
2087
|
+
/** Which check ran. */
|
|
2088
|
+
kind: "disclosure" | "stripe_checkout_session" | "stripe_payment_link" | "email" | "page";
|
|
2089
|
+
/** Overall: fail if any check fails, else needs_review if any needs review, else pass (not_applicable when nothing applies). */
|
|
2090
|
+
verdict: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
2091
|
+
/** Counts by status. */
|
|
2092
|
+
summary: {
|
|
2093
|
+
/** Checks passing. */
|
|
2094
|
+
pass: number;
|
|
2095
|
+
/** Checks failing. */
|
|
2096
|
+
fail: number;
|
|
2097
|
+
/** Checks needing review. */
|
|
2098
|
+
needs_review: number;
|
|
2099
|
+
/** Checks not applicable. */
|
|
2100
|
+
not_applicable: number;
|
|
2101
|
+
};
|
|
2102
|
+
/** Every evaluated check. */
|
|
2103
|
+
checks: Array<CheckVerdict>;
|
|
2104
|
+
/** Verdict per legal requirement (federal first, then by state). */
|
|
2105
|
+
requirements: Array<CheckRequirementVerdict>;
|
|
2106
|
+
/** Notes about the input. */
|
|
2107
|
+
warnings: Array<CheckWarning>;
|
|
2108
|
+
/** Jurisdictions evaluated. */
|
|
2109
|
+
jurisdictions: "all" | Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
2110
|
+
/** Date the law was evaluated at. */
|
|
2111
|
+
as_of: string;
|
|
2112
|
+
/** Version of the check implementations. */
|
|
2113
|
+
rules_version: string;
|
|
2114
|
+
/** Version of the legal catalog. */
|
|
2115
|
+
catalog_version: string;
|
|
2116
|
+
/** sha256 of the canonical legal catalog. */
|
|
2117
|
+
catalog_hash: string;
|
|
2118
|
+
/** Not legal advice. */
|
|
2119
|
+
disclaimer: string;
|
|
2120
|
+
next_action: NextAction;
|
|
2121
|
+
/** The fix. */
|
|
2122
|
+
correction: {
|
|
2123
|
+
/** JSON Patch turning params into corrected_params (empty: nothing to change). */
|
|
2124
|
+
patch: Array<JsonPatchOperation>;
|
|
2125
|
+
/** The full params with the fix applied. */
|
|
2126
|
+
corrected_params: Record<string, unknown>;
|
|
2127
|
+
/** Engine verification of corrected_params. */
|
|
2128
|
+
verification: {
|
|
2129
|
+
/** Each check before and after the fix. */
|
|
2130
|
+
checks: Array<{
|
|
2131
|
+
/** Check id. */
|
|
2132
|
+
check_id: string;
|
|
2133
|
+
/** Status with params. */
|
|
2134
|
+
before: string;
|
|
2135
|
+
/** Status with corrected_params. */
|
|
2136
|
+
after: string;
|
|
2137
|
+
}>;
|
|
2138
|
+
/** No check fails after the fix (conspicuousness on Stripe styling excepted). */
|
|
2139
|
+
passes: boolean;
|
|
2140
|
+
/** Checks still failing / unclear after the fix. */
|
|
2141
|
+
remaining_checks: Array<string>;
|
|
2142
|
+
/** What Stripe params cannot fix. */
|
|
2143
|
+
note: string;
|
|
2144
|
+
};
|
|
2145
|
+
/** Placeholders left in the messages. */
|
|
2146
|
+
placeholders: Array<string>;
|
|
2147
|
+
};
|
|
2148
|
+
}
|
|
2149
|
+
/** What Stripe params do not say: merchant_name, cancel_url, and price / interval when line_items reference a Price id. */
|
|
2150
|
+
export interface CheckPlanTerms {
|
|
2151
|
+
/** Brand shown to subscribers; used in generated text. */
|
|
2152
|
+
merchant_name?: string;
|
|
2153
|
+
/** Plan / product name. */
|
|
2154
|
+
plan_name?: string;
|
|
2155
|
+
/** Recurring price in major units (19.99). Or give `amount` in minor units. */
|
|
2156
|
+
price?: number | string;
|
|
2157
|
+
/** Recurring price in minor units (1999 = $19.99), Stripe style. */
|
|
2158
|
+
amount?: number;
|
|
2159
|
+
/** Three-letter ISO currency (default usd). */
|
|
2160
|
+
currency?: string;
|
|
2161
|
+
/** Billing interval: day, week, month or year. */
|
|
2162
|
+
interval?: string;
|
|
2163
|
+
/** Number of intervals between charges (default 1). */
|
|
2164
|
+
interval_count?: number;
|
|
2165
|
+
/** Free-trial length in days (0 or absent = no trial). */
|
|
2166
|
+
trial_days?: number;
|
|
2167
|
+
/** https URL where subscribers cancel online (used in generated text; a {{cancel_url}} placeholder otherwise). */
|
|
2168
|
+
cancel_url?: string;
|
|
2169
|
+
/** When a cancellation takes effect (default period_end). */
|
|
2170
|
+
cancel_timing?: "period_end" | "immediately";
|
|
2171
|
+
}
|
|
2172
|
+
/** Stripe params to check before they ship. */
|
|
2173
|
+
export interface StripeCheckParams {
|
|
2174
|
+
/** Exactly the object your code passes to Stripe (checkout.sessions.create / paymentLinks.create), or a retrieved Payment Link. */
|
|
2175
|
+
params: Record<string, unknown>;
|
|
2176
|
+
merchant?: CheckPlanTerms;
|
|
2177
|
+
/** Where you sell: "all" (default) or state codes ("US-CA", "CA", "US-NY"; "US-FED" is always included). */
|
|
2178
|
+
jurisdictions?: "all" | Array<string>;
|
|
2179
|
+
/** Evaluate the law as of this date (YYYY-MM-DD, default today). */
|
|
2180
|
+
as_of?: string;
|
|
2181
|
+
}
|
|
2182
|
+
/** Verdict on Payment Link params plus corrected params. */
|
|
2183
|
+
export interface StripePaymentLinkCheckResult {
|
|
2184
|
+
/** Id of this check run (chk_…). Checks are stateless and not stored. */
|
|
2185
|
+
id: string;
|
|
2186
|
+
/** String representing the object's type. Always "check_result". */
|
|
2187
|
+
object: "check_result";
|
|
2188
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
2189
|
+
livemode: boolean;
|
|
2190
|
+
/** When the check ran. Unix timestamp in seconds. */
|
|
2191
|
+
created: number;
|
|
2192
|
+
/** Which check ran. */
|
|
2193
|
+
kind: "disclosure" | "stripe_checkout_session" | "stripe_payment_link" | "email" | "page";
|
|
2194
|
+
/** Overall: fail if any check fails, else needs_review if any needs review, else pass (not_applicable when nothing applies). */
|
|
2195
|
+
verdict: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
2196
|
+
/** Counts by status. */
|
|
2197
|
+
summary: {
|
|
2198
|
+
/** Checks passing. */
|
|
2199
|
+
pass: number;
|
|
2200
|
+
/** Checks failing. */
|
|
2201
|
+
fail: number;
|
|
2202
|
+
/** Checks needing review. */
|
|
2203
|
+
needs_review: number;
|
|
2204
|
+
/** Checks not applicable. */
|
|
2205
|
+
not_applicable: number;
|
|
2206
|
+
};
|
|
2207
|
+
/** Every evaluated check. */
|
|
2208
|
+
checks: Array<CheckVerdict>;
|
|
2209
|
+
/** Verdict per legal requirement (federal first, then by state). */
|
|
2210
|
+
requirements: Array<CheckRequirementVerdict>;
|
|
2211
|
+
/** Notes about the input. */
|
|
2212
|
+
warnings: Array<CheckWarning>;
|
|
2213
|
+
/** Jurisdictions evaluated. */
|
|
2214
|
+
jurisdictions: "all" | Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
2215
|
+
/** Date the law was evaluated at. */
|
|
2216
|
+
as_of: string;
|
|
2217
|
+
/** Version of the check implementations. */
|
|
2218
|
+
rules_version: string;
|
|
2219
|
+
/** Version of the legal catalog. */
|
|
2220
|
+
catalog_version: string;
|
|
2221
|
+
/** sha256 of the canonical legal catalog. */
|
|
2222
|
+
catalog_hash: string;
|
|
2223
|
+
/** Not legal advice. */
|
|
2224
|
+
disclaimer: string;
|
|
2225
|
+
next_action: NextAction;
|
|
2226
|
+
/** The fix. */
|
|
2227
|
+
correction: {
|
|
2228
|
+
/** JSON Patch turning params into corrected_params (empty: nothing to change). */
|
|
2229
|
+
patch: Array<JsonPatchOperation>;
|
|
2230
|
+
/** The full params with the fix applied. */
|
|
2231
|
+
corrected_params: Record<string, unknown>;
|
|
2232
|
+
/** Engine verification of corrected_params. */
|
|
2233
|
+
verification: {
|
|
2234
|
+
/** Each check before and after the fix. */
|
|
2235
|
+
checks: Array<{
|
|
2236
|
+
/** Check id. */
|
|
2237
|
+
check_id: string;
|
|
2238
|
+
/** Status with params. */
|
|
2239
|
+
before: string;
|
|
2240
|
+
/** Status with corrected_params. */
|
|
2241
|
+
after: string;
|
|
2242
|
+
}>;
|
|
2243
|
+
/** No check fails after the fix (conspicuousness on Stripe styling excepted). */
|
|
2244
|
+
passes: boolean;
|
|
2245
|
+
/** Checks still failing / unclear after the fix. */
|
|
2246
|
+
remaining_checks: Array<string>;
|
|
2247
|
+
/** What Stripe params cannot fix. */
|
|
2248
|
+
note: string;
|
|
2249
|
+
};
|
|
2250
|
+
/** Placeholders left in the messages. */
|
|
2251
|
+
placeholders: Array<string>;
|
|
2252
|
+
/** For an existing link (params.id): params for stripe.paymentLinks.update (same URL). */
|
|
2253
|
+
update_params?: Record<string, unknown>;
|
|
2254
|
+
/** Stripe cannot add the consent checkbox to an existing link: create a new link with corrected_params. */
|
|
2255
|
+
needs_new_link_for_consent: boolean;
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
/** Verdict on a lifecycle email plus a verified template. */
|
|
2259
|
+
export interface EmailCheckResult {
|
|
2260
|
+
/** Id of this check run (chk_…). Checks are stateless and not stored. */
|
|
2261
|
+
id: string;
|
|
2262
|
+
/** String representing the object's type. Always "check_result". */
|
|
2263
|
+
object: "check_result";
|
|
2264
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
2265
|
+
livemode: boolean;
|
|
2266
|
+
/** When the check ran. Unix timestamp in seconds. */
|
|
2267
|
+
created: number;
|
|
2268
|
+
/** Which check ran. */
|
|
2269
|
+
kind: "disclosure" | "stripe_checkout_session" | "stripe_payment_link" | "email" | "page";
|
|
2270
|
+
/** Overall: fail if any check fails, else needs_review if any needs review, else pass (not_applicable when nothing applies). */
|
|
2271
|
+
verdict: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
2272
|
+
/** Counts by status. */
|
|
2273
|
+
summary: {
|
|
2274
|
+
/** Checks passing. */
|
|
2275
|
+
pass: number;
|
|
2276
|
+
/** Checks failing. */
|
|
2277
|
+
fail: number;
|
|
2278
|
+
/** Checks needing review. */
|
|
2279
|
+
needs_review: number;
|
|
2280
|
+
/** Checks not applicable. */
|
|
2281
|
+
not_applicable: number;
|
|
2282
|
+
};
|
|
2283
|
+
/** Every evaluated check. */
|
|
2284
|
+
checks: Array<CheckVerdict>;
|
|
2285
|
+
/** Verdict per legal requirement (federal first, then by state). */
|
|
2286
|
+
requirements: Array<CheckRequirementVerdict>;
|
|
2287
|
+
/** Notes about the input. */
|
|
2288
|
+
warnings: Array<CheckWarning>;
|
|
2289
|
+
/** Jurisdictions evaluated. */
|
|
2290
|
+
jurisdictions: "all" | Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
2291
|
+
/** Date the law was evaluated at. */
|
|
2292
|
+
as_of: string;
|
|
2293
|
+
/** Version of the check implementations. */
|
|
2294
|
+
rules_version: string;
|
|
2295
|
+
/** Version of the legal catalog. */
|
|
2296
|
+
catalog_version: string;
|
|
2297
|
+
/** sha256 of the canonical legal catalog. */
|
|
2298
|
+
catalog_hash: string;
|
|
2299
|
+
/** Not legal advice. */
|
|
2300
|
+
disclaimer: string;
|
|
2301
|
+
next_action: NextAction;
|
|
2302
|
+
/** The email kind checked. */
|
|
2303
|
+
email_kind: string;
|
|
2304
|
+
/** Requirements that make this email mandatory for this plan (empty: not legally required). */
|
|
2305
|
+
required_by: Array<string>;
|
|
2306
|
+
/** A compliant template generated from the plan terms. */
|
|
2307
|
+
template: {
|
|
2308
|
+
/** Compliant subject. */
|
|
2309
|
+
subject: string;
|
|
2310
|
+
/** Compliant plain-text body. */
|
|
2311
|
+
text: string;
|
|
2312
|
+
/** The same body as HTML. */
|
|
2313
|
+
html: string;
|
|
2314
|
+
/** Per-subscriber merge tags your sender fills. */
|
|
2315
|
+
merge_tags: Array<string>;
|
|
2316
|
+
/** Values you have not given yet. */
|
|
2317
|
+
placeholders: Array<string>;
|
|
2318
|
+
/** The engine passes this kind’s checks on the template. */
|
|
2319
|
+
verified: boolean;
|
|
2320
|
+
/** Checks the template does not pass (normally empty). */
|
|
2321
|
+
remaining_checks: Array<string>;
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
/** A lifecycle email to check before it is wired in. */
|
|
2325
|
+
export interface EmailCheckParams {
|
|
2326
|
+
/** Which lifecycle email this is (the same names verifyTask, the plan and the X-Checkbox-Kind header use; trial_ending is an alias of trial_reminder, as in Notices). */
|
|
2327
|
+
kind: "acknowledgment" | "trial_reminder" | "trial_ending" | "renewal_reminder" | "price_change" | "annual_terms" | "charge_notice" | "cancellation_confirmation";
|
|
2328
|
+
/** Subject line. */
|
|
2329
|
+
subject: string;
|
|
2330
|
+
/** Plain-text body (give text, html or both). */
|
|
2331
|
+
text?: string;
|
|
2332
|
+
/** HTML body. */
|
|
2333
|
+
html?: string;
|
|
2334
|
+
/** The plan the email is about (price, interval and cancel_url at least). */
|
|
2335
|
+
terms: CheckPlanTerms & {
|
|
2336
|
+
/** price_change only: the OLD price before the change, major units. price / amount is the NEW price the email announces. */
|
|
2337
|
+
previous_price?: number | string;
|
|
2338
|
+
/** Price before a price change, minor units. */
|
|
2339
|
+
previous_amount?: number;
|
|
2340
|
+
/** Support email / URL shown in the generated template. */
|
|
2341
|
+
support_contact?: string;
|
|
2342
|
+
};
|
|
2343
|
+
/** Where you sell: "all" (default) or state codes ("US-CA", "CA", "US-NY"; "US-FED" is always included). */
|
|
2344
|
+
jurisdictions?: "all" | Array<string>;
|
|
2345
|
+
/** Evaluate the law as of this date (YYYY-MM-DD, default today). */
|
|
2346
|
+
as_of?: string;
|
|
2347
|
+
}
|
|
2348
|
+
/** Verdict on a checkout page. */
|
|
2349
|
+
export interface PageCheckResult {
|
|
2350
|
+
/** Id of this check run (chk_…). Checks are stateless and not stored. */
|
|
2351
|
+
id: string;
|
|
2352
|
+
/** String representing the object's type. Always "check_result". */
|
|
2353
|
+
object: "check_result";
|
|
2354
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
2355
|
+
livemode: boolean;
|
|
2356
|
+
/** When the check ran. Unix timestamp in seconds. */
|
|
2357
|
+
created: number;
|
|
2358
|
+
/** Which check ran. */
|
|
2359
|
+
kind: "disclosure" | "stripe_checkout_session" | "stripe_payment_link" | "email" | "page";
|
|
2360
|
+
/** Overall: fail if any check fails, else needs_review if any needs review, else pass (not_applicable when nothing applies). */
|
|
2361
|
+
verdict: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
2362
|
+
/** Counts by status. */
|
|
2363
|
+
summary: {
|
|
2364
|
+
/** Checks passing. */
|
|
2365
|
+
pass: number;
|
|
2366
|
+
/** Checks failing. */
|
|
2367
|
+
fail: number;
|
|
2368
|
+
/** Checks needing review. */
|
|
2369
|
+
needs_review: number;
|
|
2370
|
+
/** Checks not applicable. */
|
|
2371
|
+
not_applicable: number;
|
|
2372
|
+
};
|
|
2373
|
+
/** Every evaluated check. */
|
|
2374
|
+
checks: Array<CheckVerdict>;
|
|
2375
|
+
/** Verdict per legal requirement (federal first, then by state). */
|
|
2376
|
+
requirements: Array<CheckRequirementVerdict>;
|
|
2377
|
+
/** Notes about the input. */
|
|
2378
|
+
warnings: Array<CheckWarning>;
|
|
2379
|
+
/** Jurisdictions evaluated. */
|
|
2380
|
+
jurisdictions: "all" | Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
2381
|
+
/** Date the law was evaluated at. */
|
|
2382
|
+
as_of: string;
|
|
2383
|
+
/** Version of the check implementations. */
|
|
2384
|
+
rules_version: string;
|
|
2385
|
+
/** Version of the legal catalog. */
|
|
2386
|
+
catalog_version: string;
|
|
2387
|
+
/** sha256 of the canonical legal catalog. */
|
|
2388
|
+
catalog_hash: string;
|
|
2389
|
+
/** Not legal advice. */
|
|
2390
|
+
disclaimer: string;
|
|
2391
|
+
next_action: NextAction;
|
|
2392
|
+
/** Whether html was given or fetched from url. */
|
|
2393
|
+
source: "html" | "url";
|
|
2394
|
+
/** What was read from the page. */
|
|
2395
|
+
extraction: {
|
|
2396
|
+
/** How the page was read. */
|
|
2397
|
+
mode: "static_html";
|
|
2398
|
+
/** Page URL used. */
|
|
2399
|
+
url: string;
|
|
2400
|
+
/** Purchase buttons found (primary first). */
|
|
2401
|
+
purchase_buttons: Array<string>;
|
|
2402
|
+
/** Text blocks that read like subscription terms. */
|
|
2403
|
+
disclosures: Array<string>;
|
|
2404
|
+
/** Checkboxes found. */
|
|
2405
|
+
checkboxes: Array<{
|
|
2406
|
+
/** Label. */
|
|
2407
|
+
label: string;
|
|
2408
|
+
/** Checked by default. */
|
|
2409
|
+
prechecked: boolean;
|
|
2410
|
+
/** Required. */
|
|
2411
|
+
required: boolean;
|
|
2412
|
+
}>;
|
|
2413
|
+
/** Terms / cancellation / account links found. */
|
|
2414
|
+
links: Array<{
|
|
2415
|
+
/** Link text. */
|
|
2416
|
+
text: string;
|
|
2417
|
+
/** Target. */
|
|
2418
|
+
href: string;
|
|
2419
|
+
}>;
|
|
2420
|
+
/** What a static read cannot measure. */
|
|
2421
|
+
limitations: Array<string>;
|
|
2422
|
+
};
|
|
2423
|
+
replacement?: CheckReplacement;
|
|
2424
|
+
}
|
|
2425
|
+
/** A checkout page to check. */
|
|
2426
|
+
export interface PageCheckParams {
|
|
2427
|
+
/** Checkout page HTML (rendered, after JavaScript, for client-side apps). Give html or url. */
|
|
2428
|
+
html?: string;
|
|
2429
|
+
/** Fetch this live page instead (live mode, activated accounts only; public addresses only). */
|
|
2430
|
+
url?: string;
|
|
2431
|
+
/** What the page is (default checkout). */
|
|
2432
|
+
page_kind?: "checkout" | "pricing";
|
|
2433
|
+
terms?: CheckPlanTerms;
|
|
2434
|
+
/** Where you sell: "all" (default) or state codes ("US-CA", "CA", "US-NY"; "US-FED" is always included). */
|
|
2435
|
+
jurisdictions?: "all" | Array<string>;
|
|
2436
|
+
/** Evaluate the law as of this date (YYYY-MM-DD, default today). */
|
|
2437
|
+
as_of?: string;
|
|
2438
|
+
}
|
|
2439
|
+
/** One notice to send. */
|
|
2440
|
+
export interface ScheduledNotice {
|
|
2441
|
+
/** Notice kind. */
|
|
2442
|
+
kind: "acknowledgment" | "trial_ending" | "renewal_reminder" | "annual_terms" | "price_change";
|
|
2443
|
+
/** What the notice announces. */
|
|
2444
|
+
occasion: string;
|
|
2445
|
+
/** Date of the event (YYYY-MM-DD, UTC). */
|
|
2446
|
+
anchor_date: string;
|
|
2447
|
+
/** Recommended send date (YYYY-MM-DD, UTC). */
|
|
2448
|
+
send_date: string;
|
|
2449
|
+
/** Recommended send time. Unix timestamp in seconds. */
|
|
2450
|
+
send_at: number;
|
|
2451
|
+
/** Earliest compliant send time. Unix seconds. */
|
|
2452
|
+
window_opens_at: number;
|
|
2453
|
+
/** Latest compliant send time. Unix seconds. */
|
|
2454
|
+
window_closes_at: number;
|
|
2455
|
+
/** Days before the event (0 = right away). */
|
|
2456
|
+
days_before: number;
|
|
2457
|
+
/** Jurisdictions whose window this send satisfies. */
|
|
2458
|
+
jurisdictions: Array<string>;
|
|
2459
|
+
/** Requirements behind the timing. */
|
|
2460
|
+
requirement_ids: Array<string>;
|
|
2461
|
+
/** Citations of those requirements. */
|
|
2462
|
+
citations: Array<string>;
|
|
2463
|
+
/** No requirement states a window; Checkbox’s default window was used. */
|
|
2464
|
+
default_window: boolean;
|
|
2465
|
+
}
|
|
2466
|
+
/** When each legally required notice must be sent. */
|
|
2467
|
+
export interface NoticeScheduleResult {
|
|
2468
|
+
/** Id of this check run (chk_…). */
|
|
2469
|
+
id: string;
|
|
2470
|
+
/** String representing the object's type. Always "notice_schedule". */
|
|
2471
|
+
object: "notice_schedule";
|
|
2472
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
2473
|
+
livemode: boolean;
|
|
2474
|
+
/** When computed. Unix seconds. */
|
|
2475
|
+
created: number;
|
|
2476
|
+
/** Sign-up date planned for. */
|
|
2477
|
+
start_date: string;
|
|
2478
|
+
/** Every legally required notice, in send order. */
|
|
2479
|
+
notices: Array<ScheduledNotice>;
|
|
2480
|
+
/** Notice kinds no applicable requirement demands for this plan. */
|
|
2481
|
+
not_required: Array<{
|
|
2482
|
+
/** Notice kind. */
|
|
2483
|
+
kind: string;
|
|
2484
|
+
/** Why it is not required. */
|
|
2485
|
+
reason: string;
|
|
2486
|
+
}>;
|
|
2487
|
+
/** Jurisdictions planned for. */
|
|
2488
|
+
jurisdictions: "all" | Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
2489
|
+
/** Date the law was applied at. */
|
|
2490
|
+
as_of: string;
|
|
2491
|
+
/** Version of the check implementations. */
|
|
2492
|
+
rules_version: string;
|
|
2493
|
+
/** Version of the legal catalog. */
|
|
2494
|
+
catalog_version: string;
|
|
2495
|
+
/** sha256 of the canonical legal catalog. */
|
|
2496
|
+
catalog_hash: string;
|
|
2497
|
+
/** Not legal advice. */
|
|
2498
|
+
disclaimer: string;
|
|
2499
|
+
next_action: NextAction;
|
|
2500
|
+
}
|
|
2501
|
+
/** A subscription to plan the legally required notices for. */
|
|
2502
|
+
export interface NoticeScheduleParams {
|
|
2503
|
+
terms: CheckPlanTerms;
|
|
2504
|
+
/** Sign-up date of the subscription to plan for (default today). */
|
|
2505
|
+
start_date?: string;
|
|
2506
|
+
/** A planned price change to schedule the notice for. */
|
|
2507
|
+
price_change?: {
|
|
2508
|
+
/** Date the new price is first charged. */
|
|
2509
|
+
effective_date: string;
|
|
2510
|
+
/** New recurring price, major units. */
|
|
2511
|
+
new_price?: number;
|
|
2512
|
+
};
|
|
2513
|
+
/** How many renewals to plan (default: one year of renewals). */
|
|
2514
|
+
cycles?: number;
|
|
2515
|
+
/** Payment methods offered (some notices apply only to debit / ACH). */
|
|
2516
|
+
payment_methods?: Array<"card" | "debit" | "ach" | "wallet" | "other">;
|
|
2517
|
+
/** Where you sell: "all" (default) or state codes ("US-CA", "CA", "US-NY"; "US-FED" is always included). */
|
|
2518
|
+
jurisdictions?: "all" | Array<string>;
|
|
2519
|
+
/** Evaluate the law as of this date (YYYY-MM-DD, default today). */
|
|
2520
|
+
as_of?: string;
|
|
2521
|
+
}
|
|
2522
|
+
export interface ElementsRelease {
|
|
2523
|
+
/** Semver of the bundle. */
|
|
2524
|
+
version: string;
|
|
2525
|
+
/** Immutable URL of this version. */
|
|
2526
|
+
url: string;
|
|
2527
|
+
/** Subresource Integrity hash (integrity attribute). */
|
|
2528
|
+
integrity: string;
|
|
2529
|
+
/** Bytes. */
|
|
2530
|
+
size: number;
|
|
2531
|
+
}
|
|
2532
|
+
/** Released Checkbox Elements bundles and their SRI hashes. */
|
|
2533
|
+
export interface ElementsManifest {
|
|
2534
|
+
/** String representing the object's type. Always "elements_manifest". */
|
|
2535
|
+
object: "elements_manifest";
|
|
2536
|
+
latest: ElementsRelease;
|
|
2537
|
+
/** Every released version, newest first. */
|
|
2538
|
+
versions: Array<ElementsRelease>;
|
|
2539
|
+
/** Ready-to-paste <script> tag for the latest version. */
|
|
2540
|
+
script_tag: string;
|
|
2541
|
+
/** Custom element name. */
|
|
2542
|
+
element_tag: string;
|
|
2543
|
+
/** Documentation. */
|
|
2544
|
+
docs_url: string;
|
|
2545
|
+
}
|
|
2546
|
+
/** Locked automatic-renewal disclosure + consent wording for a site, rendered by <checkbox-disclosure disclosure="disc_…">. */
|
|
2547
|
+
export interface Disclosure {
|
|
2548
|
+
/** Unique identifier of the disclosure (disc_…). */
|
|
2549
|
+
id: string;
|
|
2550
|
+
/** String representing the object's type. Always "disclosure". */
|
|
2551
|
+
object: "disclosure";
|
|
2552
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
2553
|
+
livemode: boolean;
|
|
2554
|
+
/** Creation time. Unix timestamp in seconds. */
|
|
2555
|
+
created: number;
|
|
2556
|
+
/** Site. */
|
|
2557
|
+
site: string;
|
|
2558
|
+
/** Terms stated (DisclosureTerms). */
|
|
2559
|
+
terms: Record<string, unknown>;
|
|
2560
|
+
/** Locked disclosure text. */
|
|
2561
|
+
text: string;
|
|
2562
|
+
/** Locked consent checkbox label. */
|
|
2563
|
+
consent_label: string;
|
|
2564
|
+
/** sha256 of text + "\n" + consent_label. */
|
|
2565
|
+
texts_sha256: string;
|
|
2566
|
+
/** Rules version that generated and verified the wording. */
|
|
2567
|
+
rules_version: string;
|
|
2568
|
+
/** Rules-engine verification of the element on your checkout (secret-key responses only). */
|
|
2569
|
+
verification: {
|
|
2570
|
+
/** Every targeted sign-up check passes on the modelled checkout. */
|
|
2571
|
+
passes: boolean;
|
|
2572
|
+
/** from_capture (your scanned checkout) or synthetic. */
|
|
2573
|
+
modelled: string;
|
|
2574
|
+
/** Checks that would still not pass. */
|
|
2575
|
+
remaining: Array<string>;
|
|
2576
|
+
/** Per-check before / after. */
|
|
2577
|
+
checks: Array<{
|
|
2578
|
+
/** Sign-up check id. */
|
|
2579
|
+
check_id: string;
|
|
2580
|
+
/** Status on the checkout today. */
|
|
2581
|
+
before: string;
|
|
2582
|
+
/** Status with the element installed. */
|
|
2583
|
+
after: string;
|
|
2584
|
+
}>;
|
|
2585
|
+
} | null;
|
|
2586
|
+
/** Markup to paste directly above your pay button. */
|
|
2587
|
+
element_html?: string;
|
|
2588
|
+
/** <script> tag (pinned version, SRI) for the page <head>. */
|
|
2589
|
+
script_tag?: string;
|
|
2590
|
+
/** The publishable key for this mode (safe to embed in pages). */
|
|
2591
|
+
publishable_key?: string;
|
|
2592
|
+
next_action?: NextAction;
|
|
2593
|
+
}
|
|
2594
|
+
/** Terms to state. Omitted values come from the billing connection; cancel_url defaults to the hosted cancellation page. */
|
|
2595
|
+
export interface DisclosureTerms {
|
|
2596
|
+
/** Brand shown to subscribers. */
|
|
2597
|
+
merchant_name?: string;
|
|
2598
|
+
/** Recurring charge in minor units (1999 = $19.99). */
|
|
2599
|
+
amount?: number;
|
|
2600
|
+
/** Three-letter ISO currency code. */
|
|
2601
|
+
currency?: string;
|
|
2602
|
+
/** Billing interval. */
|
|
2603
|
+
interval?: "day" | "week" | "month" | "year";
|
|
2604
|
+
/** Intervals per charge (default 1). */
|
|
2605
|
+
interval_count?: number;
|
|
2606
|
+
/** Free-trial length in days (0 or absent: no trial). */
|
|
2607
|
+
trial_days?: number;
|
|
2608
|
+
/** https address where subscribers cancel online. */
|
|
2609
|
+
cancel_url?: string;
|
|
2610
|
+
/** When a cancellation takes effect (default period_end). */
|
|
2611
|
+
cancel_timing?: "period_end" | "immediately";
|
|
2612
|
+
}
|
|
2613
|
+
export interface DisclosureCreateParams {
|
|
2614
|
+
/** site_… the disclosure is for. */
|
|
2615
|
+
site: string;
|
|
2616
|
+
/** Price / plan id from the site's billing connection (Stripe price_…) when it offers several. */
|
|
2617
|
+
plan?: string;
|
|
2618
|
+
terms?: DisclosureTerms;
|
|
2619
|
+
}
|
|
2620
|
+
/** Proof that a subscriber affirmatively consented to the exact automatic-renewal terms shown. */
|
|
2621
|
+
export interface Consent {
|
|
2622
|
+
/** Unique identifier of the consent (cons_…). */
|
|
2623
|
+
id: string;
|
|
2624
|
+
/** String representing the object's type. Always "consent". */
|
|
2625
|
+
object: "consent";
|
|
2626
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
2627
|
+
livemode: boolean;
|
|
2628
|
+
/** When Checkbox recorded the consent. Unix timestamp in seconds. */
|
|
2629
|
+
created: number;
|
|
2630
|
+
/** Site the consent belongs to. */
|
|
2631
|
+
site: string;
|
|
2632
|
+
/** What the subscriber saw. */
|
|
2633
|
+
disclosure: {
|
|
2634
|
+
/** disc_… when a server-issued disclosure was shown. */
|
|
2635
|
+
id: string | null;
|
|
2636
|
+
/** Disclosure text shown. */
|
|
2637
|
+
text: string;
|
|
2638
|
+
/** Consent checkbox label shown. */
|
|
2639
|
+
consent_label: string;
|
|
2640
|
+
/** sha256 of the disclosure text. */
|
|
2641
|
+
sha256: string;
|
|
2642
|
+
/** sha256 of disclosure + "\n" + consent label (the hash Fixes uses). */
|
|
2643
|
+
texts_sha256: string;
|
|
2644
|
+
/** The texts equal Checkbox's locked wording for the terms (or the disclosure's). */
|
|
2645
|
+
matches_locked_text: boolean;
|
|
2646
|
+
};
|
|
2647
|
+
/** Terms the disclosure states (DisclosureTerms). */
|
|
2648
|
+
terms: Record<string, unknown>;
|
|
2649
|
+
/** Checkbox state. */
|
|
2650
|
+
checkbox: {
|
|
2651
|
+
/** Always true. */
|
|
2652
|
+
checked: boolean;
|
|
2653
|
+
/** The box was pre-ticked (consent then is not affirmative). */
|
|
2654
|
+
initially_checked: boolean;
|
|
2655
|
+
/** Ticking was required. */
|
|
2656
|
+
required: boolean;
|
|
2657
|
+
};
|
|
2658
|
+
/** Page of the consent. */
|
|
2659
|
+
page_url: string | null;
|
|
2660
|
+
/** Origin of the browser request (null for server-recorded consents). */
|
|
2661
|
+
origin: string | null;
|
|
2662
|
+
/** sha256 of the browser User-Agent header. */
|
|
2663
|
+
user_agent_sha256: string | null;
|
|
2664
|
+
/** Your subscriber reference (set once, by a secret key only: createConsent from your server or updateConsent). Browser-recorded consents start with null. */
|
|
2665
|
+
customer_reference: string | null;
|
|
2666
|
+
/** Reference the page sent with a publishable key (customer-reference attribute). Unverified: anyone holding the public key can send any value, so bind the real subscription with updateConsent from your server. */
|
|
2667
|
+
client_reference: string | null;
|
|
2668
|
+
/** elements: recorded by the browser element; api: by your server. */
|
|
2669
|
+
source: "elements" | "api";
|
|
2670
|
+
/** elements.js version. */
|
|
2671
|
+
element_version: string | null;
|
|
2672
|
+
/** Device time (unix seconds). */
|
|
2673
|
+
client_timestamp: number | null;
|
|
2674
|
+
/** On-screen measurement summary (null for server-recorded consents). */
|
|
2675
|
+
presentation: {
|
|
2676
|
+
/** Guard-rail violations measured on screen. */
|
|
2677
|
+
violations: Array<string>;
|
|
2678
|
+
/** Safe styles replaced the theme. */
|
|
2679
|
+
fallback_applied: boolean;
|
|
2680
|
+
/** Font size. */
|
|
2681
|
+
font_size_px: number | null;
|
|
2682
|
+
/** Contrast ratio. */
|
|
2683
|
+
contrast_ratio: number | null;
|
|
2684
|
+
/** Above the pay button. */
|
|
2685
|
+
above_submit: boolean | null;
|
|
2686
|
+
/** Gap to the pay button. */
|
|
2687
|
+
gap_px: number | null;
|
|
2688
|
+
/** Set off by a border. */
|
|
2689
|
+
boxed: boolean;
|
|
2690
|
+
/** Visible. */
|
|
2691
|
+
visible: boolean;
|
|
2692
|
+
} | null;
|
|
2693
|
+
/** Your key/value pairs. */
|
|
2694
|
+
metadata: Record<string, string>;
|
|
2695
|
+
/** rcpt_… consent receipt recorded with this consent (what the subscriber saw), when the element sent one. */
|
|
2696
|
+
receipt?: string | null;
|
|
2697
|
+
/** Tamper-evident evidence record (verify with verifyEvidenceChain). */
|
|
2698
|
+
evidence: {
|
|
2699
|
+
/** ev_… of the evidence record holding the full consent document. */
|
|
2700
|
+
id: string | null;
|
|
2701
|
+
/** sha256 of the evidence document. */
|
|
2702
|
+
sha256: string | null;
|
|
2703
|
+
/** Position in the site's hash chain. */
|
|
2704
|
+
chain_hash: string | null;
|
|
2705
|
+
};
|
|
2706
|
+
/** Page capture fed to the compliance evaluation from this consent, when a new one was stored. */
|
|
2707
|
+
corroborating_capture?: string | null;
|
|
2708
|
+
next_action: NextAction;
|
|
2709
|
+
}
|
|
2710
|
+
/** What <checkbox-disclosure> measured on screen (sent by the element). */
|
|
2711
|
+
export interface ConsentPresentationInput {
|
|
2712
|
+
/** Rendered disclosure font size. */
|
|
2713
|
+
font_size_px?: number | null;
|
|
2714
|
+
/** Page body font size. */
|
|
2715
|
+
body_font_size_px?: number;
|
|
2716
|
+
/** Minimum the element enforces. */
|
|
2717
|
+
min_font_size_px?: number;
|
|
2718
|
+
/** Rendered font weight. */
|
|
2719
|
+
font_weight?: number | null;
|
|
2720
|
+
/** Rendered text color. */
|
|
2721
|
+
color?: string | null;
|
|
2722
|
+
/** Effective background color. */
|
|
2723
|
+
background_color?: string | null;
|
|
2724
|
+
/** WCAG contrast ratio of the text. */
|
|
2725
|
+
contrast_ratio?: number | null;
|
|
2726
|
+
/** Cumulative opacity. */
|
|
2727
|
+
opacity?: number;
|
|
2728
|
+
/** The disclosure was visible. */
|
|
2729
|
+
visible?: boolean;
|
|
2730
|
+
/** The disclosure was set off by a border. */
|
|
2731
|
+
boxed?: boolean;
|
|
2732
|
+
/** The disclosure sat above the pay button. */
|
|
2733
|
+
above_submit?: boolean | null;
|
|
2734
|
+
/** Vertical gap to the pay button. */
|
|
2735
|
+
gap_px?: number | null;
|
|
2736
|
+
/** Disclosure box on the page. */
|
|
2737
|
+
rect?: {
|
|
2738
|
+
/** Page x (CSS px). */
|
|
2739
|
+
x: number;
|
|
2740
|
+
/** Page y (CSS px). */
|
|
2741
|
+
y: number;
|
|
2742
|
+
/** Width (CSS px). */
|
|
2743
|
+
width: number;
|
|
2744
|
+
/** Height (CSS px). */
|
|
2745
|
+
height: number;
|
|
2746
|
+
} | null;
|
|
2747
|
+
/** Pay button on the page. */
|
|
2748
|
+
submit_rect?: {
|
|
2749
|
+
/** Page x (CSS px). */
|
|
2750
|
+
x: number;
|
|
2751
|
+
/** Page y (CSS px). */
|
|
2752
|
+
y: number;
|
|
2753
|
+
/** Width (CSS px). */
|
|
2754
|
+
width: number;
|
|
2755
|
+
/** Height (CSS px). */
|
|
2756
|
+
height: number;
|
|
2757
|
+
} | null;
|
|
2758
|
+
/** Pay button label. */
|
|
2759
|
+
submit_text?: string | null;
|
|
2760
|
+
/** Viewport size. */
|
|
2761
|
+
viewport?: {
|
|
2762
|
+
/** Viewport width (CSS px). */
|
|
2763
|
+
width: number;
|
|
2764
|
+
/** Viewport height (CSS px). */
|
|
2765
|
+
height: number;
|
|
2766
|
+
} | null;
|
|
2767
|
+
/** Guard-rail violations the element detected. */
|
|
2768
|
+
violations?: Array<string>;
|
|
2769
|
+
/** The element replaced the theme with safe styles. */
|
|
2770
|
+
fallback_applied?: boolean;
|
|
2771
|
+
}
|
|
2772
|
+
export interface ConsentCreateParams {
|
|
2773
|
+
/** site_… the consent belongs to. Optional with a publishable key (resolved from the page Origin); required with a secret key. */
|
|
2774
|
+
site?: string;
|
|
2775
|
+
/** disc_… of the server-issued disclosure that was shown, if any. */
|
|
2776
|
+
disclosure?: string;
|
|
2777
|
+
terms: WithRequired<DisclosureTerms, "merchant_name" | "amount" | "currency" | "interval" | "cancel_url">;
|
|
2778
|
+
/** The exact disclosure text the subscriber saw. */
|
|
2779
|
+
disclosure_text: string;
|
|
2780
|
+
/** The exact label of the consent checkbox. */
|
|
2781
|
+
consent_label: string;
|
|
2782
|
+
/** Checkbox state. */
|
|
2783
|
+
checkbox: {
|
|
2784
|
+
/** The box was ticked when the consent was recorded (must be true). */
|
|
2785
|
+
checked: boolean;
|
|
2786
|
+
/** The box was ticked before the subscriber touched it (default false). */
|
|
2787
|
+
initially_checked?: boolean;
|
|
2788
|
+
/** Ticking the box was required to subscribe (default true). */
|
|
2789
|
+
required?: boolean;
|
|
2790
|
+
};
|
|
2791
|
+
/** Page the consent was given on (fragment removed). */
|
|
2792
|
+
page_url?: string;
|
|
2793
|
+
/** Your id for the subscriber: Stripe customer / Checkout Session / subscription id. Not an email address: no raw personal data is needed. */
|
|
2794
|
+
customer_reference?: string;
|
|
2795
|
+
/** Unix seconds on the subscriber's device (informational; `created` is the server time). */
|
|
2796
|
+
client_timestamp?: number;
|
|
2797
|
+
/** elements.js version that rendered the disclosure. */
|
|
2798
|
+
element_version?: string;
|
|
2799
|
+
presentation?: ConsentPresentationInput;
|
|
2800
|
+
/** Up to 20 key/value string pairs you can attach to the object. */
|
|
2801
|
+
metadata?: Record<string, string>;
|
|
2802
|
+
/** Consent receipt captured with the consent (sent by <checkbox-disclosure> 1.1+): recorded as a receipt linked to this consent. */
|
|
2803
|
+
receipt?: {
|
|
2804
|
+
/** Structured snapshot of the element and pay button at submit (see createReceipt). */
|
|
2805
|
+
snapshot: Record<string, unknown>;
|
|
2806
|
+
/** Capture token (rct_…) from createReceiptToken (the receipt-token attribute). */
|
|
2807
|
+
token?: string;
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
export interface ConsentUpdateParams {
|
|
2811
|
+
/** Attach your subscriber reference (only while none is set). */
|
|
2812
|
+
customer_reference?: string;
|
|
2813
|
+
/** Up to 20 key/value string pairs you can attach to the object. */
|
|
2814
|
+
metadata?: Record<string, string>;
|
|
2815
|
+
}
|
|
2816
|
+
/** A page of consents, newest first. */
|
|
2817
|
+
export interface ConsentList {
|
|
2818
|
+
/** String representing the object's type. Always "list". */
|
|
2819
|
+
object: "list";
|
|
2820
|
+
/** Consents, newest first. */
|
|
2821
|
+
data: Array<Consent>;
|
|
2822
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
2823
|
+
has_more: boolean;
|
|
2824
|
+
/** The URL of this list. */
|
|
2825
|
+
url: string;
|
|
2826
|
+
}
|
|
2827
|
+
/** A short-lived capture token that binds browser receipts to a checkout your server knows about. */
|
|
2828
|
+
export interface ReceiptToken {
|
|
2829
|
+
/** Unique identifier of the receipt token (rtok_…). */
|
|
2830
|
+
id: string;
|
|
2831
|
+
/** String representing the object's type. Always "receipt_token". */
|
|
2832
|
+
object: "receipt_token";
|
|
2833
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
2834
|
+
livemode: boolean;
|
|
2835
|
+
/** When the token was minted. Unix timestamp in seconds. */
|
|
2836
|
+
created: number;
|
|
2837
|
+
/** When the token stops binding receipts. Unix timestamp in seconds. */
|
|
2838
|
+
expires: number;
|
|
2839
|
+
/** Site the token is valid for. */
|
|
2840
|
+
site: string;
|
|
2841
|
+
/** The capture token. Returned only once: render it into the checkout page (data-receipt-token on the disclosure or form, or receipt-token on <checkbox-disclosure>). It is short-lived and only binds receipts, so it is safe in the page. */
|
|
2842
|
+
token: string;
|
|
2843
|
+
/** Copied onto bound receipts. */
|
|
2844
|
+
customer_reference: string | null;
|
|
2845
|
+
/** Stripe Checkout Session id, when given. */
|
|
2846
|
+
checkout_session: string | null;
|
|
2847
|
+
/** Receipts the token may bind. */
|
|
2848
|
+
max_uses: number;
|
|
2849
|
+
/** Ready-to-paste attribute for the disclosure region or form. */
|
|
2850
|
+
html_attribute: string;
|
|
2851
|
+
/** Your key/value pairs. */
|
|
2852
|
+
metadata: Record<string, string>;
|
|
2853
|
+
next_action: NextAction;
|
|
2854
|
+
}
|
|
2855
|
+
export interface ReceiptTokenCreateParams {
|
|
2856
|
+
/** site_… whose checkout page will present the token. */
|
|
2857
|
+
site: string;
|
|
2858
|
+
/** Your id for the subscriber (Stripe customer id, your user id, order id). Copied onto the receipt as the verified customer_reference. */
|
|
2859
|
+
customer_reference?: string;
|
|
2860
|
+
/** Stripe Checkout Session id when you already created it (links the Stripe record to this receipt). Or put the token id in the session's metadata.checkbox_receipt_token. */
|
|
2861
|
+
checkout_session?: string;
|
|
2862
|
+
/** The subscriber's email address; only an HMAC-SHA-256 under your account's own key is stored (listReceipts?email= finds receipts by it). Still personal data: covered by retention and eraseReceipts. */
|
|
2863
|
+
email?: string;
|
|
2864
|
+
/** Seconds until the token expires (default 3600). */
|
|
2865
|
+
expires_in?: number;
|
|
2866
|
+
/** Receipts the token may bind (default 1: the subscriber can read the token in the page, so mint one per checkout attempt; raise it for checkouts that legitimately submit several times). */
|
|
2867
|
+
max_uses?: number;
|
|
2868
|
+
/** Up to 20 key/value string pairs you can attach to the object. */
|
|
2869
|
+
metadata?: Record<string, string>;
|
|
2870
|
+
}
|
|
2871
|
+
/** The Checkout Session as Stripe recorded it (Stripe-hosted checkouts and Payment Links). */
|
|
2872
|
+
export type ReceiptStripeRecord = {
|
|
2873
|
+
/** Checkout Session id. */
|
|
2874
|
+
checkout_session: string;
|
|
2875
|
+
/** Payment Link id when the session came from one. */
|
|
2876
|
+
payment_link: string | null;
|
|
2877
|
+
/** When Stripe created the session (unix seconds). */
|
|
2878
|
+
session_created: number | null;
|
|
2879
|
+
/** When Stripe reported the session completed (unix seconds). */
|
|
2880
|
+
completed: number | null;
|
|
2881
|
+
/** consent_collection.terms_of_service on the session. */
|
|
2882
|
+
terms_of_service: "required" | "none" | "unknown";
|
|
2883
|
+
/** consent.terms_of_service === "accepted" as Stripe recorded it. */
|
|
2884
|
+
terms_of_service_accepted: boolean | null;
|
|
2885
|
+
/** Merchant text Stripe showed on the hosted page. */
|
|
2886
|
+
custom_text: {
|
|
2887
|
+
/** custom_text.submit.message. */
|
|
2888
|
+
submit: string | null;
|
|
2889
|
+
/** custom_text.terms_of_service_acceptance.message. */
|
|
2890
|
+
terms_of_service_acceptance: string | null;
|
|
2891
|
+
/** custom_text.after_submit.message. */
|
|
2892
|
+
after_submit: string | null;
|
|
2893
|
+
};
|
|
2894
|
+
/** Recurring price in minor units. */
|
|
2895
|
+
amount: number | null;
|
|
2896
|
+
/** Currency. */
|
|
2897
|
+
currency: string | null;
|
|
2898
|
+
/** Billing interval. */
|
|
2899
|
+
interval: string | null;
|
|
2900
|
+
/** Intervals per charge. */
|
|
2901
|
+
interval_count: number | null;
|
|
2902
|
+
/** Free-trial days. */
|
|
2903
|
+
trial_days: number | null;
|
|
2904
|
+
/** Subscription id. */
|
|
2905
|
+
subscription: string | null;
|
|
2906
|
+
} | null;
|
|
2907
|
+
/** A consent receipt: a tamper-evident record of what one subscriber saw next to the pay button and agreed to at checkout. Evidence you can produce; not a legal opinion. */
|
|
2908
|
+
export interface Receipt {
|
|
2909
|
+
/** Unique identifier of the receipt (rcpt_…). */
|
|
2910
|
+
id: string;
|
|
2911
|
+
/** String representing the object's type. Always "receipt". */
|
|
2912
|
+
object: "receipt";
|
|
2913
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
2914
|
+
livemode: boolean;
|
|
2915
|
+
/** When Checkbox recorded the receipt (server time). Unix timestamp in seconds. */
|
|
2916
|
+
created: number;
|
|
2917
|
+
/** Site the receipt belongs to. */
|
|
2918
|
+
site: string;
|
|
2919
|
+
/** elements: <checkbox-disclosure>; snippet: /r.js; api: your server; stripe_*: reconstructed from Stripe's record of a Stripe-hosted page. */
|
|
2920
|
+
source: "elements" | "snippet" | "api" | "stripe_checkout" | "stripe_payment_link";
|
|
2921
|
+
/** bound: the browser presented a valid capture token your server minted; unbound: no (valid) token, so the receipt is a client claim; server: recorded by your server or reconstructed from Stripe. */
|
|
2922
|
+
binding: "bound" | "unbound" | "server";
|
|
2923
|
+
/** true when built from Stripe's record instead of the page the subscriber saw (lower evidentiary weight). */
|
|
2924
|
+
reconstructed: boolean;
|
|
2925
|
+
/** How the record was obtained, strongest first. Not a legal assessment. */
|
|
2926
|
+
evidentiary_weight: "direct_capture" | "direct_capture_unbound" | "server_record" | "reconstructed_from_stripe";
|
|
2927
|
+
/** Disclosure detection. */
|
|
2928
|
+
detection: {
|
|
2929
|
+
/** How the disclosure region was found. */
|
|
2930
|
+
method: "elements" | "marked" | "auto" | "server" | "stripe";
|
|
2931
|
+
/** Confidence that the region is the disclosure. */
|
|
2932
|
+
confidence: "high" | "medium" | "low";
|
|
2933
|
+
};
|
|
2934
|
+
/** Verified subscriber reference (from the capture token, your server, or Stripe). */
|
|
2935
|
+
customer_reference: string | null;
|
|
2936
|
+
/** Reference the page claimed (unverified). */
|
|
2937
|
+
client_reference: string | null;
|
|
2938
|
+
/** HMAC-SHA-256 (keyed per account) of the subscriber's lowercased email, when your server gave one. Personal data: erased with the receipt. */
|
|
2939
|
+
email_sha256: string | null;
|
|
2940
|
+
/** Stripe Checkout Session id. */
|
|
2941
|
+
checkout_session: string | null;
|
|
2942
|
+
/** Subscription id, when known. */
|
|
2943
|
+
subscription: string | null;
|
|
2944
|
+
/** cons_… recorded with this receipt by <checkbox-disclosure>. */
|
|
2945
|
+
consent: string | null;
|
|
2946
|
+
/** For Stripe-hosted checkouts: the rcpt_… captured on your page before the redirect. */
|
|
2947
|
+
pre_checkout_receipt: string | null;
|
|
2948
|
+
/** Page (origin + path, query string removed). */
|
|
2949
|
+
page_url: string | null;
|
|
2950
|
+
/** Page / browser language. */
|
|
2951
|
+
language: string | null;
|
|
2952
|
+
/** Device + browser family (never the full user agent). */
|
|
2953
|
+
user_agent_class: string | null;
|
|
2954
|
+
/** Viewport at submit. */
|
|
2955
|
+
viewport: {
|
|
2956
|
+
/** CSS px. */
|
|
2957
|
+
width: number;
|
|
2958
|
+
/** CSS px. */
|
|
2959
|
+
height: number;
|
|
2960
|
+
} | null;
|
|
2961
|
+
/** Device clock at capture (unix seconds; informational). */
|
|
2962
|
+
client_timestamp: number | null;
|
|
2963
|
+
/** What the disclosure said and how it was shown. */
|
|
2964
|
+
disclosure: {
|
|
2965
|
+
/** Disclosure text the subscriber saw (personal data redacted). */
|
|
2966
|
+
text: string;
|
|
2967
|
+
/** SHA-256 of the text. */
|
|
2968
|
+
sha256: string;
|
|
2969
|
+
/** How the disclosure was presented (null fields: not measured). */
|
|
2970
|
+
presentation: {
|
|
2971
|
+
/** Rendered font size of the disclosure text. */
|
|
2972
|
+
font_size_px: number | null;
|
|
2973
|
+
/** Rendered font weight. */
|
|
2974
|
+
font_weight: number | null;
|
|
2975
|
+
/** Text color. */
|
|
2976
|
+
color: string | null;
|
|
2977
|
+
/** Effective background color. */
|
|
2978
|
+
background_color: string | null;
|
|
2979
|
+
/** WCAG contrast ratio of text over background. */
|
|
2980
|
+
contrast_ratio: number | null;
|
|
2981
|
+
/** The disclosure was visible. */
|
|
2982
|
+
visible: boolean | null;
|
|
2983
|
+
/** Set off from surrounding content (border or own background). */
|
|
2984
|
+
set_off: boolean | null;
|
|
2985
|
+
/** Fully inside the first screen of the page. */
|
|
2986
|
+
above_fold: boolean | null;
|
|
2987
|
+
/** Placed above the submit button. */
|
|
2988
|
+
above_submit: boolean | null;
|
|
2989
|
+
/** Gap between the disclosure and the submit button (CSS px). */
|
|
2990
|
+
distance_to_submit_px: number | null;
|
|
2991
|
+
};
|
|
2992
|
+
};
|
|
2993
|
+
/** The consent checkbox (null: none found). */
|
|
2994
|
+
checkbox: {
|
|
2995
|
+
/** A consent checkbox was found. */
|
|
2996
|
+
present: boolean;
|
|
2997
|
+
/** It was ticked at submit. */
|
|
2998
|
+
checked: boolean;
|
|
2999
|
+
/** Its label as captured. Null for receipts reconstructed from Stripe: Stripe's record has no checkbox wording, so none is claimed. */
|
|
3000
|
+
label: string | null;
|
|
3001
|
+
/** It was required. */
|
|
3002
|
+
required: boolean;
|
|
3003
|
+
} | null;
|
|
3004
|
+
/** Label of the button the subscriber pressed (null when not observed, e.g. Stripe-hosted pages). */
|
|
3005
|
+
submit_label: string | null;
|
|
3006
|
+
stripe: ReceiptStripeRecord;
|
|
3007
|
+
/** Things a reviewer should know: unbound, token_invalid, token_expired, token_used_up, token_site_mismatch, low_confidence_detection, disclosure_not_found, below_fold, not_above_submit, far_from_submit, low_contrast, small_font, hidden, hidden_text (text was present but not visibly rendered; left out), typed_text_masked, checkbox_unchecked, no_consent_checkbox, client_clock_skew, implausible_render_gap, reconstructed, no_pre_checkout_snapshot, linked_by_client_nonce, multiple_pre_checkout_candidates, stripe_mode_mismatch, no_terms_of_service_consent, no_custom_text, test_mode, unsigned. */
|
|
3008
|
+
flags: Array<string>;
|
|
3009
|
+
/** Tamper evidence. verifyReceipt checks all of it. */
|
|
3010
|
+
integrity: {
|
|
3011
|
+
/** SHA-256 of the canonical JSON receipt (keys sorted, no whitespace) — also the evidence record's content hash. */
|
|
3012
|
+
receipt_sha256: string;
|
|
3013
|
+
/** ev_… record that chains the receipt into the site's evidence vault. */
|
|
3014
|
+
evidence: string | null;
|
|
3015
|
+
/** Chain hash of that record. */
|
|
3016
|
+
chain_hash: string | null;
|
|
3017
|
+
/** Ed25519 key that signed the receipt (published at /.well-known/checkbox-keys.json). */
|
|
3018
|
+
public_key_id: string | null;
|
|
3019
|
+
/** When it was signed (unix seconds). */
|
|
3020
|
+
signed: number | null;
|
|
3021
|
+
};
|
|
3022
|
+
/** When the receipt is deleted under your retention setting. Unix timestamp in seconds. */
|
|
3023
|
+
retain_until: number;
|
|
3024
|
+
/** PNG of what the subscriber saw, re-rendered from the snapshot (renderReceipt, same auth). */
|
|
3025
|
+
render_url: string;
|
|
3026
|
+
next_action: NextAction;
|
|
3027
|
+
}
|
|
3028
|
+
export interface ReceiptCreateParams {
|
|
3029
|
+
/** site_… the receipt belongs to. Optional with a publishable key (resolved from the page Origin); required with a secret key. */
|
|
3030
|
+
site?: string;
|
|
3031
|
+
/** The structured snapshot captured by /r.js or <checkbox-disclosure> (version 1): the disclosure region's text, sanitized subtree and computed styles, the consent checkbox state and label, the submit label, layout, viewport, page URL without query string, language and user-agent class. Validated strictly and re-sanitized by the server; it never contains form-field values. */
|
|
3032
|
+
snapshot: Record<string, unknown>;
|
|
3033
|
+
/** Capture token (rct_…) your server minted for this checkout with createReceiptToken. Binds the receipt to that checkout; without it the receipt is accepted but flagged "unbound". */
|
|
3034
|
+
token?: string;
|
|
3035
|
+
/** A reference the page claims for the subscriber (unverified; kept apart from customer_reference). */
|
|
3036
|
+
client_reference?: string;
|
|
3037
|
+
/** Random nonce the snippet also put in a Payment Link's client_reference_id (ckbx_<nonce>), linking this pre-checkout snapshot to the Stripe record. */
|
|
3038
|
+
capture_nonce?: string;
|
|
3039
|
+
/** Secret keys only: your id for the subscriber (Stripe customer / subscription / Checkout Session id). Not an email address. */
|
|
3040
|
+
customer_reference?: string;
|
|
3041
|
+
/** Secret keys only: the Stripe Checkout Session id this receipt belongs to. */
|
|
3042
|
+
checkout_session?: string;
|
|
3043
|
+
/** Secret keys only: the subscriber's email address. Only an HMAC-SHA-256 of it (lowercased, trimmed; keyed per account) is stored. */
|
|
3044
|
+
email?: string;
|
|
3045
|
+
}
|
|
3046
|
+
/** A page of receipts, newest first. */
|
|
3047
|
+
export interface ReceiptList {
|
|
3048
|
+
/** String representing the object's type. Always "list". */
|
|
3049
|
+
object: "list";
|
|
3050
|
+
/** Receipts, newest first. */
|
|
3051
|
+
data: Array<Receipt>;
|
|
3052
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
3053
|
+
has_more: boolean;
|
|
3054
|
+
/** The URL of this list. */
|
|
3055
|
+
url: string;
|
|
3056
|
+
}
|
|
3057
|
+
/** Result of erasing a subscriber's receipts. */
|
|
3058
|
+
export interface ReceiptErasure {
|
|
3059
|
+
/** String representing the object's type. Always "receipt_erasure". */
|
|
3060
|
+
object: "receipt_erasure";
|
|
3061
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
3062
|
+
livemode: boolean;
|
|
3063
|
+
/** Receipts deleted. Their signed copies in the evidence vault remain but hold only a salted commitment to the identifiers, which can no longer be opened. */
|
|
3064
|
+
erased: number;
|
|
3065
|
+
}
|
|
3066
|
+
export interface ReceiptErasureParams {
|
|
3067
|
+
/** Erase receipts with this customer_reference. */
|
|
3068
|
+
customer_reference?: string;
|
|
3069
|
+
/** Erase receipts recorded with this email (hashed before the lookup). */
|
|
3070
|
+
email?: string;
|
|
3071
|
+
/** Erase receipts of this Stripe Checkout Session. */
|
|
3072
|
+
checkout_session?: string;
|
|
3073
|
+
/** Only this site_…. */
|
|
3074
|
+
site?: string;
|
|
3075
|
+
}
|
|
3076
|
+
/** Result of re-checking a receipt's hash, signature and evidence chain. */
|
|
3077
|
+
export interface ReceiptVerification {
|
|
3078
|
+
/** String representing the object's type. Always "receipt_verification". */
|
|
3079
|
+
object: "receipt_verification";
|
|
3080
|
+
/** Unique identifier of the receipt (rcpt_…). */
|
|
3081
|
+
receipt: string;
|
|
3082
|
+
/** Every check passed. */
|
|
3083
|
+
verified: boolean;
|
|
3084
|
+
/** Individual checks. */
|
|
3085
|
+
checks: {
|
|
3086
|
+
/** Content hash. */
|
|
3087
|
+
content: {
|
|
3088
|
+
/** The stored receipt hashes to receipt_sha256. */
|
|
3089
|
+
ok: boolean;
|
|
3090
|
+
/** Detail. */
|
|
3091
|
+
message: string;
|
|
3092
|
+
};
|
|
3093
|
+
/** Signature. */
|
|
3094
|
+
signature: {
|
|
3095
|
+
/** Checkbox's Ed25519 signature over the receipt hash verifies. */
|
|
3096
|
+
ok: boolean;
|
|
3097
|
+
/** Detail. */
|
|
3098
|
+
message: string;
|
|
3099
|
+
};
|
|
3100
|
+
/** Hash chain. */
|
|
3101
|
+
chain: {
|
|
3102
|
+
/** The site's evidence chain (which includes the receipt) verifies end to end. */
|
|
3103
|
+
ok: boolean;
|
|
3104
|
+
/** Detail. */
|
|
3105
|
+
message: string;
|
|
3106
|
+
};
|
|
3107
|
+
/** Shown values vs. the signed document. */
|
|
3108
|
+
index: {
|
|
3109
|
+
/** What this API, the dashboard, the image and the bundle show (binding, source, text, snapshot, flags, identifiers) matches the signed document. */
|
|
3110
|
+
ok: boolean;
|
|
3111
|
+
/** Detail (index_mismatch names the fields that differ). */
|
|
3112
|
+
message: string;
|
|
3113
|
+
/** Identifiers attached after signing (e.g. checkout_session once Stripe confirmed the checkout): not covered by the signature. */
|
|
3114
|
+
linked_after_signing: Array<string>;
|
|
3115
|
+
};
|
|
3116
|
+
};
|
|
3117
|
+
/** The receipt hash that was checked. */
|
|
3118
|
+
receipt_sha256: string;
|
|
3119
|
+
/** When the check ran. Unix timestamp in seconds. */
|
|
3120
|
+
verified_at: number;
|
|
3121
|
+
/** How to verify without Checkbox: download exportReceipt and run its verify.mjs. */
|
|
3122
|
+
offline: string;
|
|
3123
|
+
}
|
|
3124
|
+
/** Consent-receipt collection and retention for the account (per mode). */
|
|
3125
|
+
export interface ReceiptSettings {
|
|
3126
|
+
/** String representing the object's type. Always "receipt_settings". */
|
|
3127
|
+
object: "receipt_settings";
|
|
3128
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
3129
|
+
livemode: boolean;
|
|
3130
|
+
/** Receipts are collected. Off by default: turn on after adding the receipts paragraph to your privacy policy (browser receipts answer 403 receipts_disabled when off; Elements consents are recorded without a receipt). */
|
|
3131
|
+
enabled: boolean;
|
|
3132
|
+
/** Days a receipt is kept (default 1461 = 4 years: the California Unfair Competition Law limitation period; pending attorney review). */
|
|
3133
|
+
retention_days: number;
|
|
3134
|
+
/** Last change. Unix timestamp in seconds. */
|
|
3135
|
+
updated: number | null;
|
|
3136
|
+
}
|
|
3137
|
+
export interface ReceiptSettingsUpdateParams {
|
|
3138
|
+
/** Turn receipt collection on or off. */
|
|
3139
|
+
enabled?: boolean;
|
|
3140
|
+
/** Days to keep receipts (30–3653). Applies to new receipts. */
|
|
3141
|
+
retention_days?: number;
|
|
3142
|
+
}
|
|
3143
|
+
/** A billing-platform TEST-mode key Checkbox uses for synthetic test subscriptions. Stored encrypted; never live mode. */
|
|
3144
|
+
export interface TestCredential {
|
|
3145
|
+
/** Unique identifier of the test credential (tcred_…). */
|
|
3146
|
+
id: string;
|
|
3147
|
+
/** String representing the object's type. Always "test_credential". */
|
|
3148
|
+
object: "test_credential";
|
|
3149
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
3150
|
+
livemode: boolean;
|
|
3151
|
+
/** The site the key belongs to. */
|
|
3152
|
+
site: string;
|
|
3153
|
+
/** Kind of key. Always "stripe_test" (a Stripe TEST-mode restricted or secret key). */
|
|
3154
|
+
type: "stripe_test";
|
|
3155
|
+
/** The key's prefix and last four characters; the key itself is never returned. */
|
|
3156
|
+
key_hint: string;
|
|
3157
|
+
/** Whether Stripe accepted the key when it was stored. */
|
|
3158
|
+
verified: boolean;
|
|
3159
|
+
/** When a test run last used the key. Unix timestamp in seconds. */
|
|
3160
|
+
last_used: number | null;
|
|
3161
|
+
/** Last error Stripe returned for the key, if any. */
|
|
3162
|
+
last_error: string | null;
|
|
3163
|
+
/** When the key was stored. Unix timestamp in seconds. */
|
|
3164
|
+
created: number;
|
|
3165
|
+
}
|
|
3166
|
+
/** A page of stored test-mode keys. */
|
|
3167
|
+
export interface TestCredentialList {
|
|
3168
|
+
/** String representing the object's type. Always "list". */
|
|
3169
|
+
object: "list";
|
|
3170
|
+
/** Stored test-mode keys. */
|
|
3171
|
+
data: Array<TestCredential>;
|
|
3172
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
3173
|
+
has_more: boolean;
|
|
3174
|
+
/** The URL of this list. */
|
|
3175
|
+
url: string;
|
|
3176
|
+
}
|
|
3177
|
+
/** A deleted test credential. */
|
|
3178
|
+
export interface DeletedTestCredential {
|
|
3179
|
+
/** Unique identifier of the test credential (tcred_…). */
|
|
3180
|
+
id: string;
|
|
3181
|
+
/** String representing the deleted object's type. Always "test_credential". */
|
|
3182
|
+
object: "test_credential";
|
|
3183
|
+
/** Always true. */
|
|
3184
|
+
deleted: true;
|
|
3185
|
+
}
|
|
3186
|
+
/** Checkout Session parameters your code uses, registered so test runs mirror exactly your checkout into Stripe test mode. */
|
|
3187
|
+
export interface StripeCheckoutConfig {
|
|
3188
|
+
/** Unique identifier of the stripe checkout config (scc_…). */
|
|
3189
|
+
id: string;
|
|
3190
|
+
/** String representing the object's type. Always "stripe_checkout_config". */
|
|
3191
|
+
object: "stripe_checkout_config";
|
|
3192
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
3193
|
+
livemode: boolean;
|
|
3194
|
+
/** The site the config belongs to. */
|
|
3195
|
+
site: string;
|
|
3196
|
+
/** Your name for the config. */
|
|
3197
|
+
name: string | null;
|
|
3198
|
+
/** The mirrored Checkout Session parameters (the subset of what your code passes to stripe.checkout.sessions.create that shapes what customers see). */
|
|
3199
|
+
params: Record<string, unknown>;
|
|
3200
|
+
/** sha256 of the canonical params; changes whenever the registered parameters change. */
|
|
3201
|
+
params_hash: string;
|
|
3202
|
+
/** Parameters that were dropped because they are not mirrored (customer, URLs, metadata…). */
|
|
3203
|
+
ignored_params: Array<string>;
|
|
3204
|
+
/** Up to 20 key/value string pairs you can attach to the object. */
|
|
3205
|
+
metadata: Record<string, string>;
|
|
3206
|
+
/** When the config was registered. Unix timestamp in seconds. */
|
|
3207
|
+
created: number;
|
|
3208
|
+
}
|
|
3209
|
+
/** A page of registered checkout configs, newest first. */
|
|
3210
|
+
export interface StripeCheckoutConfigList {
|
|
3211
|
+
/** String representing the object's type. Always "list". */
|
|
3212
|
+
object: "list";
|
|
3213
|
+
/** Registered checkout configs, newest first. */
|
|
3214
|
+
data: Array<StripeCheckoutConfig>;
|
|
3215
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
3216
|
+
has_more: boolean;
|
|
3217
|
+
/** The URL of this list. */
|
|
3218
|
+
url: string;
|
|
3219
|
+
}
|
|
3220
|
+
/** A deleted stripe checkout config. */
|
|
3221
|
+
export interface DeletedStripeCheckoutConfig {
|
|
3222
|
+
/** Unique identifier of the stripe checkout config (scc_…). */
|
|
3223
|
+
id: string;
|
|
3224
|
+
/** String representing the deleted object's type. Always "stripe_checkout_config". */
|
|
3225
|
+
object: "stripe_checkout_config";
|
|
3226
|
+
/** Always true. */
|
|
3227
|
+
deleted: true;
|
|
3228
|
+
}
|
|
3229
|
+
/** How to fix a failing check. */
|
|
3230
|
+
export type TestRunRemediation = {
|
|
3231
|
+
/** What the law requires and what to change. */
|
|
3232
|
+
summary: string;
|
|
3233
|
+
/** Steps to fix it. */
|
|
3234
|
+
steps: Array<string>;
|
|
3235
|
+
/** Compliant copy to use, when there is one. */
|
|
3236
|
+
suggested_copy: string | null;
|
|
3237
|
+
/** Code that applies the fix, when there is one. */
|
|
3238
|
+
snippet: {
|
|
3239
|
+
/** Language of the code. */
|
|
3240
|
+
language: string;
|
|
3241
|
+
/** Code that applies the fix. */
|
|
3242
|
+
code: string;
|
|
3243
|
+
} | null;
|
|
3244
|
+
} | null;
|
|
3245
|
+
/** An agent-readable fix: what to change, where, and how to verify (run again). */
|
|
3246
|
+
export type TestRunFix = {
|
|
3247
|
+
/** What to change, in one sentence. */
|
|
3248
|
+
summary: string;
|
|
3249
|
+
/** Ordered instructions for the builder's agent. */
|
|
3250
|
+
steps: Array<string>;
|
|
3251
|
+
/** Where the change goes (Stripe Dashboard URL, file, component). */
|
|
3252
|
+
where?: string;
|
|
3253
|
+
/** API call that applies or retries the fix (SDK method name). */
|
|
3254
|
+
operation_id?: string;
|
|
3255
|
+
/** Exact Stripe parameters to use, when the fix is a Stripe setting or object. */
|
|
3256
|
+
stripe_params?: Record<string, unknown>;
|
|
3257
|
+
/** Shell command that applies the fix (Stripe CLI), when there is one. */
|
|
3258
|
+
command?: string;
|
|
3259
|
+
/** Documentation for the fix. */
|
|
3260
|
+
docs_url?: string;
|
|
3261
|
+
} | null;
|
|
3262
|
+
/** One observed lifecycle step of a test run. */
|
|
3263
|
+
export interface TestRunStep {
|
|
3264
|
+
/** Stable step key: credentials, checkout_config, checkout_page, subscribe, acknowledgment_email, trial_reminder, renewal, cancel_online, cancellation_email, cleanup. */
|
|
3265
|
+
key: string;
|
|
3266
|
+
/** Human-readable step title. */
|
|
3267
|
+
title: string;
|
|
3268
|
+
/** passed: observed and compliant; failed: a check failed or the step broke the run; warning: could not be fully observed (see code and fix); skipped: not applicable or turned off. */
|
|
3269
|
+
status: "pending" | "running" | "passed" | "failed" | "warning" | "skipped";
|
|
3270
|
+
/** What was observed, in one or two sentences. */
|
|
3271
|
+
summary: string | null;
|
|
3272
|
+
/** When the step started. Unix timestamp in seconds. */
|
|
3273
|
+
started: number | null;
|
|
3274
|
+
/** When the step finished. Unix timestamp in seconds. */
|
|
3275
|
+
finished: number | null;
|
|
3276
|
+
/** Checks this step produces evidence for. */
|
|
3277
|
+
check_ids: Array<string>;
|
|
3278
|
+
/** Check results judged from this run's observations (test-clock time). */
|
|
3279
|
+
checks: Array<{
|
|
3280
|
+
/** Machine check id (see listRules / the legal catalog). */
|
|
3281
|
+
check_id: string;
|
|
3282
|
+
/** pass, fail, needs_review or not_applicable, judged from this run's observations. */
|
|
3283
|
+
status: string;
|
|
3284
|
+
/** What was observed. */
|
|
3285
|
+
message: string;
|
|
3286
|
+
/** critical, high, medium or low. */
|
|
3287
|
+
severity: string | null;
|
|
3288
|
+
remediation: TestRunRemediation;
|
|
3289
|
+
}>;
|
|
3290
|
+
/** Step-specific facts: URLs, ids, timings (e.g. sent_days_before for reminders), hashes. */
|
|
3291
|
+
observations: Record<string, unknown>;
|
|
3292
|
+
/** Evidence records (screenshots, page captures, raw emails) behind the step. */
|
|
3293
|
+
evidence: Array<string>;
|
|
3294
|
+
/** Warning or failure code of the step (stable): key_missing, key_not_test_mode, key_invalid, key_permission_missing, checkout_config_missing, price_not_in_test_mode, checkout_session_failed, checkout_page_unreadable, checkout_not_completed, subscription_create_failed, test_clock_failed, no_email_received_within, reminder_not_received, portal_not_configured, cancel_not_completed, cancellation_email_not_received, scan_config_missing, domain_not_verified, scanner_failed, stripe_api_error, timeout, canceled, internal_error. */
|
|
3295
|
+
code: string | null;
|
|
3296
|
+
fix: TestRunFix;
|
|
3297
|
+
}
|
|
3298
|
+
/** A synthetic test subscription that observes the whole subscription lifecycle in test mode and reports each step with evidence, check results and fixes. */
|
|
3299
|
+
export interface TestRun {
|
|
3300
|
+
/** Unique identifier of the test run (run_…). */
|
|
3301
|
+
id: string;
|
|
3302
|
+
/** String representing the object's type. Always "test_run". */
|
|
3303
|
+
object: "test_run";
|
|
3304
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
3305
|
+
livemode: boolean;
|
|
3306
|
+
/** The site under test. */
|
|
3307
|
+
site: string;
|
|
3308
|
+
/** stripe: Stripe test mode with a test clock; generic: any site with a test coupon / test account (no time travel). */
|
|
3309
|
+
type: "stripe" | "generic";
|
|
3310
|
+
/** succeeded means the run finished (steps may still have failing checks); failed means it stopped early (see failure). */
|
|
3311
|
+
status: "queued" | "running" | "succeeded" | "failed" | "canceled";
|
|
3312
|
+
/** Internal phase (prepare, checkout, await_ack, advance, settle, cancel, await_cancel_email, finalize, done). */
|
|
3313
|
+
phase: string;
|
|
3314
|
+
/** Always true: runs use the billing platform's test mode; nothing is charged. */
|
|
3315
|
+
test_mode: true;
|
|
3316
|
+
/** Email address of the synthetic test subscriber; mail sent there is captured as evidence. */
|
|
3317
|
+
inbox_address: string;
|
|
3318
|
+
/** When the run was created. Unix timestamp in seconds. */
|
|
3319
|
+
created: number;
|
|
3320
|
+
/** When the worker started it. Unix timestamp in seconds. */
|
|
3321
|
+
started: number | null;
|
|
3322
|
+
/** When it finished. Unix timestamp in seconds. */
|
|
3323
|
+
finished: number | null;
|
|
3324
|
+
/** Lifecycle steps in order. */
|
|
3325
|
+
steps: Array<TestRunStep>;
|
|
3326
|
+
/** Why the run stopped (failed / canceled runs). */
|
|
3327
|
+
failure: {
|
|
3328
|
+
/** Stable failure code: key_missing, key_not_test_mode, key_invalid, key_permission_missing, checkout_config_missing, price_not_in_test_mode, checkout_session_failed, checkout_page_unreadable, checkout_not_completed, subscription_create_failed, test_clock_failed, no_email_received_within, reminder_not_received, portal_not_configured, cancel_not_completed, cancellation_email_not_received, scan_config_missing, domain_not_verified, scanner_failed, stripe_api_error, timeout, canceled, internal_error. */
|
|
3329
|
+
code: string;
|
|
3330
|
+
/** What went wrong. */
|
|
3331
|
+
message: string;
|
|
3332
|
+
/** Code-specific details (e.g. prices: the exact parameters to create in test mode). */
|
|
3333
|
+
detail: Record<string, unknown>;
|
|
3334
|
+
fix: TestRunFix;
|
|
3335
|
+
} | null;
|
|
3336
|
+
/** Outcome of a finished run. */
|
|
3337
|
+
result: {
|
|
3338
|
+
/** Compliance score (0-100) of the observed steps alone. */
|
|
3339
|
+
score: number | null;
|
|
3340
|
+
/** Counts. */
|
|
3341
|
+
summary: {
|
|
3342
|
+
/** Checks that passed. */
|
|
3343
|
+
passed: number;
|
|
3344
|
+
/** Checks that failed. */
|
|
3345
|
+
failed: number;
|
|
3346
|
+
/** Checks that need review. */
|
|
3347
|
+
needs_review: number;
|
|
3348
|
+
/** Steps that could not be fully observed. */
|
|
3349
|
+
warnings: number;
|
|
3350
|
+
};
|
|
3351
|
+
/** Every check result of the run. */
|
|
3352
|
+
checks: Array<{
|
|
3353
|
+
/** Check id. */
|
|
3354
|
+
check_id: string;
|
|
3355
|
+
/** Result. */
|
|
3356
|
+
status: string;
|
|
3357
|
+
/** Step key that observed it. */
|
|
3358
|
+
step: string;
|
|
3359
|
+
}>;
|
|
3360
|
+
/** What the run added to the site's continuous monitoring (provenance test_run). */
|
|
3361
|
+
monitoring: {
|
|
3362
|
+
/** The scanned checkout counts in continuous monitoring (mirrored config matches live). */
|
|
3363
|
+
checkout_page_counted: boolean;
|
|
3364
|
+
/** The cancellation flow counts in continuous monitoring. */
|
|
3365
|
+
cancellation_flow_counted: boolean;
|
|
3366
|
+
/** Emails added to the site's evidence (labelled test_run). */
|
|
3367
|
+
emails_counted: number;
|
|
3368
|
+
/** Reminder occasions added with their observed timing. */
|
|
3369
|
+
reminder_events: number;
|
|
3370
|
+
/** Why something was kept in the run report only. */
|
|
3371
|
+
notes: Array<string>;
|
|
3372
|
+
};
|
|
3373
|
+
} | null;
|
|
3374
|
+
/** Stripe test-mode objects of the run (type stripe). */
|
|
3375
|
+
stripe: {
|
|
3376
|
+
/** Stripe test clock (deleted at the end). */
|
|
3377
|
+
test_clock: string | null;
|
|
3378
|
+
/** Test customer (the synthetic subscriber). */
|
|
3379
|
+
customer: string | null;
|
|
3380
|
+
/** Test subscription. */
|
|
3381
|
+
subscription: string | null;
|
|
3382
|
+
/** Mirrored test-mode Checkout Session. */
|
|
3383
|
+
checkout_session: string | null;
|
|
3384
|
+
/** Where the checkout configuration came from. */
|
|
3385
|
+
mirrored_from: "registered" | "live" | "request" | null;
|
|
3386
|
+
/** Registered config used (scc_…). */
|
|
3387
|
+
checkout_config: string | null;
|
|
3388
|
+
/** Compliance fingerprint of the mirrored checkout. */
|
|
3389
|
+
config_hash: string | null;
|
|
3390
|
+
/** Whether the mirrored checkout matches your latest live checkout (null: no live connection to compare). */
|
|
3391
|
+
matches_live: boolean | null;
|
|
3392
|
+
/** Whether the test clock (with its customer and subscription) was deleted. */
|
|
3393
|
+
cleaned_up: boolean;
|
|
3394
|
+
} | null;
|
|
3395
|
+
next_action: NextAction;
|
|
3396
|
+
}
|
|
3397
|
+
/** A page of test runs, newest first. */
|
|
3398
|
+
export interface TestRunList {
|
|
3399
|
+
/** String representing the object's type. Always "list". */
|
|
3400
|
+
object: "list";
|
|
3401
|
+
/** Test runs, newest first. */
|
|
3402
|
+
data: Array<TestRun>;
|
|
3403
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
3404
|
+
has_more: boolean;
|
|
3405
|
+
/** The URL of this list. */
|
|
3406
|
+
url: string;
|
|
3407
|
+
}
|
|
3408
|
+
/** Where Checkbox sends signed event notifications (Checkbox-Signature: t=…,v1=…). */
|
|
3409
|
+
export interface WebhookEndpoint {
|
|
3410
|
+
/** Unique identifier of the webhook endpoint (we_…). */
|
|
3411
|
+
id: string;
|
|
3412
|
+
/** String representing the object's type. Always "webhook_endpoint". */
|
|
3413
|
+
object: "webhook_endpoint";
|
|
3414
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
3415
|
+
livemode: boolean;
|
|
3416
|
+
/** HTTPS URL Checkbox POSTs events to. */
|
|
3417
|
+
url: string;
|
|
3418
|
+
/** Your description. */
|
|
3419
|
+
description: string | null;
|
|
3420
|
+
/** Event types sent to this endpoint ("*" = all). */
|
|
3421
|
+
enabled_events: Array<string>;
|
|
3422
|
+
/** Disabled endpoints receive nothing. */
|
|
3423
|
+
status: "enabled" | "disabled";
|
|
3424
|
+
/** API version events are rendered with. */
|
|
3425
|
+
api_version: string;
|
|
3426
|
+
/** Up to 20 key/value string pairs you can attach to the object. */
|
|
3427
|
+
metadata: Record<string, string>;
|
|
3428
|
+
/** Signing secret (whsec_…). Only returned when the endpoint is created or the secret is rolled; store it. */
|
|
3429
|
+
secret?: string;
|
|
3430
|
+
/** When the endpoint was created. Unix timestamp in seconds. */
|
|
3431
|
+
created: number;
|
|
3432
|
+
}
|
|
3433
|
+
/** A page of webhook endpoints, newest first. */
|
|
3434
|
+
export interface WebhookEndpointList {
|
|
3435
|
+
/** String representing the object's type. Always "list". */
|
|
3436
|
+
object: "list";
|
|
3437
|
+
/** Webhook endpoints, newest first. */
|
|
3438
|
+
data: Array<WebhookEndpoint>;
|
|
3439
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
3440
|
+
has_more: boolean;
|
|
3441
|
+
/** The URL of this list. */
|
|
3442
|
+
url: string;
|
|
3443
|
+
}
|
|
3444
|
+
/** A deleted webhook endpoint. */
|
|
3445
|
+
export interface DeletedWebhookEndpoint {
|
|
3446
|
+
/** Unique identifier of the webhook endpoint (we_…). */
|
|
3447
|
+
id: string;
|
|
3448
|
+
/** String representing the deleted object's type. Always "webhook_endpoint". */
|
|
3449
|
+
object: "webhook_endpoint";
|
|
3450
|
+
/** Always true. */
|
|
3451
|
+
deleted: true;
|
|
3452
|
+
}
|
|
3453
|
+
/** Something that happened in the account. Delivered to webhook endpoints and listed by listEvents (kept 30 days). */
|
|
3454
|
+
export interface Event {
|
|
3455
|
+
/** Unique identifier of the event (evt_…). */
|
|
3456
|
+
id: string;
|
|
3457
|
+
/** String representing the object's type. Always "event". */
|
|
3458
|
+
object: "event";
|
|
3459
|
+
/** Event type: site.score_changed, site.insurable_changed, finding.created, finding.resolved, scan.completed, scan.failed, law.changed, certificate.issued, certificate.lapsed, certificate.revoked, notice.sent, notice.due, notice.overdue, consent.created, receipt.created, test_run.completed, test_run.failed, plan.updated, site.compliant, task.verified. */
|
|
3460
|
+
type: string;
|
|
3461
|
+
/** API version used to render data.object. */
|
|
3462
|
+
api_version: string;
|
|
3463
|
+
/** When the event happened. Unix timestamp in seconds. */
|
|
3464
|
+
created: number;
|
|
3465
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
3466
|
+
livemode: boolean;
|
|
3467
|
+
/** Event payload. */
|
|
3468
|
+
data: {
|
|
3469
|
+
/** The object the event is about (a site, finding, scan, certificate, law_update or notice), as the API returns it. */
|
|
3470
|
+
object: Record<string, unknown>;
|
|
3471
|
+
/** For *_changed events: the previous values of the changed fields. */
|
|
3472
|
+
previous_attributes?: Record<string, unknown>;
|
|
3473
|
+
};
|
|
3474
|
+
/** Webhook deliveries not yet acknowledged. */
|
|
3475
|
+
pending_webhooks: number;
|
|
3476
|
+
/** What caused the event. */
|
|
3477
|
+
request: {
|
|
3478
|
+
/** API request that caused the event (null for automatic changes). */
|
|
3479
|
+
id: string | null;
|
|
3480
|
+
/** Idempotency-Key of that request. */
|
|
3481
|
+
idempotency_key: string | null;
|
|
3482
|
+
};
|
|
3483
|
+
}
|
|
3484
|
+
/** A page of events, newest first. */
|
|
3485
|
+
export interface EventList {
|
|
3486
|
+
/** String representing the object's type. Always "list". */
|
|
3487
|
+
object: "list";
|
|
3488
|
+
/** Events, newest first. */
|
|
3489
|
+
data: Array<Event>;
|
|
3490
|
+
/** Whether more items exist after this page. Pass the last id as starting_after to fetch them. */
|
|
3491
|
+
has_more: boolean;
|
|
3492
|
+
/** The URL of this list. */
|
|
3493
|
+
url: string;
|
|
3494
|
+
}
|
|
3495
|
+
/** Feedback sent to the Checkbox team. */
|
|
3496
|
+
export interface Feedback {
|
|
3497
|
+
/** Unique identifier of the feedback (fb_…). */
|
|
3498
|
+
id: string;
|
|
3499
|
+
/** String representing the object's type. Always "feedback". */
|
|
3500
|
+
object: "feedback";
|
|
3501
|
+
/** Kind of feedback. */
|
|
3502
|
+
type: "bug" | "idea" | "question";
|
|
3503
|
+
/** open until Checkbox staff reply or close it. */
|
|
3504
|
+
status: "open" | "replied" | "closed";
|
|
3505
|
+
/** When it was received. Unix timestamp in seconds. */
|
|
3506
|
+
created: number;
|
|
3507
|
+
}
|
|
3508
|
+
export interface FeedbackParams {
|
|
3509
|
+
/** bug: something is broken; idea: a missing feature or improvement; question: something unclear. Default idea. */
|
|
3510
|
+
type?: "bug" | "idea" | "question";
|
|
3511
|
+
/** What you tried, what happened and what you expected (at most 5000 characters). */
|
|
3512
|
+
message: string;
|
|
3513
|
+
/** Optional context that helps us reproduce it. */
|
|
3514
|
+
context?: {
|
|
3515
|
+
/** Site id the feedback is about. */
|
|
3516
|
+
site?: string;
|
|
3517
|
+
/** Request-Id of the API call it is about. */
|
|
3518
|
+
request_id?: string;
|
|
3519
|
+
/** MCP tool or CLI command involved. */
|
|
3520
|
+
tool?: string;
|
|
3521
|
+
/** The agent or client sending it. */
|
|
3522
|
+
agent?: string;
|
|
3523
|
+
};
|
|
3524
|
+
}
|
|
3525
|
+
/** A compliance plan without task content (webhook payload). */
|
|
3526
|
+
export interface CompliancePlanSummary {
|
|
3527
|
+
/** Unique identifier of the compliance plan (plan_…). */
|
|
3528
|
+
id: string;
|
|
3529
|
+
/** String representing the object's type. Always "compliance_plan". */
|
|
3530
|
+
object: "compliance_plan";
|
|
3531
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
3532
|
+
livemode: boolean;
|
|
3533
|
+
/** The site. */
|
|
3534
|
+
site: string;
|
|
3535
|
+
/** action_required (an agent can apply open tasks now), verifying (changes applied; waiting for confirming observations), compliant (every applicable check Checkbox could observe passes — an automated assessment, not a legal determination; see coverage for what was not observed), blocked (only human answers or declined critical tasks remain). */
|
|
3536
|
+
status: "action_required" | "verifying" | "compliant" | "blocked";
|
|
3537
|
+
/** Compliance score 0-100 of the latest evaluation. */
|
|
3538
|
+
score: number | null;
|
|
3539
|
+
/** Preview flag the planned Checkbox Warranty will key on (no checks failing at high severity). No warranty or insurance is offered yet; this is not an underwriting decision. */
|
|
3540
|
+
insurable: boolean | null;
|
|
3541
|
+
/** Two or three sentences for an LLM: where the site stands and what comes next. */
|
|
3542
|
+
summary: string;
|
|
3543
|
+
/** Tasks per status. */
|
|
3544
|
+
counts: {
|
|
3545
|
+
/** Open tasks. */
|
|
3546
|
+
open: number;
|
|
3547
|
+
/** Claimed tasks. */
|
|
3548
|
+
in_progress: number;
|
|
3549
|
+
/** Tasks waiting for a confirming observation. */
|
|
3550
|
+
verifying: number;
|
|
3551
|
+
/** Tasks waiting for a human answer. */
|
|
3552
|
+
manual: number;
|
|
3553
|
+
/** Done tasks. */
|
|
3554
|
+
done: number;
|
|
3555
|
+
/** Declined tasks. */
|
|
3556
|
+
wont_fix: number;
|
|
3557
|
+
};
|
|
3558
|
+
next_action: PlanNextAction;
|
|
3559
|
+
/** What the assessment rests on. Tell the human about not_observed and attested items; never call the site "compliant" without them. */
|
|
3560
|
+
coverage: {
|
|
3561
|
+
/** Lifecycle stages Checkbox observed (signup, acknowledgment_email, reminders, cancellation, policies, billing_settings). */
|
|
3562
|
+
observed: Array<string>;
|
|
3563
|
+
/** Stages Checkbox has no observation of: their checks cannot fail, so passing says nothing about them. */
|
|
3564
|
+
not_observed: Array<string>;
|
|
3565
|
+
/** Task keys resting on a human confirmation instead of an observation. */
|
|
3566
|
+
attested: Array<string>;
|
|
3567
|
+
/** A billing platform is connected (dashboard). */
|
|
3568
|
+
billing_connected: boolean;
|
|
3569
|
+
};
|
|
3570
|
+
/** When the plan was computed. Unix timestamp in seconds. */
|
|
3571
|
+
generated: number;
|
|
3572
|
+
/** Tasks (id, key, status, priority, title) in plan order. */
|
|
3573
|
+
tasks: Array<{
|
|
3574
|
+
/** Unique identifier of the task (task_…). */
|
|
3575
|
+
id: string;
|
|
3576
|
+
/** Task key. */
|
|
3577
|
+
key: string;
|
|
3578
|
+
/** Task status. */
|
|
3579
|
+
status: "open" | "in_progress" | "verifying" | "done" | "wont_fix" | "manual";
|
|
3580
|
+
/** Priority. */
|
|
3581
|
+
priority: "critical" | "high" | "medium" | "low";
|
|
3582
|
+
/** Title. */
|
|
3583
|
+
title: string;
|
|
3584
|
+
}>;
|
|
3585
|
+
}
|
|
3586
|
+
/** A legally required notice Checkbox sent for the merchant. */
|
|
3587
|
+
export interface Notice {
|
|
3588
|
+
/** Unique identifier of the notice (ntc_…). */
|
|
3589
|
+
id: string;
|
|
3590
|
+
/** String representing the object's type. Always "notice". */
|
|
3591
|
+
object: "notice";
|
|
3592
|
+
/** true for live-mode objects, false for test mode (ck_test_ keys act on an isolated sandbox). */
|
|
3593
|
+
livemode: boolean;
|
|
3594
|
+
/** The site. */
|
|
3595
|
+
site: string;
|
|
3596
|
+
/** Notice kind. */
|
|
3597
|
+
kind: "acknowledgment" | "trial_ending" | "renewal_reminder" | "annual_terms" | "price_change";
|
|
3598
|
+
/** Delivery status. */
|
|
3599
|
+
status: "claimed" | "sent" | "failed" | "bounced" | "skipped";
|
|
3600
|
+
/** Billing platform of the subscription. */
|
|
3601
|
+
platform: string;
|
|
3602
|
+
/** Billing-platform subscription id. */
|
|
3603
|
+
subscription: string;
|
|
3604
|
+
/** Masked recipient address. */
|
|
3605
|
+
recipient: string | null;
|
|
3606
|
+
/** Subject line. */
|
|
3607
|
+
subject: string | null;
|
|
3608
|
+
/** When it was sent. Unix timestamp in seconds. */
|
|
3609
|
+
sent: number | null;
|
|
3610
|
+
/** Sent after the legal window opened late (e.g. the subscription was imported late). */
|
|
3611
|
+
late: boolean;
|
|
3612
|
+
/** Evidence record of the sent email. */
|
|
3613
|
+
evidence: string | null;
|
|
3614
|
+
}
|
|
3615
|
+
/** Parameters of `device.token()` (createDeviceToken). */
|
|
3616
|
+
export interface CreateDeviceTokenParams {
|
|
3617
|
+
/** The device_code from createDeviceAuthorization. */
|
|
3618
|
+
device_code: string;
|
|
3619
|
+
}
|
|
3620
|
+
/** Parameters of `setupSessions.list()` (listSetupSessions). */
|
|
3621
|
+
export interface ListSetupSessionsParams {
|
|
3622
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3623
|
+
limit?: number;
|
|
3624
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3625
|
+
starting_after?: string;
|
|
3626
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3627
|
+
ending_before?: string;
|
|
3628
|
+
}
|
|
3629
|
+
/** Parameters of `account.update()` (updateAccount). */
|
|
3630
|
+
export interface UpdateAccountParams {
|
|
3631
|
+
/** API version to pin. */
|
|
3632
|
+
api_version?: string;
|
|
3633
|
+
}
|
|
3634
|
+
/** Parameters of `sites.list()` (listSites). */
|
|
3635
|
+
export interface ListSitesParams {
|
|
3636
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3637
|
+
limit?: number;
|
|
3638
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3639
|
+
starting_after?: string;
|
|
3640
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3641
|
+
ending_before?: string;
|
|
3642
|
+
/** true lists only archived sites. */
|
|
3643
|
+
archived?: "true" | "false";
|
|
3644
|
+
}
|
|
3645
|
+
/** Parameters of `sites.retrieve()` (retrieveSite). */
|
|
3646
|
+
export interface RetrieveSiteParams {
|
|
3647
|
+
/** Related objects to include inline: latest_scan, domain_verification. Pass as expand[]=name. */
|
|
3648
|
+
expand?: Array<"latest_scan" | "domain_verification">;
|
|
3649
|
+
}
|
|
3650
|
+
/** Parameters of `domainVerifications.create()` (createDomainVerification). */
|
|
3651
|
+
export interface CreateDomainVerificationParams {
|
|
3652
|
+
/** Issue a new token (invalidates the old one). */
|
|
3653
|
+
rotate?: boolean;
|
|
3654
|
+
}
|
|
3655
|
+
/** Parameters of `scans.create()` (createScan). */
|
|
3656
|
+
export interface CreateScanParams {
|
|
3657
|
+
/** States to scan from (default: the site configuration). */
|
|
3658
|
+
regions?: Array<"US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY">;
|
|
3659
|
+
}
|
|
3660
|
+
/** Parameters of `scans.list()` (listScans). */
|
|
3661
|
+
export interface ListScansParams {
|
|
3662
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3663
|
+
limit?: number;
|
|
3664
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3665
|
+
starting_after?: string;
|
|
3666
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3667
|
+
ending_before?: string;
|
|
3668
|
+
/** Only objects of this site (site_…). */
|
|
3669
|
+
site?: string;
|
|
3670
|
+
}
|
|
3671
|
+
/** Parameters of `evaluations.create()` (createEvaluation). */
|
|
3672
|
+
export type CreateEvaluationParams = Record<string, unknown>;
|
|
3673
|
+
/** Parameters of `evaluations.list()` (listEvaluations). */
|
|
3674
|
+
export interface ListEvaluationsParams {
|
|
3675
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3676
|
+
limit?: number;
|
|
3677
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3678
|
+
starting_after?: string;
|
|
3679
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3680
|
+
ending_before?: string;
|
|
3681
|
+
/** Only objects of this site (site_…). */
|
|
3682
|
+
site?: string;
|
|
3683
|
+
}
|
|
3684
|
+
/** Parameters of `findings.list()` (listFindings). */
|
|
3685
|
+
export interface ListFindingsParams {
|
|
3686
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3687
|
+
limit?: number;
|
|
3688
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3689
|
+
starting_after?: string;
|
|
3690
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3691
|
+
ending_before?: string;
|
|
3692
|
+
/** Only objects of this site (site_…). */
|
|
3693
|
+
site?: string;
|
|
3694
|
+
/** Only this check status. */
|
|
3695
|
+
status?: "pass" | "fail" | "needs_review" | "not_applicable";
|
|
3696
|
+
/** Only this triage state. */
|
|
3697
|
+
state?: "open" | "acknowledged" | "resolved" | "accepted_risk";
|
|
3698
|
+
}
|
|
3699
|
+
/** Parameters of `findings.update()` (updateFinding). */
|
|
3700
|
+
export interface UpdateFindingParams {
|
|
3701
|
+
/** New triage state. */
|
|
3702
|
+
state: "open" | "acknowledged" | "resolved" | "accepted_risk";
|
|
3703
|
+
/** Why (kept with the finding). */
|
|
3704
|
+
note?: string;
|
|
3705
|
+
}
|
|
3706
|
+
/** Parameters of `tasks.verify()` (verifyTask). */
|
|
3707
|
+
export type VerifyTaskRequestParams = VerifyTaskParams & {
|
|
3708
|
+
/** Long-poll: wait up to this many seconds (0-30) for the verification to resolve before answering. */
|
|
3709
|
+
wait?: number | null;
|
|
3710
|
+
};
|
|
3711
|
+
/** Parameters of `sites.verify()` (verifySite). */
|
|
3712
|
+
export interface VerifySiteParams {
|
|
3713
|
+
/** Long-poll: wait up to this many seconds (0-30) for the verification to resolve before answering. */
|
|
3714
|
+
wait?: number | null;
|
|
3715
|
+
}
|
|
3716
|
+
/** Parameters of `verifications.retrieve()` (retrieveVerification). */
|
|
3717
|
+
export interface RetrieveVerificationParams {
|
|
3718
|
+
/** Long-poll: wait up to this many seconds (0-30) for the verification to resolve before answering. */
|
|
3719
|
+
wait?: number | null;
|
|
3720
|
+
}
|
|
3721
|
+
/** Parameters of `verifications.list()` (listVerifications). */
|
|
3722
|
+
export interface ListVerificationsParams {
|
|
3723
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3724
|
+
limit?: number;
|
|
3725
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3726
|
+
starting_after?: string;
|
|
3727
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3728
|
+
ending_before?: string;
|
|
3729
|
+
/** Only this task (task_…). */
|
|
3730
|
+
task?: string;
|
|
3731
|
+
}
|
|
3732
|
+
/** Parameters of `fixes.retrieve()` (retrieveFindingFix). */
|
|
3733
|
+
export interface RetrieveFindingFixParams {
|
|
3734
|
+
/** Billing-platform plan/price id to write the disclosure for. */
|
|
3735
|
+
plan?: string;
|
|
3736
|
+
/** Cancellation URL to state (defaults to the hosted page or billing portal). */
|
|
3737
|
+
cancel_url?: string;
|
|
3738
|
+
/** Where the sign-up happens (default: detected). */
|
|
3739
|
+
target?: "stripe_checkout" | "stripe_payment_link" | "shopify" | "html";
|
|
3740
|
+
}
|
|
3741
|
+
/** Parameters of `fixes.list()` (listSiteFixes). */
|
|
3742
|
+
export interface ListSiteFixesParams {
|
|
3743
|
+
/** Billing-platform plan/price id to write the disclosure for. */
|
|
3744
|
+
plan?: string;
|
|
3745
|
+
/** Cancellation URL to state (defaults to the hosted page or billing portal). */
|
|
3746
|
+
cancel_url?: string;
|
|
3747
|
+
/** Where the sign-up happens (default: detected). */
|
|
3748
|
+
target?: "stripe_checkout" | "stripe_payment_link" | "shopify" | "html";
|
|
3749
|
+
}
|
|
3750
|
+
/** Parameters of `evidence.list()` (listEvidence). */
|
|
3751
|
+
export interface ListEvidenceParams {
|
|
3752
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3753
|
+
limit?: number;
|
|
3754
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3755
|
+
starting_after?: string;
|
|
3756
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3757
|
+
ending_before?: string;
|
|
3758
|
+
/** Site (site_…). Required. */
|
|
3759
|
+
site: string;
|
|
3760
|
+
/** Only this kind. */
|
|
3761
|
+
kind?: "screenshot" | "html" | "page_capture" | "email_raw" | "platform_config" | "lifecycle_event" | "evaluation";
|
|
3762
|
+
}
|
|
3763
|
+
/** Parameters of `evidence.verifyChain()` (verifyEvidenceChain). */
|
|
3764
|
+
export type VerifyEvidenceChainParams = Record<string, unknown>;
|
|
3765
|
+
/** Parameters of `certificates.list()` (listCertificates). */
|
|
3766
|
+
export interface ListCertificatesParams {
|
|
3767
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3768
|
+
limit?: number;
|
|
3769
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3770
|
+
starting_after?: string;
|
|
3771
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3772
|
+
ending_before?: string;
|
|
3773
|
+
/** Only objects of this site (site_…). */
|
|
3774
|
+
site?: string;
|
|
3775
|
+
}
|
|
3776
|
+
/** Parameters of `certificates.create()` (createCertificate). */
|
|
3777
|
+
export type CreateCertificateParams = Record<string, unknown>;
|
|
3778
|
+
/** Parameters of `certificates.revoke()` (revokeCertificate). */
|
|
3779
|
+
export interface RevokeCertificateParams {
|
|
3780
|
+
/** Private reason. */
|
|
3781
|
+
reason: string;
|
|
3782
|
+
}
|
|
3783
|
+
/** Parameters of `notices.listDue()` (listDueNotices). */
|
|
3784
|
+
export interface ListDueNoticesParams {
|
|
3785
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3786
|
+
limit?: number;
|
|
3787
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3788
|
+
starting_after?: string;
|
|
3789
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3790
|
+
ending_before?: string;
|
|
3791
|
+
/** Only this site (site_…). Default: every site of the account. */
|
|
3792
|
+
site?: string;
|
|
3793
|
+
/** Comma-separated statuses (upcoming, due, sent, overdue, canceled, missed). Default: upcoming,due,overdue — what still needs sending. */
|
|
3794
|
+
status?: string;
|
|
3795
|
+
/** Comma-separated kinds (acknowledgment, trial_ending, renewal_reminder, annual_terms, price_change, cancellation_confirmation). */
|
|
3796
|
+
kind?: string;
|
|
3797
|
+
/** Only notices for this billing-platform subscription id. */
|
|
3798
|
+
subscription?: string;
|
|
3799
|
+
}
|
|
3800
|
+
/** Parameters of `notices.listTemplates()` (listNoticeTemplates). */
|
|
3801
|
+
export interface ListNoticeTemplatesParams {
|
|
3802
|
+
/** Site (site_…) whose BCC addresses to include. */
|
|
3803
|
+
site?: string;
|
|
3804
|
+
}
|
|
3805
|
+
/** Parameters of `lawUpdates.list()` (listLawUpdates). */
|
|
3806
|
+
export interface ListLawUpdatesParams {
|
|
3807
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3808
|
+
limit?: number;
|
|
3809
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3810
|
+
starting_after?: string;
|
|
3811
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3812
|
+
ending_before?: string;
|
|
3813
|
+
/** Only changes on or after this date (YYYY-MM-DD). */
|
|
3814
|
+
since?: string;
|
|
3815
|
+
}
|
|
3816
|
+
/** Parameters of `consents.list()` (listConsents). */
|
|
3817
|
+
export interface ListConsentsParams {
|
|
3818
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3819
|
+
limit?: number;
|
|
3820
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3821
|
+
starting_after?: string;
|
|
3822
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3823
|
+
ending_before?: string;
|
|
3824
|
+
/** Only this site's consents. */
|
|
3825
|
+
site?: string;
|
|
3826
|
+
/** Only consents with this customer reference. */
|
|
3827
|
+
customer_reference?: string;
|
|
3828
|
+
/** Only consents to this disclosure. */
|
|
3829
|
+
disclosure?: string;
|
|
3830
|
+
/** Created at or after (unix seconds). */
|
|
3831
|
+
created_gte?: number | null;
|
|
3832
|
+
/** Created at or before (unix seconds). */
|
|
3833
|
+
created_lte?: number | null;
|
|
3834
|
+
}
|
|
3835
|
+
/** Parameters of `receipts.list()` (listReceipts). */
|
|
3836
|
+
export interface ListReceiptsParams {
|
|
3837
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3838
|
+
limit?: number;
|
|
3839
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3840
|
+
starting_after?: string;
|
|
3841
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3842
|
+
ending_before?: string;
|
|
3843
|
+
/** Only receipts of this site. */
|
|
3844
|
+
site?: string;
|
|
3845
|
+
/** Only receipts for this subscriber reference. */
|
|
3846
|
+
customer_reference?: string;
|
|
3847
|
+
/** Only receipts of this Stripe Checkout Session. */
|
|
3848
|
+
checkout_session?: string;
|
|
3849
|
+
/** Only receipts whose email hash matches this address (hashed before the lookup). */
|
|
3850
|
+
email?: string;
|
|
3851
|
+
/** Only this source. */
|
|
3852
|
+
source?: "elements" | "snippet" | "api" | "stripe_checkout" | "stripe_payment_link";
|
|
3853
|
+
/** Only this binding. */
|
|
3854
|
+
binding?: "bound" | "unbound" | "server";
|
|
3855
|
+
/** Created at or after (unix seconds). */
|
|
3856
|
+
created_gte?: number | null;
|
|
3857
|
+
/** Created at or before (unix seconds). */
|
|
3858
|
+
created_lte?: number | null;
|
|
3859
|
+
}
|
|
3860
|
+
/** Parameters of `testCredentials.create()` (createTestCredential). */
|
|
3861
|
+
export interface CreateTestCredentialParams {
|
|
3862
|
+
/** Kind of key. Only "stripe_test". */
|
|
3863
|
+
type: "stripe_test";
|
|
3864
|
+
/** The Stripe test-mode restricted (rk_test_…) or secret (sk_test_…) key. Stored encrypted; never returned. */
|
|
3865
|
+
secret_key: string;
|
|
3866
|
+
}
|
|
3867
|
+
/** Parameters of `stripeCheckoutConfigs.create()` (createStripeCheckoutConfig). */
|
|
3868
|
+
export interface CreateStripeCheckoutConfigParams {
|
|
3869
|
+
/** The Checkout Session parameters (mode "subscription", line_items, custom_text, consent_collection, subscription_data…). */
|
|
3870
|
+
params: Record<string, unknown>;
|
|
3871
|
+
/** Your name for it. */
|
|
3872
|
+
name?: string;
|
|
3873
|
+
/** Up to 20 key/value string pairs you can attach to the object. */
|
|
3874
|
+
metadata?: Record<string, string>;
|
|
3875
|
+
}
|
|
3876
|
+
/** Parameters of `stripeCheckoutConfigs.list()` (listStripeCheckoutConfigs). */
|
|
3877
|
+
export interface ListStripeCheckoutConfigsParams {
|
|
3878
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3879
|
+
limit?: number;
|
|
3880
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3881
|
+
starting_after?: string;
|
|
3882
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3883
|
+
ending_before?: string;
|
|
3884
|
+
}
|
|
3885
|
+
/** Parameters of `testRuns.create()` (createTestRun). */
|
|
3886
|
+
export interface CreateTestRunParams {
|
|
3887
|
+
/** stripe (default when a Stripe test key is stored or the site uses Stripe) or generic (test coupon / test account, no time travel). */
|
|
3888
|
+
type?: "stripe" | "generic";
|
|
3889
|
+
/** How long to wait for each email (acknowledgment, reminders, cancellation), 15-900 seconds (default 120). */
|
|
3890
|
+
email_wait_seconds?: number;
|
|
3891
|
+
/** Advance a Stripe test clock through the trial end and the first renewal (default true). */
|
|
3892
|
+
advance_time?: boolean;
|
|
3893
|
+
/** Cancel online at the end (default true). */
|
|
3894
|
+
cancel?: boolean;
|
|
3895
|
+
/** State the synthetic shopper visits from (default: the site's first scan region). */
|
|
3896
|
+
region?: "US-FED" | "US-AL" | "US-AK" | "US-AZ" | "US-AR" | "US-CA" | "US-CO" | "US-CT" | "US-DE" | "US-DC" | "US-FL" | "US-GA" | "US-HI" | "US-ID" | "US-IL" | "US-IN" | "US-IA" | "US-KS" | "US-KY" | "US-LA" | "US-ME" | "US-MD" | "US-MA" | "US-MI" | "US-MN" | "US-MS" | "US-MO" | "US-MT" | "US-NE" | "US-NV" | "US-NH" | "US-NJ" | "US-NM" | "US-NY" | "US-NC" | "US-ND" | "US-OH" | "US-OK" | "US-OR" | "US-PA" | "US-RI" | "US-SC" | "US-SD" | "US-TN" | "US-TX" | "US-UT" | "US-VT" | "US-VA" | "US-WA" | "US-WV" | "US-WI" | "US-WY";
|
|
3897
|
+
/** Stripe options. */
|
|
3898
|
+
stripe?: {
|
|
3899
|
+
/** Registered checkout config (scc_…) to mirror; default: the newest one, else your latest live Checkout Session. */
|
|
3900
|
+
checkout_config?: string;
|
|
3901
|
+
/** A test-mode price to subscribe to when nothing is registered. */
|
|
3902
|
+
price?: string;
|
|
3903
|
+
/** Trial for `price` (registered configs carry their own). */
|
|
3904
|
+
trial_period_days?: number;
|
|
3905
|
+
/** Live price id -> test-mode price id, when they differ. */
|
|
3906
|
+
price_map?: Record<string, string>;
|
|
3907
|
+
/** Steps that complete your hosted checkout with card 4242 4242 4242 4242 when it differs from Stripe's default page. */
|
|
3908
|
+
checkout_steps?: Array<ScanStep>;
|
|
3909
|
+
/** Cancel on your own page instead of the Stripe customer portal (it must work for the test subscriber). */
|
|
3910
|
+
cancel_url?: string;
|
|
3911
|
+
};
|
|
3912
|
+
/** Generic (non-Stripe) options. */
|
|
3913
|
+
generic?: {
|
|
3914
|
+
/** Checkout page (default: the site's scan settings). */
|
|
3915
|
+
checkout_url?: string;
|
|
3916
|
+
/** Steps to reach the final pre-payment screen. */
|
|
3917
|
+
checkout_steps?: Array<ScanStep>;
|
|
3918
|
+
/** Complete a real sign-up with a test coupon. */
|
|
3919
|
+
complete_purchase?: {
|
|
3920
|
+
/** Steps that complete a sign-up ({{email}} is the run inbox, {{promoCode}} the code). */
|
|
3921
|
+
steps: Array<ScanStep>;
|
|
3922
|
+
/** 100%-off test coupon (stored encrypted, never returned). */
|
|
3923
|
+
promo_code?: string;
|
|
3924
|
+
};
|
|
3925
|
+
/** Test account used to cancel online. */
|
|
3926
|
+
account?: {
|
|
3927
|
+
/** Login page of the test account. */
|
|
3928
|
+
login_url: string;
|
|
3929
|
+
/** Test account email; "{{inbox}}" = the run inbox (use it when the sign-up creates the account). */
|
|
3930
|
+
email: string;
|
|
3931
|
+
/** Test account password (stored encrypted, never returned); default: the site's scan settings. */
|
|
3932
|
+
password?: string;
|
|
3933
|
+
/** Custom login steps. */
|
|
3934
|
+
login_steps?: Array<ScanStep>;
|
|
3935
|
+
};
|
|
3936
|
+
/** Explicit cancellation steps (otherwise auto-discovered). */
|
|
3937
|
+
cancel_steps?: Array<ScanStep>;
|
|
3938
|
+
};
|
|
3939
|
+
}
|
|
3940
|
+
/** Parameters of `testRuns.list()` (listTestRuns). */
|
|
3941
|
+
export interface ListTestRunsParams {
|
|
3942
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3943
|
+
limit?: number;
|
|
3944
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3945
|
+
starting_after?: string;
|
|
3946
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3947
|
+
ending_before?: string;
|
|
3948
|
+
}
|
|
3949
|
+
/** Parameters of `webhookEndpoints.create()` (createWebhookEndpoint). */
|
|
3950
|
+
export interface CreateWebhookEndpointParams {
|
|
3951
|
+
/** HTTPS URL. */
|
|
3952
|
+
url: string;
|
|
3953
|
+
/** Event types to send, or ["*"] for all: site.score_changed, site.insurable_changed, finding.created, finding.resolved, scan.completed, scan.failed, law.changed, certificate.issued, certificate.lapsed, certificate.revoked, notice.sent, notice.due, notice.overdue, consent.created, receipt.created, test_run.completed, test_run.failed, plan.updated, site.compliant, task.verified. */
|
|
3954
|
+
enabled_events: Array<string>;
|
|
3955
|
+
/** Description. */
|
|
3956
|
+
description?: string;
|
|
3957
|
+
/** Up to 20 key/value string pairs you can attach to the object. */
|
|
3958
|
+
metadata?: Record<string, string>;
|
|
3959
|
+
}
|
|
3960
|
+
/** Parameters of `webhookEndpoints.list()` (listWebhookEndpoints). */
|
|
3961
|
+
export interface ListWebhookEndpointsParams {
|
|
3962
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3963
|
+
limit?: number;
|
|
3964
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3965
|
+
starting_after?: string;
|
|
3966
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3967
|
+
ending_before?: string;
|
|
3968
|
+
}
|
|
3969
|
+
/** Parameters of `webhookEndpoints.update()` (updateWebhookEndpoint). */
|
|
3970
|
+
export interface UpdateWebhookEndpointParams {
|
|
3971
|
+
/** HTTPS URL. */
|
|
3972
|
+
url?: string;
|
|
3973
|
+
/** Event types to send, or ["*"] for all: site.score_changed, site.insurable_changed, finding.created, finding.resolved, scan.completed, scan.failed, law.changed, certificate.issued, certificate.lapsed, certificate.revoked, notice.sent, notice.due, notice.overdue, consent.created, receipt.created, test_run.completed, test_run.failed, plan.updated, site.compliant, task.verified. */
|
|
3974
|
+
enabled_events?: Array<string>;
|
|
3975
|
+
/** Description (null clears it). */
|
|
3976
|
+
description?: string | null;
|
|
3977
|
+
/** true disables the endpoint, false enables it. */
|
|
3978
|
+
disabled?: boolean;
|
|
3979
|
+
/** Up to 20 key/value string pairs you can attach to the object. */
|
|
3980
|
+
metadata?: Record<string, string>;
|
|
3981
|
+
}
|
|
3982
|
+
/** Parameters of `webhookEndpoints.rollSecret()` (rollWebhookEndpointSecret). */
|
|
3983
|
+
export type RollWebhookEndpointSecretParams = Record<string, unknown>;
|
|
3984
|
+
/** Parameters of `events.list()` (listEvents). */
|
|
3985
|
+
export interface ListEventsParams {
|
|
3986
|
+
/** Number of objects to return, 1-100 (default 10). */
|
|
3987
|
+
limit?: number;
|
|
3988
|
+
/** Cursor: an object id; returns the objects after it (older). */
|
|
3989
|
+
starting_after?: string;
|
|
3990
|
+
/** Cursor: an object id; returns the objects before it (newer). */
|
|
3991
|
+
ending_before?: string;
|
|
3992
|
+
/** Only this type; a trailing * matches a prefix (finding.*). */
|
|
3993
|
+
type?: string;
|
|
3994
|
+
/** Only events created at or after this unix time. */
|
|
3995
|
+
created_gte?: number | null;
|
|
3996
|
+
/** Only events created at or before this unix time. */
|
|
3997
|
+
created_lte?: number | null;
|
|
3998
|
+
}
|
|
3999
|
+
/** `plan.updated`: A site's compliance plan changed (its status or a task's status); data.object is the plan without task content — GET the plan and follow next_action. */
|
|
4000
|
+
export type PlanUpdatedEvent = Event & {
|
|
4001
|
+
/** Event type. */
|
|
4002
|
+
type?: "plan.updated";
|
|
4003
|
+
data?: {
|
|
4004
|
+
object: CompliancePlanSummary;
|
|
4005
|
+
/** plan.updated: the previous status and score. */
|
|
4006
|
+
previous_attributes?: Record<string, unknown>;
|
|
4007
|
+
};
|
|
4008
|
+
};
|
|
4009
|
+
/** `task.verified`: A compliance-plan task verification resolved (passed or failed); data.object is the verification with expected vs observed per check. */
|
|
4010
|
+
export type TaskVerifiedEvent = Event & {
|
|
4011
|
+
/** Event type. */
|
|
4012
|
+
type?: "task.verified";
|
|
4013
|
+
data?: {
|
|
4014
|
+
object: Verification;
|
|
4015
|
+
/** plan.updated: the previous status and score. */
|
|
4016
|
+
previous_attributes?: Record<string, unknown>;
|
|
4017
|
+
};
|
|
4018
|
+
};
|
|
4019
|
+
/** `notice.due`: An email the merchant sends itself ("You send" mode) reached its recommended send date: data.object is the due_notice with the window, send_at, the copy-ready email and its BCC address. Send it now (inside the window), then call markNoticeSent (or BCC the copy). required tells a legally required email from a recommended one. */
|
|
4020
|
+
export type NoticeDueEvent = Event & {
|
|
4021
|
+
/** Event type. */
|
|
4022
|
+
type?: "notice.due";
|
|
4023
|
+
data?: {
|
|
4024
|
+
object: Notice;
|
|
4025
|
+
/** Previous values of changed fields. */
|
|
4026
|
+
previous_attributes?: Record<string, unknown>;
|
|
4027
|
+
};
|
|
4028
|
+
};
|
|
4029
|
+
/** `notice.overdue`: A due_notice's window closed without proof it was sent (no markNoticeSent call, no matching BCC copy). For a required notice the compliance check fails until it is sent (late) or recorded as missed. */
|
|
4030
|
+
export type NoticeOverdueEvent = Event & {
|
|
4031
|
+
/** Event type. */
|
|
4032
|
+
type?: "notice.overdue";
|
|
4033
|
+
data?: {
|
|
4034
|
+
object: Notice;
|
|
4035
|
+
/** Previous values of changed fields. */
|
|
4036
|
+
previous_attributes?: Record<string, unknown>;
|
|
4037
|
+
};
|
|
4038
|
+
};
|
|
4039
|
+
/** `receipt.created`: A consent receipt was recorded: what a subscriber saw next to the pay button and agreed to (or, for Stripe-hosted checkouts, what Stripe recorded); data.object is the receipt. */
|
|
4040
|
+
export type ReceiptCreatedEvent = Event & {
|
|
4041
|
+
/** Event type. */
|
|
4042
|
+
type?: "receipt.created";
|
|
4043
|
+
data?: {
|
|
4044
|
+
object: Receipt;
|
|
4045
|
+
/** Not used for receipt events. */
|
|
4046
|
+
previous_attributes?: Record<string, unknown>;
|
|
4047
|
+
};
|
|
4048
|
+
};
|
|
4049
|
+
/** `test_run.completed`: A lifecycle test run finished; data.object is the test_run with every step's observations, check results and fixes. */
|
|
4050
|
+
export type TestRunCompletedEvent = Event & {
|
|
4051
|
+
/** Event type. */
|
|
4052
|
+
type?: "test_run.completed";
|
|
4053
|
+
data?: {
|
|
4054
|
+
object: TestRun;
|
|
4055
|
+
/** Not used for test_run events. */
|
|
4056
|
+
previous_attributes?: Record<string, unknown>;
|
|
4057
|
+
};
|
|
4058
|
+
};
|
|
4059
|
+
/** `test_run.failed`: A lifecycle test run stopped early; data.object.failure has the code, message and fix. */
|
|
4060
|
+
export type TestRunFailedEvent = Event & {
|
|
4061
|
+
/** Event type. */
|
|
4062
|
+
type?: "test_run.failed";
|
|
4063
|
+
data?: {
|
|
4064
|
+
object: TestRun;
|
|
4065
|
+
/** Not used for test_run events. */
|
|
4066
|
+
previous_attributes?: Record<string, unknown>;
|
|
4067
|
+
};
|
|
4068
|
+
};
|
|
4069
|
+
/** `site.score_changed`: A site's compliance score changed (data.previous_attributes.score has the old score). */
|
|
4070
|
+
export type SiteScoreChangedEvent = Event & {
|
|
4071
|
+
/** Event type. */
|
|
4072
|
+
type?: "site.score_changed";
|
|
4073
|
+
data?: {
|
|
4074
|
+
object: Site;
|
|
4075
|
+
/** Previous values of changed fields. */
|
|
4076
|
+
previous_attributes?: Record<string, unknown>;
|
|
4077
|
+
};
|
|
4078
|
+
};
|
|
4079
|
+
/** `site.insurable_changed`: A site became insurable or stopped being insurable. */
|
|
4080
|
+
export type SiteInsurableChangedEvent = Event & {
|
|
4081
|
+
/** Event type. */
|
|
4082
|
+
type?: "site.insurable_changed";
|
|
4083
|
+
data?: {
|
|
4084
|
+
object: Site;
|
|
4085
|
+
/** Previous values of changed fields. */
|
|
4086
|
+
previous_attributes?: Record<string, unknown>;
|
|
4087
|
+
};
|
|
4088
|
+
};
|
|
4089
|
+
/** `finding.created`: A check started failing (new finding, or a resolved / passing one failing again). */
|
|
4090
|
+
export type FindingCreatedEvent = Event & {
|
|
4091
|
+
/** Event type. */
|
|
4092
|
+
type?: "finding.created";
|
|
4093
|
+
data?: {
|
|
4094
|
+
object: Finding;
|
|
4095
|
+
/** Previous values of changed fields. */
|
|
4096
|
+
previous_attributes?: Record<string, unknown>;
|
|
4097
|
+
};
|
|
4098
|
+
};
|
|
4099
|
+
/** `finding.resolved`: A failing or undecided check now passes or no longer applies. */
|
|
4100
|
+
export type FindingResolvedEvent = Event & {
|
|
4101
|
+
/** Event type. */
|
|
4102
|
+
type?: "finding.resolved";
|
|
4103
|
+
data?: {
|
|
4104
|
+
object: Finding;
|
|
4105
|
+
/** Previous values of changed fields. */
|
|
4106
|
+
previous_attributes?: Record<string, unknown>;
|
|
4107
|
+
};
|
|
4108
|
+
};
|
|
4109
|
+
/** `scan.completed`: A scan finished (the evaluation may follow in a separate site.score_changed event). */
|
|
4110
|
+
export type ScanCompletedEvent = Event & {
|
|
4111
|
+
/** Event type. */
|
|
4112
|
+
type?: "scan.completed";
|
|
4113
|
+
data?: {
|
|
4114
|
+
object: Scan;
|
|
4115
|
+
/** Previous values of changed fields. */
|
|
4116
|
+
previous_attributes?: Record<string, unknown>;
|
|
4117
|
+
};
|
|
4118
|
+
};
|
|
4119
|
+
/** `scan.failed`: A scan failed; data.object.error says why. */
|
|
4120
|
+
export type ScanFailedEvent = Event & {
|
|
4121
|
+
/** Event type. */
|
|
4122
|
+
type?: "scan.failed";
|
|
4123
|
+
data?: {
|
|
4124
|
+
object: Scan;
|
|
4125
|
+
/** Previous values of changed fields. */
|
|
4126
|
+
previous_attributes?: Record<string, unknown>;
|
|
4127
|
+
};
|
|
4128
|
+
};
|
|
4129
|
+
/** `law.changed`: A law change Checkbox applies affected one of your sites (data.object is the law update with that site's impact). */
|
|
4130
|
+
export type LawChangedEvent = Event & {
|
|
4131
|
+
/** Event type. */
|
|
4132
|
+
type?: "law.changed";
|
|
4133
|
+
data?: {
|
|
4134
|
+
object: LawUpdate;
|
|
4135
|
+
/** Previous values of changed fields. */
|
|
4136
|
+
previous_attributes?: Record<string, unknown>;
|
|
4137
|
+
};
|
|
4138
|
+
};
|
|
4139
|
+
/** `certificate.issued`: A monitoring certificate was issued. */
|
|
4140
|
+
export type CertificateIssuedEvent = Event & {
|
|
4141
|
+
/** Event type. */
|
|
4142
|
+
type?: "certificate.issued";
|
|
4143
|
+
data?: {
|
|
4144
|
+
object: Certificate;
|
|
4145
|
+
/** Previous values of changed fields. */
|
|
4146
|
+
previous_attributes?: Record<string, unknown>;
|
|
4147
|
+
};
|
|
4148
|
+
};
|
|
4149
|
+
/** `certificate.lapsed`: A certificate lapsed (the site stopped meeting the requirements). */
|
|
4150
|
+
export type CertificateLapsedEvent = Event & {
|
|
4151
|
+
/** Event type. */
|
|
4152
|
+
type?: "certificate.lapsed";
|
|
4153
|
+
data?: {
|
|
4154
|
+
object: Certificate;
|
|
4155
|
+
/** Previous values of changed fields. */
|
|
4156
|
+
previous_attributes?: Record<string, unknown>;
|
|
4157
|
+
};
|
|
4158
|
+
};
|
|
4159
|
+
/** `certificate.revoked`: A certificate was revoked. */
|
|
4160
|
+
export type CertificateRevokedEvent = Event & {
|
|
4161
|
+
/** Event type. */
|
|
4162
|
+
type?: "certificate.revoked";
|
|
4163
|
+
data?: {
|
|
4164
|
+
object: Certificate;
|
|
4165
|
+
/** Previous values of changed fields. */
|
|
4166
|
+
previous_attributes?: Record<string, unknown>;
|
|
4167
|
+
};
|
|
4168
|
+
};
|
|
4169
|
+
/** `notice.sent`: Checkbox sent a legally required notice (acknowledgment, reminder, price change) for the merchant. */
|
|
4170
|
+
export type NoticeSentEvent = Event & {
|
|
4171
|
+
/** Event type. */
|
|
4172
|
+
type?: "notice.sent";
|
|
4173
|
+
data?: {
|
|
4174
|
+
object: Notice;
|
|
4175
|
+
/** Previous values of changed fields. */
|
|
4176
|
+
previous_attributes?: Record<string, unknown>;
|
|
4177
|
+
};
|
|
4178
|
+
};
|
|
4179
|
+
/** `consent.created`: A subscriber gave affirmative consent to the automatic-renewal terms through Checkbox Elements (or your server recorded one); data.object is the consent. */
|
|
4180
|
+
export type ConsentCreatedEvent = Event & {
|
|
4181
|
+
/** Event type. */
|
|
4182
|
+
type?: "consent.created";
|
|
4183
|
+
data?: {
|
|
4184
|
+
object: Consent;
|
|
4185
|
+
/** Previous values of changed fields. */
|
|
4186
|
+
previous_attributes?: Record<string, unknown>;
|
|
4187
|
+
};
|
|
4188
|
+
};
|
|
4189
|
+
/** `site.compliant`: A site's compliance plan became compliant: nothing is left to apply, verify or answer; data.object is the site. */
|
|
4190
|
+
export type SiteCompliantEvent = Event & {
|
|
4191
|
+
/** Event type. */
|
|
4192
|
+
type?: "site.compliant";
|
|
4193
|
+
data?: {
|
|
4194
|
+
object: Site;
|
|
4195
|
+
/** Previous values of changed fields. */
|
|
4196
|
+
previous_attributes?: Record<string, unknown>;
|
|
4197
|
+
};
|
|
4198
|
+
};
|
|
4199
|
+
/** Every event Checkbox delivers to webhook endpoints, discriminated by `type`. */
|
|
4200
|
+
export type WebhookEvent = PlanUpdatedEvent | TaskVerifiedEvent | NoticeDueEvent | NoticeOverdueEvent | ReceiptCreatedEvent | TestRunCompletedEvent | TestRunFailedEvent | SiteScoreChangedEvent | SiteInsurableChangedEvent | FindingCreatedEvent | FindingResolvedEvent | ScanCompletedEvent | ScanFailedEvent | LawChangedEvent | CertificateIssuedEvent | CertificateLapsedEvent | CertificateRevokedEvent | NoticeSentEvent | ConsentCreatedEvent | SiteCompliantEvent;
|
|
4201
|
+
/** Every webhook event type. */
|
|
4202
|
+
export declare const WEBHOOK_EVENT_TYPES: readonly ["plan.updated", "task.verified", "notice.due", "notice.overdue", "receipt.created", "test_run.completed", "test_run.failed", "site.score_changed", "site.insurable_changed", "finding.created", "finding.resolved", "scan.completed", "scan.failed", "law.changed", "certificate.issued", "certificate.lapsed", "certificate.revoked", "notice.sent", "consent.created", "site.compliant"];
|
|
4203
|
+
export type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
|
|
4204
|
+
/** Stable error codes (`error.code`), with HTTP status, type and meaning. Codes are never renamed. */
|
|
4205
|
+
export declare const ERROR_CODES: {
|
|
4206
|
+
readonly parameter_invalid: {
|
|
4207
|
+
readonly status: 400;
|
|
4208
|
+
readonly type: "invalid_request_error";
|
|
4209
|
+
readonly description: "A parameter has an invalid value; `param` names it.";
|
|
4210
|
+
};
|
|
4211
|
+
readonly parameter_missing: {
|
|
4212
|
+
readonly status: 400;
|
|
4213
|
+
readonly type: "invalid_request_error";
|
|
4214
|
+
readonly description: "A required parameter is missing; `param` names it.";
|
|
4215
|
+
};
|
|
4216
|
+
readonly parameter_unknown: {
|
|
4217
|
+
readonly status: 400;
|
|
4218
|
+
readonly type: "invalid_request_error";
|
|
4219
|
+
readonly description: "The request has a parameter this endpoint does not accept.";
|
|
4220
|
+
};
|
|
4221
|
+
readonly body_invalid_json: {
|
|
4222
|
+
readonly status: 400;
|
|
4223
|
+
readonly type: "invalid_request_error";
|
|
4224
|
+
readonly description: "The request body is not valid JSON.";
|
|
4225
|
+
};
|
|
4226
|
+
readonly url_not_allowed: {
|
|
4227
|
+
readonly status: 400;
|
|
4228
|
+
readonly type: "invalid_request_error";
|
|
4229
|
+
readonly description: "A URL points to a private, local or otherwise unreachable address.";
|
|
4230
|
+
};
|
|
4231
|
+
readonly api_version_invalid: {
|
|
4232
|
+
readonly status: 400;
|
|
4233
|
+
readonly type: "invalid_request_error";
|
|
4234
|
+
readonly description: "The Checkbox-Version header names an unknown API version.";
|
|
4235
|
+
};
|
|
4236
|
+
readonly idempotency_key_invalid: {
|
|
4237
|
+
readonly status: 400;
|
|
4238
|
+
readonly type: "idempotency_error";
|
|
4239
|
+
readonly description: "The Idempotency-Key header is empty or longer than 255 characters.";
|
|
4240
|
+
};
|
|
4241
|
+
readonly idempotency_key_reused: {
|
|
4242
|
+
readonly status: 400;
|
|
4243
|
+
readonly type: "idempotency_error";
|
|
4244
|
+
readonly description: "The Idempotency-Key was already used with different parameters within 24 hours.";
|
|
4245
|
+
};
|
|
4246
|
+
readonly test_key_missing: {
|
|
4247
|
+
readonly status: 400;
|
|
4248
|
+
readonly type: "invalid_request_error";
|
|
4249
|
+
readonly description: "A Stripe test run needs a Stripe TEST-mode key stored for the site (createTestCredential).";
|
|
4250
|
+
};
|
|
4251
|
+
readonly test_key_not_test_mode: {
|
|
4252
|
+
readonly status: 400;
|
|
4253
|
+
readonly type: "invalid_request_error";
|
|
4254
|
+
readonly description: "The billing key is a live-mode (or malformed) key; test runs only accept test-mode keys (rk_test_… / sk_test_…).";
|
|
4255
|
+
};
|
|
4256
|
+
readonly test_key_rejected: {
|
|
4257
|
+
readonly status: 400;
|
|
4258
|
+
readonly type: "invalid_request_error";
|
|
4259
|
+
readonly description: "Stripe rejected the test-mode key or it lacks a permission test runs need; `message` names it.";
|
|
4260
|
+
};
|
|
4261
|
+
readonly authorization_pending: {
|
|
4262
|
+
readonly status: 400;
|
|
4263
|
+
readonly type: "invalid_request_error";
|
|
4264
|
+
readonly description: "Device login: the human has not approved yet. Keep polling createDeviceToken every `interval` seconds.";
|
|
4265
|
+
};
|
|
4266
|
+
readonly slow_down: {
|
|
4267
|
+
readonly status: 400;
|
|
4268
|
+
readonly type: "rate_limit_error";
|
|
4269
|
+
readonly description: "Device login: polling too fast. Add 5 seconds to the interval and keep polling.";
|
|
4270
|
+
};
|
|
4271
|
+
readonly expired_token: {
|
|
4272
|
+
readonly status: 400;
|
|
4273
|
+
readonly type: "invalid_request_error";
|
|
4274
|
+
readonly description: "Device login: the device code expired (15 minutes) or was already used. Start again with createDeviceAuthorization.";
|
|
4275
|
+
};
|
|
4276
|
+
readonly device_code_invalid: {
|
|
4277
|
+
readonly status: 400;
|
|
4278
|
+
readonly type: "invalid_request_error";
|
|
4279
|
+
readonly description: "Device login: the device code is unknown.";
|
|
4280
|
+
};
|
|
4281
|
+
readonly access_denied: {
|
|
4282
|
+
readonly status: 403;
|
|
4283
|
+
readonly type: "permission_error";
|
|
4284
|
+
readonly description: "Device login: the human clicked Deny. Do not retry without asking them.";
|
|
4285
|
+
};
|
|
4286
|
+
readonly api_key_missing: {
|
|
4287
|
+
readonly status: 401;
|
|
4288
|
+
readonly type: "authentication_error";
|
|
4289
|
+
readonly description: "No API key was provided (Authorization: Bearer ck_…).";
|
|
4290
|
+
};
|
|
4291
|
+
readonly api_key_invalid: {
|
|
4292
|
+
readonly status: 401;
|
|
4293
|
+
readonly type: "authentication_error";
|
|
4294
|
+
readonly description: "The API key is unknown, revoked or expired.";
|
|
4295
|
+
};
|
|
4296
|
+
readonly publishable_key_not_allowed: {
|
|
4297
|
+
readonly status: 403;
|
|
4298
|
+
readonly type: "permission_error";
|
|
4299
|
+
readonly description: "A publishable key (pk_…) cannot call this endpoint; use a secret key on your server.";
|
|
4300
|
+
};
|
|
4301
|
+
readonly origin_not_allowed: {
|
|
4302
|
+
readonly status: 403;
|
|
4303
|
+
readonly type: "permission_error";
|
|
4304
|
+
readonly description: "A publishable-key request came from a page (Origin) that is not on one of the site's domains (base URL or checkout URL).";
|
|
4305
|
+
};
|
|
4306
|
+
readonly insufficient_scope: {
|
|
4307
|
+
readonly status: 403;
|
|
4308
|
+
readonly type: "permission_error";
|
|
4309
|
+
readonly description: "The restricted key lacks the scope this endpoint needs.";
|
|
4310
|
+
};
|
|
4311
|
+
readonly insufficient_role: {
|
|
4312
|
+
readonly status: 403;
|
|
4313
|
+
readonly type: "permission_error";
|
|
4314
|
+
readonly description: "The key (or the person who created it) does not have a role that allows this action.";
|
|
4315
|
+
};
|
|
4316
|
+
readonly account_not_activated: {
|
|
4317
|
+
readonly status: 403;
|
|
4318
|
+
readonly type: "permission_error";
|
|
4319
|
+
readonly description: "Live mode needs an activated account: verify the domain of one of your sites (or use a test key).";
|
|
4320
|
+
};
|
|
4321
|
+
readonly test_mode_domain_unverified: {
|
|
4322
|
+
readonly status: 403;
|
|
4323
|
+
readonly type: "permission_error";
|
|
4324
|
+
readonly description: "Test mode only scans, monitors, fetches and test-runs localhost or domains the account has verified; verify the domain (createDomainVerification) or send the HTML instead.";
|
|
4325
|
+
};
|
|
4326
|
+
readonly test_mode_scan_budget_exhausted: {
|
|
4327
|
+
readonly status: 429;
|
|
4328
|
+
readonly type: "rate_limit_error";
|
|
4329
|
+
readonly description: "No longer returned (round 6): test mode has no scan budget for unverified domains any more, they are refused with test_mode_domain_unverified. Kept so older clients still recognise the code.";
|
|
4330
|
+
};
|
|
4331
|
+
readonly domain_not_verified: {
|
|
4332
|
+
readonly status: 403;
|
|
4333
|
+
readonly type: "permission_error";
|
|
4334
|
+
readonly description: "Checkbox only scans, monitors, fetches and test-runs websites the account has verified (DNS TXT record or /.well-known file): every target host (site, checkout, account and policy URLs) must be on a verified domain. `next_action` says which domain to verify.";
|
|
4335
|
+
};
|
|
4336
|
+
readonly account_suspended: {
|
|
4337
|
+
readonly status: 403;
|
|
4338
|
+
readonly type: "permission_error";
|
|
4339
|
+
readonly description: "The account was suspended by Checkbox staff; contact support.";
|
|
4340
|
+
};
|
|
4341
|
+
readonly resource_missing: {
|
|
4342
|
+
readonly status: 404;
|
|
4343
|
+
readonly type: "invalid_request_error";
|
|
4344
|
+
readonly description: "No object with this id exists in this mode of the account.";
|
|
4345
|
+
};
|
|
4346
|
+
readonly route_not_found: {
|
|
4347
|
+
readonly status: 404;
|
|
4348
|
+
readonly type: "invalid_request_error";
|
|
4349
|
+
readonly description: "No such endpoint. See /v1/openapi.json for the list.";
|
|
4350
|
+
};
|
|
4351
|
+
readonly resource_conflict: {
|
|
4352
|
+
readonly status: 409;
|
|
4353
|
+
readonly type: "invalid_request_error";
|
|
4354
|
+
readonly description: "The object is in a state that does not allow this action.";
|
|
4355
|
+
};
|
|
4356
|
+
readonly scan_already_queued: {
|
|
4357
|
+
readonly status: 409;
|
|
4358
|
+
readonly type: "invalid_request_error";
|
|
4359
|
+
readonly description: "A scan of this site is already queued or running.";
|
|
4360
|
+
};
|
|
4361
|
+
readonly consent_reference_locked: {
|
|
4362
|
+
readonly status: 409;
|
|
4363
|
+
readonly type: "invalid_request_error";
|
|
4364
|
+
readonly description: "The consent already carries a different customer_reference; references are set once and never changed.";
|
|
4365
|
+
};
|
|
4366
|
+
readonly test_run_in_progress: {
|
|
4367
|
+
readonly status: 409;
|
|
4368
|
+
readonly type: "invalid_request_error";
|
|
4369
|
+
readonly description: "The site already has a queued or running test run; wait for it (retrieveTestRun) or cancel it (cancelTestRun).";
|
|
4370
|
+
};
|
|
4371
|
+
readonly idempotency_key_in_use: {
|
|
4372
|
+
readonly status: 409;
|
|
4373
|
+
readonly type: "idempotency_error";
|
|
4374
|
+
readonly description: "A request with this Idempotency-Key is still being processed; retry shortly.";
|
|
4375
|
+
};
|
|
4376
|
+
readonly resource_archived: {
|
|
4377
|
+
readonly status: 410;
|
|
4378
|
+
readonly type: "invalid_request_error";
|
|
4379
|
+
readonly description: "The object is archived; restore it before changing it.";
|
|
4380
|
+
};
|
|
4381
|
+
readonly body_too_large: {
|
|
4382
|
+
readonly status: 413;
|
|
4383
|
+
readonly type: "invalid_request_error";
|
|
4384
|
+
readonly description: "The request body is too large.";
|
|
4385
|
+
};
|
|
4386
|
+
readonly content_type_unsupported: {
|
|
4387
|
+
readonly status: 415;
|
|
4388
|
+
readonly type: "invalid_request_error";
|
|
4389
|
+
readonly description: "Send JSON bodies with Content-Type: application/json.";
|
|
4390
|
+
};
|
|
4391
|
+
readonly site_limit_reached: {
|
|
4392
|
+
readonly status: 403;
|
|
4393
|
+
readonly type: "invalid_request_error";
|
|
4394
|
+
readonly description: "The account reached its fair-use site limit (default 25); contact support to raise it.";
|
|
4395
|
+
};
|
|
4396
|
+
readonly webhook_endpoint_limit_reached: {
|
|
4397
|
+
readonly status: 403;
|
|
4398
|
+
readonly type: "invalid_request_error";
|
|
4399
|
+
readonly description: "The account reached the maximum number of webhook endpoints (16 per mode).";
|
|
4400
|
+
};
|
|
4401
|
+
readonly plan_required: {
|
|
4402
|
+
readonly status: 402;
|
|
4403
|
+
readonly type: "invalid_request_error";
|
|
4404
|
+
readonly description: "Only when billing is enabled on this deployment: the feature needs a paid plan.";
|
|
4405
|
+
};
|
|
4406
|
+
readonly rate_limit_exceeded: {
|
|
4407
|
+
readonly status: 429;
|
|
4408
|
+
readonly type: "rate_limit_error";
|
|
4409
|
+
readonly description: "Too many requests; slow down and retry after the Retry-After header.";
|
|
4410
|
+
};
|
|
4411
|
+
readonly receipts_disabled: {
|
|
4412
|
+
readonly status: 403;
|
|
4413
|
+
readonly type: "permission_error";
|
|
4414
|
+
readonly description: "Consent receipts are turned off for this account (updateReceiptSettings enabled=true turns them on).";
|
|
4415
|
+
};
|
|
4416
|
+
readonly feature_unavailable: {
|
|
4417
|
+
readonly status: 503;
|
|
4418
|
+
readonly type: "api_error";
|
|
4419
|
+
readonly description: "The feature is not configured on this deployment (for example the database migration is missing).";
|
|
4420
|
+
};
|
|
4421
|
+
readonly internal_error: {
|
|
4422
|
+
readonly status: 500;
|
|
4423
|
+
readonly type: "api_error";
|
|
4424
|
+
readonly description: "Something went wrong on Checkbox's side. Retrying with the same Idempotency-Key is safe.";
|
|
4425
|
+
};
|
|
4426
|
+
};
|
|
4427
|
+
export type ErrorCode = keyof typeof ERROR_CODES;
|
|
4428
|
+
/** A downloaded file (evidence content). */
|
|
4429
|
+
export interface CheckboxFile {
|
|
4430
|
+
/** Raw bytes. */
|
|
4431
|
+
data: Uint8Array;
|
|
4432
|
+
/** Content-Type of the response. */
|
|
4433
|
+
contentType: string | null;
|
|
4434
|
+
/** Content-Disposition file name, when given. */
|
|
4435
|
+
filename: string | null;
|
|
4436
|
+
}
|