@orangecheck/me-client 0.60.0 → 0.62.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/CHANGELOG.md CHANGED
@@ -10,6 +10,68 @@ this file tracks the package's TS / Node / runtime API surface.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.62.0] — 2026-11-12
14
+
15
+ ### Added
16
+
17
+ - `PaymentResult` carries `mode`, `settles` and `is_stub`, as me.ochk.io
18
+ answers them: `'stub'`, `false`, `true`. Its `sats_charged` is the amount
19
+ the intent names; nothing is charged.
20
+ - `FireEventResult` has the answer me.ochk.io gives an event it recorded and
21
+ charged nothing: `earned: false`, `reason: 'not_billed'`, `detail` and the
22
+ `event`. It paid nobody. Code that reads `next_pay_period` after
23
+ `!res.earned` now checks `res.reason === 'not_paying'` first.
24
+ - `FireEventResult` carries `webhooks_queued` and the event's `drop` window.
25
+ - A `recorded` entry of `BatchEventResult` carries the event's `drop` window
26
+ too, as me.ochk.io sends it for a batch.
27
+
28
+ ### Changed
29
+
30
+ - `oc.event.fire`'s `earned` follows whether the event was charged. In
31
+ preview it is a preview answer, as `escrow_mode: 'simulation'` says.
32
+ `escrow_mode` is optional, as on a replay me.ochk.io leaves it out, and
33
+ `webhooks_fired` is deprecated for `webhooks_queued`: both count webhooks
34
+ queued, not delivered.
35
+ - `payment.authorize` and the README say what the call does today: it records
36
+ a payment intent in the signed-in person's name and settles nothing. No sats
37
+ move, nobody is charged, and the person earns nothing from it. There is no
38
+ prompt and no `'cancelled'` answer; a refusal throws `MeClientError`.
39
+ - The README's payment price words: when the event is priced as a percent of
40
+ the payment, the percent is in (0, 1] and the event needs
41
+ `payment_amount_sats`. The person earns about 80% of the price: the fee is
42
+ 20% of the price, rounded to a whole sat and at least 1 sat.
43
+ - `IntegratorPriceConfig` and the templates say a config is changed on
44
+ ochk.app, which saves it with `POST /api/me/projects/<project_key>`; this
45
+ SDK only builds and checks one. The template example ends with
46
+ `oc.config.validate` and saving on ochk.app, and names the marketplace
47
+ template's payment price, 0.609375%.
48
+ - `config.validate` and `validateIntegratorConfig` say what they check (the
49
+ shape, and each enabled event's own price limits; an agent block's shape
50
+ only) and that me.ochk.io checks more when it saves, among them the domain,
51
+ labels, the operator's price bounds and a price that earns nothing.
52
+ - The pay period comments: a period that has started keeps its start; its end
53
+ can still move, but never to before now.
54
+
55
+ ## [0.61.0] — 2026-11-12
56
+
57
+ ### Added
58
+
59
+ - `event.fire` takes `note`, as a batch entry already does. It is sent inside
60
+ the signed body.
61
+
62
+ ### Changed
63
+
64
+ - The `note` comment on `BatchEventInput` adds the 280-character limit, that a
65
+ class B or C built-in drops it, and the `invalid_note` refusal. A note is
66
+ public: it is in the event's receipt, which anyone with its link can read.
67
+ - The `payment_amount_sats` comments on `FireEventOptions` and
68
+ `BatchEventInput` say whole sats above 0, as me.ochk.io reads it, and that an
69
+ agent's event is priced by the agent price when one is set.
70
+ - `event.verify` prices an event an agent fired (`is_agent`) by its subtype's
71
+ agent override, as me.ochk.io does, and asks for a payment amount only when
72
+ that price is a percent of one. An agent's event under a subtype that
73
+ refuses agents is reported as `agent_refused`, a new issue field.
74
+
13
75
  ## [0.60.0] — 2026-11-11
14
76
 
15
77
  ### Changed
package/README.md CHANGED
@@ -128,11 +128,13 @@ const res = await oc.event.fire({
128
128
  signingSecret: process.env.OC_SIGNING_SECRET,
129
129
  accountId: didOc,
130
130
  });
