@zkp2p/pay-shared 4.0.0 → 5.0.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/dist/types.d.ts CHANGED
@@ -62,6 +62,7 @@ export type CheckoutMethodType = typeof CheckoutMethod[keyof typeof CheckoutMeth
62
62
  export declare const FeePayer: {
63
63
  readonly MERCHANT: "MERCHANT";
64
64
  readonly PAYEE: "PAYEE";
65
+ readonly SPLIT: "SPLIT";
65
66
  };
66
67
  export type FeePayerType = typeof FeePayer[keyof typeof FeePayer];
67
68
  export declare const MerchantPaymentFlowMode: {
@@ -147,11 +148,95 @@ export type SettlementReferralFeeEntry = {
147
148
  recipient: string;
148
149
  feeUsdc: string;
149
150
  };
151
+ /** FIXED orders carry an amount from creation; OPEN orders get one when the buyer starts a payment. */
152
+ export declare const OrderAmountMode: {
153
+ readonly FIXED: "FIXED";
154
+ readonly OPEN: "OPEN";
155
+ };
156
+ export type OrderAmountModeType = typeof OrderAmountMode[keyof typeof OrderAmountMode];
157
+ /**
158
+ * Why the buyer can no longer change an open order's amount. Precedence when several apply:
159
+ * PAID, then PAYMENT_MAY_SETTLE, then PAYMENT_IN_PROGRESS.
160
+ */
161
+ export declare const AmountLockReason: {
162
+ /** Only CREATED non-Zcash payments lock the amount; cancelling them unlocks it. */
163
+ readonly PAYMENT_IN_PROGRESS: "PAYMENT_IN_PROGRESS";
164
+ /** An EXPIRED payment, a locking Zcash payment or a reopenable FAILED Relay payment can still settle; cancelling cannot unlock it. */
165
+ readonly PAYMENT_MAY_SETTLE: "PAYMENT_MAY_SETTLE";
166
+ /** A SETTLED payment exists. */
167
+ readonly PAID: "PAID";
168
+ };
169
+ export type AmountLockReasonType = typeof AmountLockReason[keyof typeof AmountLockReason];
170
+ export declare const OpenAmountErrorCode: {
171
+ readonly OPEN_AMOUNT_INVALID: "OPEN_AMOUNT_INVALID";
172
+ readonly OPEN_AMOUNT_DISABLED: "OPEN_AMOUNT_DISABLED";
173
+ readonly AMOUNT_REQUIRED: "AMOUNT_REQUIRED";
174
+ readonly AMOUNT_NOT_ALLOWED: "AMOUNT_NOT_ALLOWED";
175
+ readonly AMOUNT_OUT_OF_RANGE: "AMOUNT_OUT_OF_RANGE";
176
+ readonly AMOUNT_LOCKED: "AMOUNT_LOCKED";
177
+ readonly AMOUNT_CONFLICT: "AMOUNT_CONFLICT";
178
+ readonly RESIZE_NOT_SUPPORTED: "RESIZE_NOT_SUPPORTED";
179
+ };
180
+ export type OpenAmountErrorCodeType = typeof OpenAmountErrorCode[keyof typeof OpenAmountErrorCode];
181
+ /** Merchant request shape. Amounts are positive decimals in `currency` with at most 2 decimals. */
182
+ export type OpenAmountInput = {
183
+ currency: string;
184
+ minAmount?: string;
185
+ maxAmount?: string;
186
+ presets?: string[];
187
+ };
188
+ /** Stored + API shape (normalized: upper-case currency, 2-dp decimal strings, presets sorted asc, unique). */
189
+ export type OpenAmountConfig = {
190
+ currency: string;
191
+ minAmount: string | null;
192
+ maxAmount: string | null;
193
+ presets: string[];
194
+ };
195
+ /** The buyer's saved amount and the currency they typed it in (the checkout's selected currency, which may differ from `openAmount.currency`). */
196
+ export type OpenAmountSavedInput = {
197
+ amount: string;
198
+ currency: string;
199
+ };
200
+ /**
201
+ * Platform-quotes `openAmountDisplay` (amendment 2026-10-05): an unlocked open order's range and
202
+ * presets in the request's `fiatCurrency`. In the order's own currency the merchant's values are
203
+ * exact, cents kept; in any other currency they are whole units (minimum rounded up, maximum down,
204
+ * presets half-up and clamped into the range). The bounds and `currencyPerOrderUnit` are null, and
205
+ * `presets` is empty, when an exchange rate is unavailable.
206
+ */
207
+ export type OpenAmountDisplay = {
208
+ currency: string;
209
+ effectiveMin: string | null;
210
+ effectiveMax: string | null;
211
+ presets: string[];
212
+ /** Units of `currency` one unit of `openAmount.currency` buys at the rates used, as a decimal string; null when unavailable. */
213
+ currencyPerOrderUnit: string | null;
214
+ };
215
+ /** Hosted (checkout) only. */
216
+ export type HostedOpenAmount = OpenAmountConfig & {
217
+ /** In `currency`, 2 dp, rounded UP. Null while locked, once FULFILLED or CANCELLED, or when the live rate is unavailable. */
218
+ effectiveMin: string | null;
219
+ /** In `currency`, 2 dp, rounded DOWN. Null while locked, once FULFILLED or CANCELLED, or when the live rate is unavailable. */
220
+ effectiveMax: string | null;
221
+ /** The buyer's saved amount in the currency they typed it in, or null before the first payment start. */
222
+ savedInput: OpenAmountSavedInput | null;
223
+ };
224
+ /** `ORDER_AMOUNT_SET` webhook detail. */
225
+ export type OrderAmountChange = {
226
+ previousAmountUsdc: string | null;
227
+ newAmountUsdc: string;
228
+ /** The amount the buyer typed, in the currency they typed it in (the checkout's selected currency). */
229
+ fiat: OpenAmountSavedInput;
230
+ amountVersion: number;
231
+ };
150
232
  type CreateOrderRequestBase = {
233
+ idempotencyKey?: string;
151
234
  destinationAddress?: string;
152
235
  destinationToken?: string;
153
236
  destinationChainId?: number;
154
237
  feePayer?: FeePayerType;
238
+ /** SPLIT buyer share of total fees, in basis points (0–10000, steps of 1000). */
239
+ buyerFeeShareBps?: number;
155
240
  enabledRails?: string[];
156
241
  dynamicOrdersEnabled?: boolean;
157
242
  successUrl?: string | null;
@@ -162,13 +247,21 @@ type CreateOrderRequestWithUsdc = CreateOrderRequestBase & {
162
247
  requestedUsdcAmount: string;
163
248
  requestedFiatAmount?: never;
164
249
  requestedFiatCurrency?: never;
250
+ openAmount?: never;
165
251
  };
166
252
  type CreateOrderRequestWithFiat = CreateOrderRequestBase & {
167
253
  requestedUsdcAmount?: never;
168
254
  requestedFiatAmount: string;
169
255
  requestedFiatCurrency: string;
256
+ openAmount?: never;
170
257
  };
171
- export type CreateOrderRequest = CreateOrderRequestWithUsdc | CreateOrderRequestWithFiat;
258
+ type CreateOrderRequestWithOpenAmount = CreateOrderRequestBase & {
259
+ requestedUsdcAmount?: never;
260
+ requestedFiatAmount?: never;
261
+ requestedFiatCurrency?: never;
262
+ openAmount: OpenAmountInput;
263
+ };
264
+ export type CreateOrderRequest = CreateOrderRequestWithUsdc | CreateOrderRequestWithFiat | CreateOrderRequestWithOpenAmount;
172
265
  export type CheckoutRequest = CreateOrderRequest;
173
266
  export type MerchantCheckoutTheme = {
174
267
  presetName?: 'default' | 'dark' | 'light' | 'custom';
@@ -196,7 +289,7 @@ export type CheckoutMerchant = {
196
289
  /** Whether the merchant has been verified by ZKP2P. */
197
290
  verified: boolean;
198
291
  };
199
- export type CheckoutOrder = {
292
+ type CheckoutOrderBase = {
200
293
  id: string;
201
294
  merchantId: string;
202
295
  status: CheckoutOrderStatusType;
@@ -208,12 +301,18 @@ export type CheckoutOrder = {
208
301
  refundTransactionHash: string | null;
209
302
  refundMetadata: unknown | null;
210
303
  inPersonCheckout: boolean;
211
- requestedUsdcAmount: string;
212
- remainingUsdcAmount: string;
304
+ /**
305
+ * USDC the customer would be charged for the current outstanding balance if they
306
+ * paid by Apple Pay, grossed up by the merchant's Apple Pay fee when the payer
307
+ * owes it. Hosted aggregates only; null when Apple Pay is disabled or pricing
308
+ * cannot be resolved. Checkout hides Apple Pay when it is above the 2,500 USDC cap.
309
+ */
310
+ applePayChargeUsdcAmount?: string | null;
213
311
  destinationAddress: string;
214
312
  destinationToken: string;
215
313
  destinationChainId: string;
216
314
  feePayer: FeePayerType;
315
+ buyerFeeShareBps: number;
217
316
  enabledRails: string[];
218
317
  successUrl: string | null;
219
318
  cancelUrl: string | null;
@@ -231,7 +330,34 @@ export type CheckoutOrder = {
231
330
  createdAt: string;
232
331
  updatedAt: string | null;
233
332
  };
333
+ export type FixedAmountCheckoutOrder = CheckoutOrderBase & {
334
+ amountMode: typeof OrderAmountMode.FIXED;
335
+ requestedUsdcAmount: string;
336
+ remainingUsdcAmount: string;
337
+ };
338
+ /** Amounts stay null until the buyer starts the first payment; `amountVersion` is 0 until then. */
339
+ export type OpenAmountCheckoutOrder = CheckoutOrderBase & {
340
+ amountMode: typeof OrderAmountMode.OPEN;
341
+ requestedUsdcAmount: string | null;
342
+ remainingUsdcAmount: string | null;
343
+ openAmount: OpenAmountConfig;
344
+ amountVersion: number;
345
+ };
346
+ /** Narrow on `amountMode` before reading amounts. */
347
+ export type CheckoutOrder = FixedAmountCheckoutOrder | OpenAmountCheckoutOrder;
348
+ /** Hosted aggregate shape of an open order: effective range, saved input and lock state. */
349
+ export type HostedOpenAmountCheckoutOrder = Omit<OpenAmountCheckoutOrder, 'openAmount'> & {
350
+ openAmount: HostedOpenAmount;
351
+ /** Computed server-side from the order's payments; null means the buyer may change the amount. */
352
+ amountLock: AmountLockReasonType | null;
353
+ };
354
+ export type HostedCheckoutOrder = FixedAmountCheckoutOrder | HostedOpenAmountCheckoutOrder;
234
355
  export type CheckoutPaymentQuote = {
356
+ /** Full-size economics when Peer funds a smaller executable intent. */
357
+ amountAdjustment?: {
358
+ requestedSignalAmountRaw: string;
359
+ buyerFiatAmount: string;
360
+ };
235
361
  conversionRate?: string;
236
362
  signalIntent: {
237
363
  processorName: string;
@@ -266,6 +392,8 @@ export type CheckoutNearbySuggestion = {
266
392
  tokenAmount: string;
267
393
  percentDifference: string;
268
394
  rail: string;
395
+ /** Open-amount orders only: the suggestion in the quote's `fiatCurrency`, 2 dp, rounded down. */
396
+ inputAmount?: string;
269
397
  };
270
398
  export type CheckoutNearbySuggestions = {
271
399
  status: 'suggestions' | 'none' | 'ineligible' | 'unavailable';
@@ -275,6 +403,8 @@ export type CheckoutNearbySuggestions = {
275
403
  export type QuoteAvailabilityRequest = {
276
404
  amount: string;
277
405
  quoteMode: CheckoutModeType;
406
+ /** Match the checkout's enabledRails override. Defaults to merchant rails; any matching rail suffices. */
407
+ enabledRails?: string[];
278
408
  fiatCurrency?: string;
279
409
  destinationChainId: string | number;
280
410
  destinationToken: string;
@@ -306,6 +436,31 @@ export type CheckoutQuotes = {
306
436
  fiatCurrency: string;
307
437
  platforms: CheckoutQuoteEntry[];
308
438
  nearbySuggestions?: CheckoutNearbySuggestions;
439
+ /** Open order with no saved amount and no `amount` query parameter: `platforms` is empty. */
440
+ amountRequired?: true;
441
+ /** Open orders, when `amount` (in `fiatCurrency`) was sent: the draft converted to USDC. */
442
+ amountUsdc?: string;
443
+ /** Open orders, when `amount` was sent: Apple Pay pricing of the draft. */
444
+ applePay?: {
445
+ chargeUsdcAmount: string | null;
446
+ eligible: boolean;
447
+ };
448
+ /** Unlocked open orders that are not fulfilled or cancelled, with or without `amount`: the range and presets in `fiatCurrency`. */
449
+ openAmountDisplay?: OpenAmountDisplay;
450
+ };
451
+ export declare const PaymentPenaltyKind: {
452
+ readonly PURCHASE_PROTECTION: "PURCHASE_PROTECTION";
453
+ readonly CROSS_CURRENCY: "CROSS_CURRENCY";
454
+ };
455
+ export type PaymentPenaltyKindType = (typeof PaymentPenaltyKind)[keyof typeof PaymentPenaltyKind];
456
+ /** One attestation-applied reduction of the credited fiat amount. Amounts are in the payment's `currency`. */
457
+ export type PaymentPenalty = {
458
+ kind: PaymentPenaltyKindType;
459
+ penaltyBps: number;
460
+ /** Pre-penalty amount in `payment.currency`, 2-decimal string. */
461
+ originalAmount: string;
462
+ /** Post-penalty amount actually credited, same units. */
463
+ attestedAmount: string;
309
464
  };
310
465
  export type CheckoutPayment = {
311
466
  id: string;
@@ -313,6 +468,7 @@ export type CheckoutPayment = {
313
468
  status: CheckoutPaymentStatusType;
314
469
  chargebackStatus: PaymentChargebackStatusType;
315
470
  chargeback: PaymentChargebackFact | null;
471
+ penalties: PaymentPenalty[];
316
472
  rail: string;
317
473
  paymentMethodId: string | null;
318
474
  proofMode: ProofMode;
@@ -344,15 +500,25 @@ export type CheckoutAggregatePayment = Omit<CheckoutPayment, 'paymentMethodId'>
344
500
  paymentMethodId?: string | null;
345
501
  };
346
502
  export type CheckoutAggregate = {
347
- order: CheckoutOrder;
503
+ order: HostedCheckoutOrder;
348
504
  merchant: CheckoutMerchant;
349
505
  currentPayment: CheckoutAggregatePayment | null;
350
506
  };
507
+ /** Public GET /api/v1/orders/:orderId responseObject. */
508
+ export type HostedCheckoutResponse = CheckoutAggregate & {
509
+ paymentCreationPaused: boolean;
510
+ };
351
511
  export type CreateOrderResponse = {
352
512
  order: CheckoutOrder;
513
+ } & ({
353
514
  orderToken: string;
354
- };
355
- export type CreatePaymentRequest = {
515
+ idempotentReplay?: never;
516
+ } | {
517
+ orderToken: null;
518
+ idempotentReplay: true;
519
+ });
520
+ type CreatePaymentRequestBase = {
521
+ onrampProvider?: 'coinbase_apple_pay';
356
522
  rail: string;
357
523
  paymentMethodId?: string;
358
524
  fiatCurrency?: string;
@@ -362,6 +528,23 @@ export type CreatePaymentRequest = {
362
528
  excludedPayToValues?: string[];
363
529
  refundTo?: string;
364
530
  };
531
+ /**
532
+ * Open-amount orders: `amount`, the fiat `amountCurrency` it is typed in (the checkout's selected
533
+ * currency, sent on crypto and Apple Pay starts too) and the `amountVersion` the buyer loaded travel
534
+ * together, or not at all.
535
+ * On fiat rails, starts with `amount` require `fiatCurrency` to equal `amountCurrency`;
536
+ * omitted `fiatCurrency` means USD. A mismatch returns HTTP 400. Crypto and Apple Pay
537
+ * starts are exempt from this check.
538
+ */
539
+ export type CreatePaymentRequest = CreatePaymentRequestBase & ({
540
+ amount?: never;
541
+ amountCurrency?: never;
542
+ expectedAmountVersion?: never;
543
+ } | {
544
+ amount: string;
545
+ amountCurrency: string;
546
+ expectedAmountVersion: number;
547
+ });
365
548
  export type CheckoutPaymentCreationResponse = CheckoutPayment & {
366
549
  relayerTransactionId?: string;
367
550
  recipientRecovery?: 'matched' | 'missed' | 'not_applicable';
@@ -369,9 +552,9 @@ export type CheckoutPaymentCreationResponse = CheckoutPayment & {
369
552
  export type PaymentDeeplinkResponse = {
370
553
  paymentId: string;
371
554
  orderId: string;
372
- intentHash: string;
555
+ intentHash: string | null;
373
556
  url: string;
374
- proofSubmissionUrl: string;
557
+ proofSubmissionUrl: string | null;
375
558
  checkoutReturnUrl: string;
376
559
  linkKind?: 'app_clip' | 'deeplink';
377
560
  };
@@ -380,27 +563,40 @@ export type MerchantConfig = {
380
563
  id: string;
381
564
  merchantId: string;
382
565
  feePayer: FeePayerType;
566
+ buyerFeeShareBps: number;
383
567
  enabledRails: string[];
568
+ applePayAvailable: boolean;
384
569
  defaultPaymentCurrency: string | null;
385
570
  destinationChainId: string;
386
571
  destinationToken: string;
387
572
  sweepEnabled: boolean;
388
- recipientOverrideEnabled: boolean;
389
573
  disableBranding: boolean;
390
574
  dynamicOrdersEnabled: boolean;
391
575
  merchantCheckoutTheme: MerchantCheckoutTheme;
392
576
  platformReferralFeeConfig: ReferralFeeConfig | null;
393
577
  referralSplitConfig: ReferralSplitConfig | null;
394
578
  flatFeePricing: boolean;
579
+ /** Admin-managed: this merchant may create Master Merchant Account sub-merchants. */
580
+ masterMerchantEnabled: boolean;
581
+ /** Admin-managed cap, in bps, for the master merchant fee on this merchant's sub-merchants; null means no Master Merchant Account-specific cap. */
582
+ masterMerchantMaxFeeBps: number | null;
395
583
  createdAt: string;
396
584
  updatedAt: string | null;
397
585
  };
586
+ export declare const MerchantUserRole: {
587
+ readonly OWNER: "OWNER";
588
+ readonly MANAGER: "MANAGER";
589
+ readonly CASHIER: "CASHIER";
590
+ };
591
+ export type MerchantUserRoleType = typeof MerchantUserRole[keyof typeof MerchantUserRole];
398
592
  export type MerchantUser = {
399
593
  id: string;
400
594
  email: string | null;
401
595
  privyUserId: string | null;
402
596
  v1PrivyUserId: string | null;
403
- role: 'OWNER' | 'MANAGER' | 'CASHIER';
597
+ role: MerchantUserRoleType;
598
+ /** Master Merchant Account seat after an ownership transfer: it cannot be removed by merchant users, only by an admin. */
599
+ removalLocked: boolean;
404
600
  merchantId: string | null;
405
601
  createdAt: string;
406
602
  updatedAt: string | null;
@@ -416,6 +612,8 @@ export type MerchantProfile = {
416
612
  onboardingCompletedAt: string | null;
417
613
  onboardingSkippedAt: string | null;
418
614
  apiKey: string;
615
+ /** Canonical IPv4/IPv6 CIDR entries allowed to use the API key; empty means the allowlist is off. */
616
+ apiKeyIpAllowlist: string[];
419
617
  environment: MerchantEnvironmentType;
420
618
  sandboxMerchantId: string | null;
421
619
  inPersonCheckoutEnabled: boolean;
@@ -424,12 +622,16 @@ export type MerchantProfile = {
424
622
  v1EvmWalletAddress: string | null;
425
623
  v1SolanaWalletAddress: string | null;
426
624
  tier: MerchantTierName | null;
625
+ /** The Master Merchant Account merchant that created this sub-merchant; null for every other merchant. */
626
+ masterMerchantId: string | null;
427
627
  createdAt: string;
428
628
  updatedAt: string | null;
429
629
  merchantConfig: MerchantConfig | null;
430
630
  merchantUsers: MerchantUser[];
431
631
  };
632
+ export declare const PAYMENT_CREATION_PAUSED_MESSAGE = "Payments are temporarily paused. Please try again shortly.";
432
633
  export declare const OrderErrorCode: {
634
+ readonly PAYMENTS_PAUSED: "PAYMENTS_PAUSED";
433
635
  readonly PROOF_INVALID: "PROOF_INVALID";
434
636
  readonly PROOF_EXPIRED: "PROOF_EXPIRED";
435
637
  readonly PROOF_RECIPIENT_MISMATCH: "PROOF_RECIPIENT_MISMATCH";
@@ -442,6 +644,7 @@ export declare const OrderErrorCode: {
442
644
  readonly ATTESTATION_ERROR: "ATTESTATION_ERROR";
443
645
  readonly BRIDGE_TIMEOUT: "BRIDGE_TIMEOUT";
444
646
  readonly FEE_THRESHOLD_EXCEEDED: "FEE_THRESHOLD_EXCEEDED";
647
+ readonly INTENT_ABOVE_MAX: "INTENT_ABOVE_MAX";
445
648
  readonly SDK_ERROR: "SDK_ERROR";
446
649
  readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
447
650
  };
@@ -690,7 +893,14 @@ export type StartSessionRequest = {
690
893
  originToken: PayCryptoTokenSymbol;
691
894
  };
692
895
  export type RelayCryptoPaymentStatus = 'refund' | 'delayed' | 'waiting' | 'failure' | 'pending' | 'success';
896
+ export type NearIntentsPaymentDetails = {
897
+ status: 'PENDING_DEPOSIT' | 'KNOWN_DEPOSIT_TX' | 'INCOMPLETE_DEPOSIT' | 'PROCESSING' | 'SUCCESS' | 'REFUNDED' | 'FAILED';
898
+ deadline: string;
899
+ refundAddress: string;
900
+ refundedAmount?: string;
901
+ };
693
902
  export type CheckoutCryptoPayment = {
903
+ nearIntents?: NearIntentsPaymentDetails;
694
904
  requestId: string;
695
905
  status: RelayCryptoPaymentStatus;
696
906
  depositAddress: string;
@@ -787,6 +997,12 @@ export type OnboardingStepState = {
787
997
  status: OnboardingStepStatusValue;
788
998
  verifiedBy: OnboardingStepVerifiedByValue;
789
999
  };
1000
+ /**
1001
+ * responseObject of GET /api/v1/merchants/dashboard/me/onboarding,
1002
+ * POST /api/v1/merchants/dashboard/me/onboarding/steps/:stepId/ack, and
1003
+ * POST /api/v1/merchants/dashboard/me/onboarding/skip.
1004
+ * For POST routes, this is the state after the write is applied.
1005
+ */
790
1006
  export type MerchantOnboardingResponse = {
791
1007
  path: MerchantIntegrationPathValue | null;
792
1008
  sandboxApiKey: string | null;
@@ -794,11 +1010,25 @@ export type MerchantOnboardingResponse = {
794
1010
  skippedAt: string | null;
795
1011
  steps: OnboardingStepState[];
796
1012
  };
1013
+ export declare const MERCHANT_REFERRAL_FEE_BPS_BY_TIER: Readonly<Record<MerchantTierName, number>>;
1014
+ export type MerchantReferralReferredMerchant = {
1015
+ id: string;
1016
+ name: string;
1017
+ createdAt: string;
1018
+ };
1019
+ export type MerchantReferralProgramResponse = {
1020
+ code: string;
1021
+ referralFeeBpsByTier: Readonly<Record<MerchantTierName, number>>;
1022
+ recipientAddress: string;
1023
+ totalReferred: number;
1024
+ referredMerchants: MerchantReferralReferredMerchant[];
1025
+ };
797
1026
  export declare const WebhookEventType: {
798
1027
  readonly ORDER_CREATED: "ORDER_CREATED";
799
1028
  readonly ORDER_FULFILLED: "ORDER_FULFILLED";
800
1029
  readonly ORDER_CANCELLED: "ORDER_CANCELLED";
801
1030
  readonly ORDER_RESIZED: "ORDER_RESIZED";
1031
+ readonly ORDER_AMOUNT_SET: "ORDER_AMOUNT_SET";
802
1032
  readonly PAYMENT_CREATED: "PAYMENT_CREATED";
803
1033
  readonly PAYMENT_SETTLED: "PAYMENT_SETTLED";
804
1034
  readonly PAYMENT_CANCELLED: "PAYMENT_CANCELLED";
@@ -867,6 +1097,8 @@ export type WebhookPayload = {
867
1097
  previousAmountUsdc: string;
868
1098
  newAmountUsdc: string;
869
1099
  };
1100
+ /** Only on `ORDER_AMOUNT_SET`. */
1101
+ amountChange?: OrderAmountChange;
870
1102
  };
871
1103
  };
872
1104
  export type CreateWebhookRequest = {
@@ -896,4 +1128,77 @@ export type TestWebhookResponse = {
896
1128
  responseCode?: number | null;
897
1129
  error?: string | null;
898
1130
  };
1131
+ /**
1132
+ * Wallet-snapshot fence rejections (ownership-transfer era rule). PR 4-6 add keys to this object.
1133
+ * MERCHANT_OWNERSHIP_CHANGED is retryable: an order insert lost the era it read its wallet in.
1134
+ * ORDER_FROM_PREVIOUS_OWNER is final: the order belongs to an earlier owner's era.
1135
+ */
1136
+ export declare const MerchantOwnershipErrorCode: {
1137
+ readonly MERCHANT_OWNERSHIP_CHANGED: "MERCHANT_OWNERSHIP_CHANGED";
1138
+ readonly ORDER_FROM_PREVIOUS_OWNER: "ORDER_FROM_PREVIOUS_OWNER";
1139
+ readonly MEMBER_LOCKED: "MEMBER_LOCKED";
1140
+ /** 403: the current merchant is not an enabled, LIVE, eligible Master Merchant Account. */
1141
+ readonly MASTER_MERCHANT_NOT_ENABLED: "MASTER_MERCHANT_NOT_ENABLED";
1142
+ /** 422: the master merchant fee is above the Master Merchant Account's masterMerchantMaxFeeBps, only when the Master Merchant Account has a cap. */
1143
+ readonly MASTER_MERCHANT_FEE_EXCEEDS_CAP: "MASTER_MERCHANT_FEE_EXCEEDS_CAP";
1144
+ /** 422: a payment method's configured fees for some amount band would exceed the max fee. */
1145
+ readonly MASTER_MERCHANT_FEE_EXCEEDS_MAX_FEE: "MASTER_MERCHANT_FEE_EXCEEDS_MAX_FEE";
1146
+ /** 409: the Master Merchant Account can no longer change this sub merchant's fee (transferred, or a transfer is pending). */
1147
+ readonly MASTER_MERCHANT_FEE_LOCKED: "MASTER_MERCHANT_FEE_LOCKED";
1148
+ readonly TRANSFER_ALREADY_PENDING: "TRANSFER_ALREADY_PENDING";
1149
+ readonly WALLET_SETUP_REQUIRED: "WALLET_SETUP_REQUIRED";
1150
+ readonly TERMS_CHANGED: "TERMS_CHANGED";
1151
+ readonly TRANSFER_NOT_FOUND: "TRANSFER_NOT_FOUND";
1152
+ readonly TRANSFER_EMAIL_MISMATCH: "TRANSFER_EMAIL_MISMATCH";
1153
+ readonly TRANSFER_UNAVAILABLE: "TRANSFER_UNAVAILABLE";
1154
+ };
1155
+ export type MerchantOwnershipErrorCodeType = typeof MerchantOwnershipErrorCode[keyof typeof MerchantOwnershipErrorCode];
1156
+ export declare const MERCHANT_OWNERSHIP_CHANGED_MESSAGE = "The merchant account changed owners while this order was being created. Retry to create it for the new owner.";
1157
+ export declare const ORDER_FROM_PREVIOUS_OWNER_MESSAGE = "This order was created before the merchant account changed owners. Ask the merchant for a new payment link.";
1158
+ export declare const ORDER_FROM_PREVIOUS_OWNER_REFUND_MESSAGE = "This order was created before the merchant account changed owners, so it cannot be refunded from this account.";
1159
+ /** Response copy for MEMBER_LOCKED: the Master Merchant Account seat after an ownership transfer can only be removed by an admin. */
1160
+ export declare const MEMBER_LOCKED_MESSAGE = "Locked merchant member can only be removed by an admin";
1161
+ export type OwnershipTransferErrorCodeType = typeof MerchantOwnershipErrorCode.TRANSFER_ALREADY_PENDING | typeof MerchantOwnershipErrorCode.WALLET_SETUP_REQUIRED | typeof MerchantOwnershipErrorCode.TERMS_CHANGED | typeof MerchantOwnershipErrorCode.TRANSFER_NOT_FOUND | typeof MerchantOwnershipErrorCode.TRANSFER_EMAIL_MISMATCH | typeof MerchantOwnershipErrorCode.TRANSFER_UNAVAILABLE;
1162
+ /** One user-facing message per ownership-transfer error; the API and the CLI simulator both send these. */
1163
+ export declare const OWNERSHIP_TRANSFER_ERROR_MESSAGES: Readonly<Record<OwnershipTransferErrorCodeType, string>>;
1164
+ /**
1165
+ * Routing states POST /auth/login returns (HTTP 200, `merchant: null`) instead of auto-claiming an
1166
+ * invite or auto-creating a merchant, while an ownership transfer applies to a user with no merchant.
1167
+ */
1168
+ export declare const OwnershipTransferLoginState: {
1169
+ readonly PENDING_OWNERSHIP_TRANSFER: "PENDING_OWNERSHIP_TRANSFER";
1170
+ readonly OWNERSHIP_TRANSFER_EMAIL_MISMATCH: "OWNERSHIP_TRANSFER_EMAIL_MISMATCH";
1171
+ readonly OWNERSHIP_TRANSFER_UNAVAILABLE: "OWNERSHIP_TRANSFER_UNAVAILABLE";
1172
+ };
1173
+ export type OwnershipTransferLoginStateType = typeof OwnershipTransferLoginState[keyof typeof OwnershipTransferLoginState];
1174
+ /** Discriminator of POST /auth/ownership-transfers/preview. EMAIL_MISMATCH is the spec's `emailMatches: false`. */
1175
+ export declare const OwnershipTransferPreviewState: {
1176
+ readonly PENDING: "PENDING";
1177
+ readonly EMAIL_MISMATCH: "EMAIL_MISMATCH";
1178
+ readonly ACCEPTED: "ACCEPTED";
1179
+ };
1180
+ export type OwnershipTransferPreviewStateType = typeof OwnershipTransferPreviewState[keyof typeof OwnershipTransferPreviewState];
1181
+ /** Mirrors the Prisma enum MerchantOwnershipTransferStatus for pure (Prisma-free) wire schemas. */
1182
+ export declare const OwnershipTransferStatus: {
1183
+ readonly PENDING: "PENDING";
1184
+ readonly ACCEPTED: "ACCEPTED";
1185
+ readonly CANCELLED: "CANCELLED";
1186
+ readonly EXPIRED: "EXPIRED";
1187
+ };
1188
+ export type OwnershipTransferStatusType = typeof OwnershipTransferStatus[keyof typeof OwnershipTransferStatus];
1189
+ export declare const MerchantOwnershipTransferCancelReason: {
1190
+ readonly MASTER_MERCHANT_CANCELLED: "MASTER_MERCHANT_CANCELLED";
1191
+ readonly TERMS_CHANGED: "TERMS_CHANGED";
1192
+ readonly MASTER_MERCHANT_FLAG_REMOVED: "MASTER_MERCHANT_FLAG_REMOVED";
1193
+ };
1194
+ export type MerchantOwnershipTransferCancelReasonType = typeof MerchantOwnershipTransferCancelReason[keyof typeof MerchantOwnershipTransferCancelReason];
1195
+ export declare const OwnershipTransferMasterMerchantPermission: {
1196
+ readonly CHECKOUT_CONFIG: "CHECKOUT_CONFIG";
1197
+ readonly TEAM: "TEAM";
1198
+ };
1199
+ export type OwnershipTransferMasterMerchantPermissionType = typeof OwnershipTransferMasterMerchantPermission[keyof typeof OwnershipTransferMasterMerchantPermission];
1200
+ /** What the Master Merchant Account's locked MANAGER seat keeps after a transfer (spec decisions 2 and 9; refunds are OWNER-only); the accept page lists exactly these. */
1201
+ export declare const OWNERSHIP_TRANSFER_MASTER_MERCHANT_PERMISSIONS: readonly OwnershipTransferMasterMerchantPermissionType[];
1202
+ /** "alice@example.com" → "a•••@example.com". The input is a validated, lowercased address. */
1203
+ export declare function maskOwnershipTransferEmail(email: string): string;
899
1204
  export {};