131
- if (!res.earned) {
132
- // res.reason === 'not_paying'; res.next_pay_period says when paying starts, if scheduled
131
+ if (!res.earned && res.reason === 'not_paying') {
132
+ // no event recorded; res.next_pay_period says when paying starts, if scheduled
133
133
  }
134
134
  ```
135
135
 
136
+ An event recorded and charged nothing answers `earned: false, reason: 'not_billed'` with its `event`: a test project's event while orangecheck is live, or one in preview from a project with no preview credit yet. It paid nobody.
137
+
136
138
  `fireBatch` answers `not_paying` per event. `GET /api/integrator/config` publishes the project's `pay_periods`, past ones included, and `payingAt(periods, date)` tells you whether a project pays at a moment. Pass them to `oc.event.verify(envelope, config, amount, { payPeriods })` to flag a receipt billed outside every period.
137
139
 
138
140
  ## Session lifecycle
@@ -171,7 +173,11 @@ await oc.session.invalidate(session.id);
171
173
 
172
174
  ## Payment authorization
173
175
 
174
- Class B billable event. Sub-Stripe rates (0.5–1.0% percentage-based). The person earns the share you set per event (`user_share_pct`, 0 to 0.8 of the gross fee; OC keeps 20%, and the default templates give 0.8), and it lands in their balance at ochk.app.
176
+ Records a payment intent in the signed-in person's name. It settles nothing yet: the answer carries `mode: 'stub'`, `settles: false` and `is_stub: true`. No sats move, your balance is not charged, and the person earns nothing from it.
177
+
178
+ There is no prompt; the person is whoever is signed in. `description` (at most 280 characters) stays private, and the rest of the record is signed and readable at `verify_url`. An account records at most 20 a UTC day on each site. A refusal throws `MeClientError`.
179
+
180
+ To bill for a payment, fire the `payment_authorization` event with `oc.event.fire`. When it is priced as a percent of the payment, the percent is in (0, 1] and the event needs `payment_amount_sats`. The person earns about 80% of the price: the fee is 20% of the price, rounded to a whole sat and at least 1 sat.
175
181
 
176
182
  ```ts
177
183
  import { oc } from '@orangecheck/me-client';
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { v as verifyActivityAttestation, r as refreshEnvelopeJwks } from './identity-DfxCvxuH.mjs';
2
2
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity } from './identity-DfxCvxuH.mjs';
3
- import { S as Scope, B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-fTchEeNJ.mjs';
4
- export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, D as DropCadence, o as DropClosedWebhookPayload, q as DropResponseBlock, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-fTchEeNJ.mjs';
3
+ import { S as Scope, B as BillableEvent, D as DropResponseBlock, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-BiJgTlse.mjs';
4
+ export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, o as DropCadence, q as DropClosedWebhookPayload, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-BiJgTlse.mjs';
5
5
  export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.mjs';
6
6
 
7
7
  type FamilyVerb = 'oc-vote' | 'oc-stamp' | 'oc-agent' | 'oc-attest' | 'oc-lock' | 'oc-pledge';
@@ -68,6 +68,7 @@ interface FireEventOptions {
68
68
  project_key: string;
69
69
  subtype: EventKey;
70
70
  action_label?: string;
71
+ note?: string;
71
72
  payment_amount_sats?: number;
72
73
  metadata?: Record<string, unknown>;
73
74
  is_agent?: boolean;
@@ -81,8 +82,22 @@ type FireEventResult = {
81
82
  ok: true;
82
83
  earned: true;
83
84
  event: BillableEvent;
85
+ webhooks_queued: number;
84
86
  webhooks_fired: number;
85
- escrow_mode: 'simulation' | 'live';
87
+ escrow_mode?: 'simulation' | 'live';
88
+ drop?: DropResponseBlock;
89
+ idempotent_replay?: boolean;
90
+ simulation_mode_note?: string;
91
+ } | {
92
+ ok: true;
93
+ earned: false;
94
+ reason: 'not_billed';
95
+ detail: string;
96
+ event: BillableEvent;
97
+ webhooks_queued: number;
98
+ webhooks_fired: number;
99
+ escrow_mode?: 'simulation' | 'live';
100
+ drop?: DropResponseBlock;
86
101
  idempotent_replay?: boolean;
87
102
  simulation_mode_note?: string;
88
103
  } | {
@@ -106,6 +121,7 @@ type BatchEventResult = {
106
121
  index: number;
107
122
  status: 'recorded';
108
123
  event: BillableEvent;
124
+ drop?: DropResponseBlock;
109
125
  } | {
110
126
  index: number;
111
127
  status: 'duplicate';
@@ -136,7 +152,7 @@ declare function fireBatch(options: FireBatchOptions): Promise<FireBatchResponse
136
152
  interface VerifyEventResult {
137
153
  ok: boolean;
138
154
  issues: Array<{
139
- field: 'gross_fee_sats' | 'platform_fee_sats' | 'user_earned_sats' | 'site_rebate_sats' | 'subtype_disabled' | 'subtype_unconfigured' | 'percent_amount_missing' | 'outside_pay_period';
155
+ field: 'gross_fee_sats' | 'platform_fee_sats' | 'user_earned_sats' | 'site_rebate_sats' | 'subtype_disabled' | 'subtype_unconfigured' | 'percent_amount_missing' | 'agent_refused' | 'outside_pay_period';
140
156
  expected: number | null;
141
157
  actual: number | null;
142
158
  message: string;
@@ -261,4 +277,4 @@ declare const oc: {
261
277
  };
262
278
  };
263
279
 
264
- export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
280
+ export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, DropResponseBlock, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { v as verifyActivityAttestation, r as refreshEnvelopeJwks } from './identity-DfxCvxuH.js';
2
2
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity } from './identity-DfxCvxuH.js';
3
- import { S as Scope, B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-fTchEeNJ.js';
4
- export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, D as DropCadence, o as DropClosedWebhookPayload, q as DropResponseBlock, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-fTchEeNJ.js';
3
+ import { S as Scope, B as BillableEvent, D as DropResponseBlock, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-BiJgTlse.js';
4
+ export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, o as DropCadence, q as DropClosedWebhookPayload, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-BiJgTlse.js';
5
5
  export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.js';
6
6
 
7
7
  type FamilyVerb = 'oc-vote' | 'oc-stamp' | 'oc-agent' | 'oc-attest' | 'oc-lock' | 'oc-pledge';
@@ -68,6 +68,7 @@ interface FireEventOptions {
68
68
  project_key: string;
69
69
  subtype: EventKey;
70
70
  action_label?: string;
71
+ note?: string;
71
72
  payment_amount_sats?: number;
72
73
  metadata?: Record<string, unknown>;
73
74
  is_agent?: boolean;
@@ -81,8 +82,22 @@ type FireEventResult = {
81
82
  ok: true;
82
83
  earned: true;
83
84
  event: BillableEvent;
85
+ webhooks_queued: number;
84
86
  webhooks_fired: number;
85
- escrow_mode: 'simulation' | 'live';
87
+ escrow_mode?: 'simulation' | 'live';
88
+ drop?: DropResponseBlock;
89
+ idempotent_replay?: boolean;
90
+ simulation_mode_note?: string;
91
+ } | {
92
+ ok: true;
93
+ earned: false;
94
+ reason: 'not_billed';
95
+ detail: string;
96
+ event: BillableEvent;
97
+ webhooks_queued: number;
98
+ webhooks_fired: number;
99
+ escrow_mode?: 'simulation' | 'live';
100
+ drop?: DropResponseBlock;
86
101
  idempotent_replay?: boolean;
87
102
  simulation_mode_note?: string;
88
103
  } | {
@@ -106,6 +121,7 @@ type BatchEventResult = {
106
121
  index: number;
107
122
  status: 'recorded';
108
123
  event: BillableEvent;
124
+ drop?: DropResponseBlock;
109
125
  } | {
110
126
  index: number;
111
127
  status: 'duplicate';
@@ -136,7 +152,7 @@ declare function fireBatch(options: FireBatchOptions): Promise<FireBatchResponse
136
152
  interface VerifyEventResult {
137
153
  ok: boolean;
138
154
  issues: Array<{
139
- field: 'gross_fee_sats' | 'platform_fee_sats' | 'user_earned_sats' | 'site_rebate_sats' | 'subtype_disabled' | 'subtype_unconfigured' | 'percent_amount_missing' | 'outside_pay_period';
155
+ field: 'gross_fee_sats' | 'platform_fee_sats' | 'user_earned_sats' | 'site_rebate_sats' | 'subtype_disabled' | 'subtype_unconfigured' | 'percent_amount_missing' | 'agent_refused' | 'outside_pay_period';
140
156
  expected: number | null;
141
157
  actual: number | null;
142
158
  message: string;
@@ -261,4 +277,4 @@ declare const oc: {
261
277
  };
262
278
  };
263
279
 
264
- export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
280
+ export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, DropResponseBlock, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
package/dist/index.js CHANGED
@@ -320,12 +320,15 @@ var INHERITED_NAMES = new Set(
320
320
  function isInheritedName(key) {
321
321
  return INHERITED_NAMES.has(key.toLowerCase());
322
322
  }
323
+ function sitePaysFor(cfg, is_agent) {
324
+ return is_agent && cfg.agent?.site_pays ? cfg.agent.site_pays : cfg.site_pays;
325
+ }
323
326
  function computeFees(cfg, payment_amount_sats, opts) {
324
327
  const is_agent = opts?.is_agent === true;
325
328
  if (is_agent && cfg.agent?.refuse) {
326
329
  throw new Error("agent_refused");
327
330
  }
328
- const effective_site_pays = is_agent && cfg.agent?.site_pays ? cfg.agent.site_pays : cfg.site_pays;
331
+ const effective_site_pays = sitePaysFor(cfg, is_agent);
329
332
  const effective_user_share_pct = is_agent && typeof cfg.agent?.user_share_pct === "number" ? cfg.agent.user_share_pct : cfg.user_share_pct;
330
333
  let gross = 0;
331
334
  if (effective_site_pays.kind === "fixed_sats") {
@@ -490,6 +493,7 @@ async function fire(options) {
490
493
  if (options.payment_amount_sats !== void 0)
491
494
  requestBody.payment_amount_sats = options.payment_amount_sats;
492
495
  if (options.action_label !== void 0) requestBody.action_label = options.action_label;
496
+ if (options.note !== void 0) requestBody.note = options.note;
493
497
  if (options.is_agent !== void 0) requestBody.is_agent = options.is_agent;
494
498
  if (earner !== void 0) requestBody.user_address = earner;
495
499
  const headers = {};
@@ -575,7 +579,23 @@ function verify(envelope, config2, payment_amount_sats, opts = {}) {
575
579
  ]
576
580
  };
577
581
  }
578
- if (eventCfg.site_pays.kind === "percent_of_amount" && payment_amount_sats == null) {
582
+ const is_agent = envelope.is_agent === true;
583
+ if (is_agent && eventCfg.agent?.refuse) {
584
+ return {
585
+ ok: false,
586
+ expected: null,
587
+ issues: [
588
+ ...issues,
589
+ {
590
+ field: "agent_refused",
591
+ expected: null,
592
+ actual: null,
593
+ message: `subtype ${envelope.subtype} refuses agents on integrator ${config2.project_key} but an agent's event was billed`
594
+ }
595
+ ]
596
+ };
597
+ }
598
+ if (sitePaysFor(eventCfg, is_agent).kind === "percent_of_amount" && payment_amount_sats == null) {
579
599
  return {
580
600
  ok: false,
581
601
  expected: null,
@@ -590,7 +610,7 @@ function verify(envelope, config2, payment_amount_sats, opts = {}) {
590
610
  ]
591
611
  };
592
612
  }
593
- const expected = computeFees(eventCfg, payment_amount_sats);
613
+ const expected = computeFees(eventCfg, payment_amount_sats, { is_agent });
594
614
  if (envelope.gross_fee_sats !== expected.gross_fee_sats) {
595
615
  issues.push({
596
616
  field: "gross_fee_sats",