@zkp2p/pay-shared 6.0.0 → 7.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
@@ -1,3 +1,4 @@
1
+ import type { PAYOUT_RAIL_CURRENCIES, PayoutCurrencyType, PayoutFiatValue, PayoutOracleCurrencyType } from './cashoutCurrencies.js';
1
2
  import type { PayCryptoTokenSymbol } from './crypto.js';
2
3
  import type { ProofMode } from './buyerTee.js';
3
4
  import type { OnboardingStepIdValue } from './onboarding.js';
@@ -1044,21 +1045,21 @@ export declare const WebhookEventType: {
1044
1045
  readonly PAYMENT_CHARGEBACKED: "PAYMENT_CHARGEBACKED";
1045
1046
  readonly ORDER_PARTIALLY_CHARGEBACKED: "ORDER_PARTIALLY_CHARGEBACKED";
1046
1047
  readonly ORDER_CHARGEBACKED: "ORDER_CHARGEBACKED";
1047
- readonly CASHOUT_ORDER_CREATED: "CASHOUT_ORDER_CREATED";
1048
- readonly CASHOUT_ORDER_CANCELLED: "CASHOUT_ORDER_CANCELLED";
1049
- readonly CASHOUT_ORDER_PARTIALLY_FUNDED: "CASHOUT_ORDER_PARTIALLY_FUNDED";
1050
- readonly CASHOUT_ORDER_FUNDED: "CASHOUT_ORDER_FUNDED";
1051
- readonly CASHOUT_ORDER_MATCHED: "CASHOUT_ORDER_MATCHED";
1052
- readonly CASHOUT_ORDER_PARTIALLY_PAID: "CASHOUT_ORDER_PARTIALLY_PAID";
1053
- readonly CASHOUT_ORDER_SETTLED: "CASHOUT_ORDER_SETTLED";
1054
- readonly CASHOUT_ORDER_EXPIRED: "CASHOUT_ORDER_EXPIRED";
1048
+ readonly PAYOUT_ORDER_CREATED: "PAYOUT_ORDER_CREATED";
1049
+ readonly PAYOUT_ORDER_CANCELLED: "PAYOUT_ORDER_CANCELLED";
1050
+ readonly PAYOUT_ORDER_PARTIALLY_FUNDED: "PAYOUT_ORDER_PARTIALLY_FUNDED";
1051
+ readonly PAYOUT_ORDER_FUNDED: "PAYOUT_ORDER_FUNDED";
1052
+ readonly PAYOUT_ORDER_MATCHED: "PAYOUT_ORDER_MATCHED";
1053
+ readonly PAYOUT_ORDER_PARTIALLY_PAID: "PAYOUT_ORDER_PARTIALLY_PAID";
1054
+ readonly PAYOUT_ORDER_SETTLED: "PAYOUT_ORDER_SETTLED";
1055
+ readonly PAYOUT_ORDER_EXPIRED: "PAYOUT_ORDER_EXPIRED";
1055
1056
  };
1056
1057
  export type WebhookEventTypeValue = typeof WebhookEventType[keyof typeof WebhookEventType];
1057
- /** Cashout events carry a CashoutView, not the order envelope. */
1058
- export declare const CASHOUT_WEBHOOK_EVENT_TYPES: readonly ["CASHOUT_ORDER_CREATED", "CASHOUT_ORDER_CANCELLED", "CASHOUT_ORDER_PARTIALLY_FUNDED", "CASHOUT_ORDER_FUNDED", "CASHOUT_ORDER_MATCHED", "CASHOUT_ORDER_PARTIALLY_PAID", "CASHOUT_ORDER_SETTLED", "CASHOUT_ORDER_EXPIRED"];
1059
- export type CashoutWebhookEventTypeValue = typeof CASHOUT_WEBHOOK_EVENT_TYPES[number];
1060
- export type OrderWebhookEventTypeValue = Exclude<WebhookEventTypeValue, CashoutWebhookEventTypeValue>;
1061
- export declare function isCashoutWebhookEventType(type: string): type is CashoutWebhookEventTypeValue;
1058
+ /** Payout events carry a PayoutView, not the order envelope. */
1059
+ export declare const PAYOUT_WEBHOOK_EVENT_TYPES: readonly ["PAYOUT_ORDER_CREATED", "PAYOUT_ORDER_CANCELLED", "PAYOUT_ORDER_PARTIALLY_FUNDED", "PAYOUT_ORDER_FUNDED", "PAYOUT_ORDER_MATCHED", "PAYOUT_ORDER_PARTIALLY_PAID", "PAYOUT_ORDER_SETTLED", "PAYOUT_ORDER_EXPIRED"];
1060
+ export type PayoutWebhookEventTypeValue = typeof PAYOUT_WEBHOOK_EVENT_TYPES[number];
1061
+ export type OrderWebhookEventTypeValue = Exclude<WebhookEventTypeValue, PayoutWebhookEventTypeValue>;
1062
+ export declare function isPayoutWebhookEventType(type: string): type is PayoutWebhookEventTypeValue;
1062
1063
  export declare const WebhookDeliveryStatus: {
1063
1064
  readonly PENDING: "PENDING";
1064
1065
  readonly DELIVERED: "DELIVERED";
@@ -1115,11 +1116,11 @@ export type OrderWebhookPayload = {
1115
1116
  amountChange?: OrderAmountChange;
1116
1117
  };
1117
1118
  };
1118
- /** Bumped only on a breaking change to a cashout payload. */
1119
- export declare const CASHOUT_WEBHOOK_VERSION = 1;
1120
- /** One buyer payment that left part of the cashout unpaid; decimal USDC. */
1121
- export interface CashoutPartialPayment {
1122
- /** The cashout's depositAmount: what buyers can pay in total. */
1119
+ /** Bumped only on a breaking change to a payout payload. */
1120
+ export declare const PAYOUT_WEBHOOK_VERSION = 2;
1121
+ /** One buyer payment that left part of the payout unpaid; amounts are decimal USDC except fill.fiat. */
1122
+ export interface PayoutPartialPayment {
1123
+ /** The payout's depositAmount: what buyers can pay in total. */
1123
1124
  expectedAmount: string;
1124
1125
  /** What buyers have paid so far, this fill included. */
1125
1126
  paidAmount: string;
@@ -1128,32 +1129,34 @@ export interface CashoutPartialPayment {
1128
1129
  fill: {
1129
1130
  amount: string;
1130
1131
  txHash: string;
1132
+ /** Fiat paid at this fill's bound rate; null when the currency or rate is unknown. */
1133
+ fiat: PayoutFiatValue | null;
1131
1134
  };
1132
1135
  }
1133
- export type CashoutWebhookEventData = {
1134
- readonly type: Exclude<CashoutWebhookEventTypeValue, typeof WebhookEventType.CASHOUT_ORDER_PARTIALLY_PAID>;
1135
- readonly data: CashoutView;
1136
+ export type PayoutWebhookEventData = {
1137
+ readonly type: Exclude<PayoutWebhookEventTypeValue, typeof WebhookEventType.PAYOUT_ORDER_PARTIALLY_PAID>;
1138
+ readonly data: PayoutView;
1136
1139
  } | {
1137
- readonly type: typeof WebhookEventType.CASHOUT_ORDER_PARTIALLY_PAID;
1138
- readonly data: CashoutView;
1139
- readonly partialPayment: CashoutPartialPayment;
1140
+ readonly type: typeof WebhookEventType.PAYOUT_ORDER_PARTIALLY_PAID;
1141
+ readonly data: PayoutView;
1142
+ readonly partialPayment: PayoutPartialPayment;
1140
1143
  };
1141
- export type CashoutWebhookPayload = {
1144
+ export type PayoutWebhookPayload = {
1142
1145
  id: string;
1143
- type: Exclude<CashoutWebhookEventTypeValue, typeof WebhookEventType.CASHOUT_ORDER_PARTIALLY_PAID>;
1146
+ type: Exclude<PayoutWebhookEventTypeValue, typeof WebhookEventType.PAYOUT_ORDER_PARTIALLY_PAID>;
1144
1147
  timestamp: string;
1145
- version: typeof CASHOUT_WEBHOOK_VERSION;
1146
- data: CashoutView;
1148
+ version: typeof PAYOUT_WEBHOOK_VERSION;
1149
+ data: PayoutView;
1147
1150
  } | {
1148
1151
  id: string;
1149
- type: typeof WebhookEventType.CASHOUT_ORDER_PARTIALLY_PAID;
1152
+ type: typeof WebhookEventType.PAYOUT_ORDER_PARTIALLY_PAID;
1150
1153
  timestamp: string;
1151
- version: typeof CASHOUT_WEBHOOK_VERSION;
1152
- data: CashoutView;
1153
- partialPayment: CashoutPartialPayment;
1154
+ version: typeof PAYOUT_WEBHOOK_VERSION;
1155
+ data: PayoutView;
1156
+ partialPayment: PayoutPartialPayment;
1154
1157
  };
1155
- export type WebhookPayload = OrderWebhookPayload | CashoutWebhookPayload;
1156
- export declare function isCashoutWebhook(payload: WebhookPayload): payload is CashoutWebhookPayload;
1158
+ export type WebhookPayload = OrderWebhookPayload | PayoutWebhookPayload;
1159
+ export declare function isPayoutWebhook(payload: WebhookPayload): payload is PayoutWebhookPayload;
1157
1160
  export type CreateWebhookRequest = {
1158
1161
  url: string;
1159
1162
  events?: WebhookEventTypeValue[];
@@ -1254,45 +1257,43 @@ export type OwnershipTransferMasterMerchantPermissionType = typeof OwnershipTran
1254
1257
  export declare const OWNERSHIP_TRANSFER_MASTER_MERCHANT_PERMISSIONS: readonly OwnershipTransferMasterMerchantPermissionType[];
1255
1258
  /** "alice@example.com" → "a•••@example.com". The input is a validated, lowercased address. */
1256
1259
  export declare function maskOwnershipTransferEmail(email: string): string;
1257
- export declare const CashoutStatus: {
1260
+ export declare const PayoutStatus: {
1258
1261
  readonly AWAITING_FUNDING: "AWAITING_FUNDING";
1259
1262
  readonly FUNDED: "FUNDED";
1260
1263
  readonly READY: "READY";
1261
1264
  readonly LISTING: "LISTING";
1262
1265
  readonly PAYING: "PAYING";
1263
1266
  readonly SETTLED: "SETTLED";
1264
- readonly CANCELLING: "CANCELLING";
1265
1267
  readonly CANCELLED: "CANCELLED";
1266
1268
  readonly EXPIRED: "EXPIRED";
1267
1269
  };
1268
- export type CashoutStatusType = typeof CashoutStatus[keyof typeof CashoutStatus];
1269
- export declare const CashoutFundingStatus: {
1270
+ export type PayoutStatusType = typeof PayoutStatus[keyof typeof PayoutStatus];
1271
+ export declare const PayoutFundingStatus: {
1270
1272
  readonly AWAITING_FUNDING: "AWAITING_FUNDING";
1271
1273
  readonly PARTIALLY_FUNDED: "PARTIALLY_FUNDED";
1272
1274
  readonly FUNDED: "FUNDED";
1273
1275
  readonly FUNDING_EXPIRED: "FUNDING_EXPIRED";
1274
1276
  };
1275
- export type CashoutFundingStatusType = typeof CashoutFundingStatus[keyof typeof CashoutFundingStatus];
1276
- export declare const CashoutCancelSource: {
1277
- readonly CHECKOUT: "CHECKOUT";
1277
+ export type PayoutFundingStatusType = typeof PayoutFundingStatus[keyof typeof PayoutFundingStatus];
1278
+ export declare const PayoutCancelSource: {
1278
1279
  readonly MERCHANT: "MERCHANT";
1279
1280
  readonly PEER_APP: "PEER_APP";
1280
1281
  };
1281
- export type CashoutCancelSourceType = typeof CashoutCancelSource[keyof typeof CashoutCancelSource];
1282
- export declare const CashoutPayoutKind: {
1282
+ export type PayoutCancelSourceType = typeof PayoutCancelSource[keyof typeof PayoutCancelSource];
1283
+ export declare const PayoutKind: {
1283
1284
  readonly ESCROW: "ESCROW";
1284
1285
  readonly CRYPTO: "CRYPTO";
1285
1286
  };
1286
- export type CashoutPayoutKindType = typeof CashoutPayoutKind[keyof typeof CashoutPayoutKind];
1287
- export declare const CashoutAttemptStatus: {
1287
+ export type PayoutKindType = typeof PayoutKind[keyof typeof PayoutKind];
1288
+ export declare const PayoutAttemptStatus: {
1288
1289
  readonly ACTIVE: "ACTIVE";
1289
1290
  readonly CLOSED: "CLOSED";
1290
1291
  readonly SETTLED: "SETTLED";
1291
1292
  readonly FAILED: "FAILED";
1292
1293
  };
1293
- export type CashoutAttemptStatusType = typeof CashoutAttemptStatus[keyof typeof CashoutAttemptStatus];
1294
+ export type PayoutAttemptStatusType = typeof PayoutAttemptStatus[keyof typeof PayoutAttemptStatus];
1294
1295
  /** Fiat payout methods, in the order players see them: SAR rails, then buyer-proof rails. */
1295
- export declare const CashoutFiatRail: {
1296
+ export declare const PayoutFiatRail: {
1296
1297
  readonly VENMO: "venmo";
1297
1298
  readonly CASHAPP: "cashapp";
1298
1299
  readonly PAYPAL: "paypal";
@@ -1300,9 +1301,9 @@ export declare const CashoutFiatRail: {
1300
1301
  readonly REVOLUT: "revolut";
1301
1302
  readonly CHIME: "chime";
1302
1303
  };
1303
- export type CashoutFiatRailType = typeof CashoutFiatRail[keyof typeof CashoutFiatRail];
1304
+ export type PayoutFiatRailType = typeof PayoutFiatRail[keyof typeof PayoutFiatRail];
1304
1305
  /** One rail per crypto payout network, with checkout's rail ids (any-coin spec "Cashout rails"); the player sees them as one "Crypto" option. */
1305
- export declare const CashoutCryptoRail: {
1306
+ export declare const PayoutCryptoRail: {
1306
1307
  readonly RELAY_1: "relay_1";
1307
1308
  readonly RELAY_10: "relay_10";
1308
1309
  readonly RELAY_56: "relay_56";
@@ -1318,9 +1319,9 @@ export declare const CashoutCryptoRail: {
1318
1319
  /** ZEC on Zcash through NEAR Intents (Zcash spec "Catalog, route and address"); checkout's ZCASH_RAIL. */
1319
1320
  readonly NEAR_INTENTS_133701: "near_intents_133701";
1320
1321
  };
1321
- export type CashoutCryptoRailType = typeof CashoutCryptoRail[keyof typeof CashoutCryptoRail];
1322
- /** Every cashout rail, in rail order: fiat, then the crypto networks. */
1323
- export declare const CashoutRail: {
1322
+ export type PayoutCryptoRailType = typeof PayoutCryptoRail[keyof typeof PayoutCryptoRail];
1323
+ /** Every payout rail, in rail order: fiat, then the crypto networks. */
1324
+ export declare const PayoutRail: {
1324
1325
  readonly RELAY_1: "relay_1";
1325
1326
  readonly RELAY_10: "relay_10";
1326
1327
  readonly RELAY_56: "relay_56";
@@ -1342,16 +1343,16 @@ export declare const CashoutRail: {
1342
1343
  readonly REVOLUT: "revolut";
1343
1344
  readonly CHIME: "chime";
1344
1345
  };
1345
- export type CashoutRailType = CashoutFiatRailType | CashoutCryptoRailType;
1346
+ export type PayoutRailType = PayoutFiatRailType | PayoutCryptoRailType;
1346
1347
  /** Fiat rails whose account the player connects so Peer can confirm buyer payments; derived from SAR_SUPPORTED_FIAT_RAILS. */
1347
- export type CashoutSarRailType = Extract<CashoutFiatRailType, SarSupportedFiatRail>;
1348
+ export type PayoutSarRailType = Extract<PayoutFiatRailType, SarSupportedFiatRail>;
1348
1349
  /** Fiat rails with no connect step: the buyer proves the payment with the PeerAuth extension or the Peer app. */
1349
- export type CashoutBuyerProofRailType = Exclude<CashoutFiatRailType, CashoutSarRailType>;
1350
- export declare const CashoutPayoutProvider: {
1350
+ export type CashoutBuyerProofRailType = Exclude<PayoutFiatRailType, PayoutSarRailType>;
1351
+ export declare const PayoutProvider: {
1351
1352
  readonly RELAY: "RELAY";
1352
1353
  readonly NEAR_INTENTS: "NEAR_INTENTS";
1353
1354
  };
1354
- export type CashoutPayoutProviderType = typeof CashoutPayoutProvider[keyof typeof CashoutPayoutProvider];
1355
+ export type PayoutProviderType = typeof PayoutProvider[keyof typeof PayoutProvider];
1355
1356
  export declare const CashoutPayoutBridgeStatus: {
1356
1357
  readonly QUOTED: "QUOTED";
1357
1358
  readonly NOT_SENT: "NOT_SENT";
@@ -1361,7 +1362,7 @@ export declare const CashoutPayoutBridgeStatus: {
1361
1362
  };
1362
1363
  export type CashoutPayoutBridgeStatusType = typeof CashoutPayoutBridgeStatus[keyof typeof CashoutPayoutBridgeStatus];
1363
1364
  /** A crypto payout's coin, network and the player's address there. */
1364
- export interface CashoutCryptoDestination {
1365
+ export interface PayoutCryptoDestination {
1365
1366
  chainId: number;
1366
1367
  /** The shared catalog's address for the token on chainId. */
1367
1368
  tokenAddress: string;
@@ -1372,18 +1373,18 @@ export interface CashoutCryptoDestination {
1372
1373
  }
1373
1374
  /** Body of the crypto payout-method, payout-quote and send-to-address requests. The rail names the network. */
1374
1375
  export interface CashoutPayoutDestinationRequest {
1375
- rail: CashoutCryptoRailType;
1376
+ rail: PayoutCryptoRailType;
1376
1377
  tokenAddress: string;
1377
1378
  address: string;
1378
1379
  }
1379
1380
  /** A crypto payout method: the network's rail and where on it the player takes the payout. */
1380
- export interface CashoutCryptoMethod {
1381
- rail: CashoutCryptoRailType;
1382
- destination: CashoutCryptoDestination;
1381
+ export interface PayoutCryptoMethod {
1382
+ rail: PayoutCryptoRailType;
1383
+ destination: PayoutCryptoDestination;
1383
1384
  }
1384
1385
  /** POST /api/v1/cashout-checkout/:id/payout-quote. Not a promise. */
1385
1386
  export interface CashoutPayoutQuote {
1386
- destination: CashoutCryptoDestination;
1387
+ destination: PayoutCryptoDestination;
1387
1388
  /** Decimal USDC that would leave the player's wallet. */
1388
1389
  usdcAmount: string;
1389
1390
  /** Decimal destination token; equals usdcAmount for USDC on Base. */
@@ -1392,9 +1393,9 @@ export interface CashoutPayoutQuote {
1392
1393
  }
1393
1394
  /** The player's bridged payout, newest attempt first; never NOT_SENT. */
1394
1395
  export interface CashoutPayoutBridgeView {
1395
- provider: CashoutPayoutProviderType;
1396
+ provider: PayoutProviderType;
1396
1397
  status: Exclude<CashoutPayoutBridgeStatusType, typeof CashoutPayoutBridgeStatus.NOT_SENT>;
1397
- destination: CashoutCryptoDestination;
1398
+ destination: PayoutCryptoDestination;
1398
1399
  usdcAmount: string;
1399
1400
  /** The binding quote's output, decimal destination token. */
1400
1401
  estimatedAmount: string;
@@ -1404,16 +1405,20 @@ export interface CashoutPayoutBridgeView {
1404
1405
  refundedAmount: string | null;
1405
1406
  refundTxHash: string | null;
1406
1407
  }
1407
- export interface CashoutPartialFillView {
1408
+ export interface PayoutPartialFillView {
1409
+ /** Fiat paid at this fill's bound rate; null when the currency or rate is unknown. */
1410
+ fiat: PayoutFiatValue | null;
1408
1411
  /** Decimal USDC this buyer paid. */
1409
1412
  amount: string;
1410
1413
  txHash: string;
1411
1414
  paidAt: string;
1412
1415
  }
1413
- /** Where a SETTLED cashout's USDC ended up; decimal USDC, "0.00" for a part that did not happen. */
1414
- export interface CashoutSettlementBreakdown {
1416
+ /** Where a SETTLED payout's USDC ended up; decimal USDC, "0.00" for a part that did not happen. */
1417
+ export interface PayoutSettlementBreakdown {
1415
1418
  /** Paid by buyers through the escrow, across every listing. */
1416
1419
  buyerPaidAmount: string;
1420
+ /** Fiat totals in first-paid order; null if any payment has an unknown currency or bound rate, [] if no buyer paid. */
1421
+ buyerPaidFiat: PayoutFiatValue[] | null;
1417
1422
  /** USDC that left the player's wallet for a crypto payout (direct or bridged) or a send-to-address remainder. */
1418
1423
  sentAmount: string;
1419
1424
  /** The player's recipient: EVM lower-case, Solana, Tron and Bitcoin canonical; never a deposit address. */
@@ -1425,12 +1430,14 @@ export interface CashoutSettlementBreakdown {
1425
1430
  /** Σ refundLossUnits: USDC Relay kept on refunds; "0.00" when none. */
1426
1431
  refundFeeAmount: string;
1427
1432
  }
1428
- /** Merchant-facing cashout. Never includes the Peer fee, the player's email, wallet or payee handle. */
1429
- export interface CashoutView {
1430
- cashoutId: string;
1433
+ /** Merchant-facing payout. Never includes the Peer fee, the player's email, wallet or payee handle. */
1434
+ export interface PayoutView {
1435
+ /** The chosen fiat payout currency; null for crypto or no selected method. */
1436
+ payoutCurrency: PayoutCurrencyType | null;
1437
+ payoutId: string;
1431
1438
  merchantReference: string | null;
1432
- status: CashoutStatusType;
1433
- fundingStatus: CashoutFundingStatusType;
1439
+ status: PayoutStatusType;
1440
+ fundingStatus: PayoutFundingStatusType;
1434
1441
  payout: {
1435
1442
  amount: string;
1436
1443
  chainId: number;
@@ -1455,7 +1462,7 @@ export interface CashoutView {
1455
1462
  expectedAmount: string;
1456
1463
  /** Reached the player's wallet on Base, decimal USDC. */
1457
1464
  receivedAmount: string;
1458
- /** Null once the cashout can no longer be funded. */
1465
+ /** Null once the payout can no longer be funded. */
1459
1466
  depositAddress: string | null;
1460
1467
  /** Funding deadline; each on-time arrival moves it to at least the funding TTL (24 hours by default) after that check. */
1461
1468
  quoteExpiresAt: string;
@@ -1463,13 +1470,13 @@ export interface CashoutView {
1463
1470
  depositAmount: string | null;
1464
1471
  /** What buyers have paid across every listing, partial fills included. */
1465
1472
  paidAmount: string;
1466
- partialFills: CashoutPartialFillView[];
1473
+ partialFills: PayoutPartialFillView[];
1467
1474
  /** Only when status is SETTLED. */
1468
- settlement: CashoutSettlementBreakdown | null;
1475
+ settlement: PayoutSettlementBreakdown | null;
1469
1476
  attempt: {
1470
- kind: CashoutPayoutKindType;
1477
+ kind: PayoutKindType;
1471
1478
  rail: string | null;
1472
- status: CashoutAttemptStatusType;
1479
+ status: PayoutAttemptStatusType;
1473
1480
  } | null;
1474
1481
  /** Only when settled with a sent amount, including a send-to-address remainder. */
1475
1482
  payoutTransfer: {
@@ -1485,9 +1492,9 @@ export interface CashoutView {
1485
1492
  /** The USDC transfer on Base; settlement.sentAmount is its amount. */
1486
1493
  usdcTxHash: string;
1487
1494
  /** The bridge provider (RELAY or NEAR_INTENTS) when bridged; null for USDC on Base, where txHash = usdcTxHash. */
1488
- provider: CashoutPayoutProviderType | null;
1495
+ provider: PayoutProviderType | null;
1489
1496
  } | null;
1490
- cancelSource: CashoutCancelSourceType | null;
1497
+ cancelSource: PayoutCancelSourceType | null;
1491
1498
  returnUrl: string | null;
1492
1499
  expiresAt: string;
1493
1500
  fundedAt: string | null;
@@ -1495,7 +1502,7 @@ export interface CashoutView {
1495
1502
  cancelledAt: string | null;
1496
1503
  createdAt: string;
1497
1504
  }
1498
- export interface CreateCashoutRequest {
1505
+ export interface CreatePayoutRequest {
1499
1506
  merchantReference?: string;
1500
1507
  customerEmail: string;
1501
1508
  payout: {
@@ -1509,22 +1516,22 @@ export interface CreateCashoutRequest {
1509
1516
  refundAddress?: string;
1510
1517
  };
1511
1518
  returnUrl?: string;
1512
- /** Limits the cashout to these rails; never widens the merchant's (any-coin spec "Cashout rails"). */
1513
- rails?: CashoutRailType[];
1519
+ /** Limits the payout to these rails; never widens the merchant's (any-coin spec "Cashout rails"). */
1520
+ rails?: PayoutRailType[];
1514
1521
  }
1515
1522
  /** A replay with the same key and body returns the current checkout link, marked `idempotentReplay: true`. */
1516
- export type CreateCashoutResponse = CashoutView & {
1523
+ export type CreatePayoutResponse = PayoutView & {
1517
1524
  checkoutUrl: string;
1518
1525
  idempotentReplay: boolean;
1519
1526
  };
1520
- export interface ListCashoutsResponse {
1521
- items: CashoutView[];
1527
+ export interface ListPayoutsResponse {
1528
+ items: PayoutView[];
1522
1529
  page: number;
1523
1530
  limit: number;
1524
1531
  total: number;
1525
1532
  }
1526
- /** A moment on a cashout's dashboard timeline. */
1527
- export declare const CashoutTimelineEventType: {
1533
+ /** A moment on a payout's dashboard timeline. */
1534
+ export declare const PayoutTimelineEventType: {
1528
1535
  readonly CREATED: "CREATED";
1529
1536
  readonly PARTIALLY_FUNDED: "PARTIALLY_FUNDED";
1530
1537
  readonly FUNDED: "FUNDED";
@@ -1540,7 +1547,6 @@ export declare const CashoutTimelineEventType: {
1540
1547
  readonly RELISTED: "RELISTED";
1541
1548
  readonly BUYER_DROPPED: "BUYER_DROPPED";
1542
1549
  readonly RECONNECT_NEEDED: "RECONNECT_NEEDED";
1543
- readonly CANCEL_STARTED: "CANCEL_STARTED";
1544
1550
  /** The listing came back to the player's wallet so they can pick another payout method. */
1545
1551
  readonly LISTING_WITHDRAWN: "LISTING_WITHDRAWN";
1546
1552
  readonly SETTLED: "SETTLED";
@@ -1548,17 +1554,17 @@ export declare const CashoutTimelineEventType: {
1548
1554
  readonly FUNDING_ISSUE: "FUNDING_ISSUE";
1549
1555
  readonly PAYOUT_REFUNDED: "PAYOUT_REFUNDED";
1550
1556
  };
1551
- export type CashoutTimelineEventTypeValue = typeof CashoutTimelineEventType[keyof typeof CashoutTimelineEventType];
1552
- /** Largest merchant cashout payout step, in whole USDC. The smallest is the API's CASHOUT_MIN_USDC (10 in production). */
1553
- export declare const CASHOUT_PAYOUT_STEP_MAX_USDC = 1000;
1554
- /** Whole-USDC bounds for a merchant's cashout payout step in this environment. */
1555
- export interface CashoutPayoutStepRange {
1557
+ export type PayoutTimelineEventTypeValue = typeof PayoutTimelineEventType[keyof typeof PayoutTimelineEventType];
1558
+ /** Largest merchant payout step, in whole USDC. The smallest is the API's CASHOUT_MIN_USDC (10 in production). */
1559
+ export declare const PAYOUT_STEP_MAX_USDC = 1000;
1560
+ /** Whole-USDC bounds for a merchant's payout step in this environment. */
1561
+ export interface PayoutStepRange {
1556
1562
  min: number;
1557
1563
  max: number;
1558
1564
  }
1559
- /** A merchant's cashout settings; the Peer fee is not the merchant's to see. */
1560
- export interface CashoutSettings {
1561
- rails: CashoutRailType[];
1565
+ /** A merchant's payout settings; the Peer fee is not the merchant's to see. */
1566
+ export interface PayoutSettings {
1567
+ rails: PayoutRailType[];
1562
1568
  /** Merchant fee in bps of the deposit, 0–1000. */
1563
1569
  feeBps: number;
1564
1570
  /** Whole USDC, within the environment's payout step range. */
@@ -1566,62 +1572,63 @@ export interface CashoutSettings {
1566
1572
  /** An https URL or a mailto: link; optional. Without it the player's checkout shows no contact line. */
1567
1573
  supportUrl: string | null;
1568
1574
  }
1569
- export declare const CashoutFundingIssueKind: {
1575
+ export declare const PayoutFundingIssueKind: {
1570
1576
  readonly LATE_FUNDS: "LATE_FUNDS";
1571
1577
  readonly OVERPAYMENT: "OVERPAYMENT";
1572
1578
  readonly ROUTE_REFUND: "ROUTE_REFUND";
1573
1579
  };
1574
- export type CashoutFundingIssueKindType = typeof CashoutFundingIssueKind[keyof typeof CashoutFundingIssueKind];
1575
- export declare const CashoutFundingIssueResolution: {
1580
+ export type PayoutFundingIssueKindType = typeof PayoutFundingIssueKind[keyof typeof PayoutFundingIssueKind];
1581
+ export declare const PayoutFundingIssueResolution: {
1576
1582
  readonly RETURNED: "RETURNED";
1577
1583
  readonly CLAIMED: "CLAIMED";
1578
1584
  };
1579
- export type CashoutFundingIssueResolutionType = typeof CashoutFundingIssueResolution[keyof typeof CashoutFundingIssueResolution];
1585
+ export type PayoutFundingIssueResolutionType = typeof PayoutFundingIssueResolution[keyof typeof PayoutFundingIssueResolution];
1580
1586
  /** A funding token as offered to a merchant: `key` is "chainId:lowercaseAddress". */
1581
- export interface CashoutFundingTokenOption {
1587
+ export interface PayoutFundingTokenOption {
1582
1588
  key: string;
1583
1589
  chainId: number;
1584
1590
  address: string;
1585
1591
  symbol: string;
1586
1592
  }
1587
- /** GET /merchants/me/cashout-settings: the saved settings plus what Peer currently allows. */
1588
- export interface CashoutSettingsView extends CashoutSettings {
1589
- availableRails: CashoutRailType[];
1590
- availableFundingTokens: CashoutFundingTokenOption[];
1591
- payoutStepRange: CashoutPayoutStepRange;
1593
+ /** GET /merchants/me/payout-settings: the saved settings plus what Peer currently allows. */
1594
+ export interface PayoutSettingsView extends PayoutSettings {
1595
+ availableRails: PayoutRailType[];
1596
+ availableFundingTokens: PayoutFundingTokenOption[];
1597
+ payoutStepRange: PayoutStepRange;
1592
1598
  }
1593
1599
  /** Merchant-facing; never includes the admin's note or name. */
1594
- export interface MerchantCashoutFundingIssue {
1595
- kind: CashoutFundingIssueKindType;
1600
+ export interface MerchantPayoutFundingIssue {
1601
+ kind: PayoutFundingIssueKindType;
1596
1602
  /** Decimal USDC; null for a route refund, which is paid back in the origin token. */
1597
1603
  amountUsdc: string | null;
1598
1604
  txHash: string | null;
1599
1605
  detectedAt: string;
1600
- resolution: CashoutFundingIssueResolutionType | null;
1606
+ resolution: PayoutFundingIssueResolutionType | null;
1601
1607
  resolutionTxHash: string | null;
1602
1608
  resolvedAt: string | null;
1603
1609
  }
1604
- export type CashoutPayoutMethodView = {
1605
- rail: CashoutFiatRailType;
1610
+ export type PayoutMethodView = {
1611
+ rail: PayoutFiatRailType;
1606
1612
  handle: string;
1607
- } | CashoutCryptoMethod;
1608
- /** The dashboard's cashout: the API view plus what only the merchant's staff may see. */
1609
- export interface MerchantCashoutView extends CashoutView {
1613
+ currency: PayoutCurrencyType;
1614
+ } | PayoutCryptoMethod;
1615
+ /** The dashboard's payout: the API view plus what only the merchant's staff may see. */
1616
+ export interface MerchantPayoutView extends PayoutView {
1610
1617
  /** The player's email as given at create, stored lower-cased. */
1611
1618
  customerEmail: string;
1612
- payoutMethod: CashoutPayoutMethodView | null;
1613
- /** Null once the cashout is final. */
1619
+ payoutMethod: PayoutMethodView | null;
1620
+ /** Null once the payout is final. */
1614
1621
  checkoutUrl: string | null;
1615
1622
  }
1616
- export interface CashoutTimelineEntry {
1617
- type: CashoutTimelineEventTypeValue;
1623
+ export interface PayoutTimelineEntry {
1624
+ type: PayoutTimelineEventTypeValue;
1618
1625
  text: string;
1619
1626
  txHash: string | null;
1620
1627
  /** The chain txHash is on; null when txHash isn't linked. */
1621
1628
  txChainId: number | null;
1622
1629
  occurredAt: string;
1623
1630
  }
1624
- export interface CashoutWebhookDeliveryView {
1631
+ export interface PayoutWebhookDeliveryView {
1625
1632
  eventType: string;
1626
1633
  status: string;
1627
1634
  attempts: number;
@@ -1629,47 +1636,47 @@ export interface CashoutWebhookDeliveryView {
1629
1636
  lastAttemptAt: string | null;
1630
1637
  createdAt: string;
1631
1638
  }
1632
- export interface MerchantCashoutDetail {
1633
- cashout: MerchantCashoutView;
1634
- timeline: CashoutTimelineEntry[];
1639
+ export interface MerchantPayoutDetail {
1640
+ payout: MerchantPayoutView;
1641
+ timeline: PayoutTimelineEntry[];
1635
1642
  /** Not stored: what happens next from the current status, or null when final. */
1636
1643
  nextStep: string | null;
1637
- webhooks: CashoutWebhookDeliveryView[];
1638
- fundingIssues: MerchantCashoutFundingIssue[];
1644
+ webhooks: PayoutWebhookDeliveryView[];
1645
+ fundingIssues: MerchantPayoutFundingIssue[];
1639
1646
  }
1640
- /** The dashboard's create form result; a replay returns the same cashout and its current link. */
1641
- export type CreateMerchantCashoutResponse = MerchantCashoutView & {
1647
+ /** The dashboard's create form result; a replay returns the same payout and its current link. */
1648
+ export type CreateMerchantPayoutResponse = MerchantPayoutView & {
1642
1649
  idempotentReplay: boolean;
1643
1650
  };
1644
- export interface ListMerchantCashoutsResponse {
1645
- items: MerchantCashoutView[];
1651
+ export interface ListMerchantPayoutsResponse {
1652
+ items: MerchantPayoutView[];
1646
1653
  page: number;
1647
1654
  limit: number;
1648
1655
  total: number;
1649
1656
  }
1650
1657
  export interface AdminCashoutSettings {
1651
- disabledRails: CashoutRailType[];
1658
+ disabledRails: PayoutRailType[];
1652
1659
  disabledFundingTokens: string[];
1653
1660
  peerFeeRecipient: string;
1654
- supportedFundingTokens: CashoutFundingTokenOption[];
1661
+ supportedFundingTokens: PayoutFundingTokenOption[];
1655
1662
  updatedAt: string;
1656
1663
  }
1657
1664
  export interface AdminCashoutMerchantConfig {
1658
1665
  merchantId: string;
1659
1666
  peerFeeBps: number;
1660
1667
  payoutStepUsdc: number;
1661
- payoutStepRange: CashoutPayoutStepRange;
1668
+ payoutStepRange: PayoutStepRange;
1662
1669
  fundingTokens: string[];
1663
1670
  /** Merchant cashout rails, edited by the merchant and Peer admins, in rail order. */
1664
- rails: CashoutRailType[];
1671
+ rails: PayoutRailType[];
1665
1672
  /** Player support link; optional. */
1666
1673
  supportUrl: string | null;
1667
1674
  /** Merchant rails minus Peer's global disables and the fiat rails `DISABLED_RAILS` turns off, in rail order. */
1668
- effectiveRails: CashoutRailType[];
1675
+ effectiveRails: PayoutRailType[];
1669
1676
  merchantFeeBps: number;
1670
1677
  merchantFeeRecipient: string | null;
1671
1678
  }
1672
- export interface AdminCashoutFundingIssue extends MerchantCashoutFundingIssue {
1679
+ export interface AdminCashoutFundingIssue extends MerchantPayoutFundingIssue {
1673
1680
  id: string;
1674
1681
  cashoutId: string;
1675
1682
  merchantId: string;
@@ -1698,8 +1705,6 @@ export declare const CashoutPlayerAction: {
1698
1705
  readonly CONNECT_RAIL: "CONNECT_RAIL";
1699
1706
  readonly SKIP_CONNECT: "SKIP_CONNECT";
1700
1707
  readonly CONFIRM: "CONFIRM";
1701
- readonly CANCEL: "CANCEL";
1702
- readonly FINISH_CANCEL: "FINISH_CANCEL";
1703
1708
  readonly CHANGE_METHOD: "CHANGE_METHOD";
1704
1709
  readonly SEND_TO_ADDRESS: "SEND_TO_ADDRESS";
1705
1710
  readonly RELIST: "RELIST";
@@ -1720,7 +1725,7 @@ export declare const CashoutCredentialStatus: {
1720
1725
  };
1721
1726
  export type CashoutCredentialStatusType = typeof CashoutCredentialStatus[keyof typeof CashoutCredentialStatus];
1722
1727
  export interface CashoutRailOption {
1723
- rail: CashoutRailType;
1728
+ rail: PayoutRailType;
1724
1729
  /** Smallest single buyer payment, USDC decimal; null for crypto rails. */
1725
1730
  minAmount: string | null;
1726
1731
  /** Largest single buyer payment, USDC decimal; null for crypto rails. */
@@ -1728,7 +1733,8 @@ export interface CashoutRailOption {
1728
1733
  }
1729
1734
  /** A SAR method supports seller-side confirmation; when connecting is skipped, each buyer proves payment. */
1730
1735
  export interface CashoutSarMethod {
1731
- rail: CashoutSarRailType;
1736
+ currency: PayoutCurrencyType;
1737
+ rail: PayoutSarRailType;
1732
1738
  payeeHandle: string;
1733
1739
  credentialStatus: CashoutCredentialStatusType;
1734
1740
  /** The player chose to list without connecting this method. */
@@ -1739,6 +1745,7 @@ export interface CashoutSarMethod {
1739
1745
  }
1740
1746
  /** A buyer-proof method has no connect step or credential; each buyer proves their payment. */
1741
1747
  export interface CashoutBuyerProofMethod {
1748
+ currency: PayoutCurrencyType;
1742
1749
  rail: CashoutBuyerProofRailType;
1743
1750
  payeeHandle: string;
1744
1751
  payeeHash: string;
@@ -1756,25 +1763,46 @@ export interface CashoutCheckoutSummary {
1756
1763
  email: string;
1757
1764
  maskedEmail: string;
1758
1765
  payoutAmount: string;
1759
- status: CashoutStatusType;
1766
+ status: PayoutStatusType;
1760
1767
  rails: CashoutRailOption[];
1761
1768
  returnUrl: string | null;
1762
1769
  }
1770
+ /** Display only: an oracle read never gates a payout. */
1771
+ export interface CashoutFxRate {
1772
+ currency: PayoutOracleCurrencyType;
1773
+ rate: string;
1774
+ }
1775
+ export interface CashoutPayoutCurrencyOption {
1776
+ currency: PayoutCurrencyType;
1777
+ rails: PayoutFiatRailType[];
1778
+ rate: CashoutFxRate | null;
1779
+ estimate: PayoutFiatValue | null;
1780
+ }
1781
+ export interface CashoutFiatPricing {
1782
+ currency: PayoutOracleCurrencyType;
1783
+ rate: CashoutFxRate | null;
1784
+ unpaid: PayoutFiatValue | null;
1785
+ listed: PayoutFiatValue | null;
1786
+ }
1763
1787
  /** GET /api/v1/cashout-checkout/:id/state (link token + Peer app login). */
1764
1788
  export interface CashoutCheckoutState {
1789
+ payoutCurrencies: CashoutPayoutCurrencyOption[];
1790
+ fiatPricing: CashoutFiatPricing | null;
1791
+ /** Exact fiat while PAYING; null when there is no buyer payment or no known currency and bound rate. */
1792
+ buyerPayment: PayoutFiatValue | null;
1765
1793
  cashoutId: string;
1766
- status: CashoutStatusType;
1794
+ status: PayoutStatusType;
1767
1795
  walletAddress: string;
1768
1796
  depositAmount: string | null;
1769
1797
  /** Live from the escrow deposit; null before listing and once the listing is closed. */
1770
1798
  remainingAmount: string | null;
1771
1799
  buyerPaymentActive: boolean;
1772
- method: CashoutSarMethod | CashoutBuyerProofMethod | CashoutCryptoMethod | null;
1800
+ method: CashoutSarMethod | CashoutBuyerProofMethod | PayoutCryptoMethod | null;
1773
1801
  /** Prefill from this player's last cashout on an available rail; never a deposit address. */
1774
- lastPayoutTarget: CashoutPayoutMethodView | null;
1802
+ lastPayoutTarget: PayoutMethodView | null;
1775
1803
  attempt: {
1776
1804
  attemptId: string;
1777
- status: CashoutAttemptStatusType;
1805
+ status: PayoutAttemptStatusType;
1778
1806
  depositId: string | null;
1779
1807
  } | null;
1780
1808
  signer: {
@@ -1789,18 +1817,18 @@ export interface CashoutCheckoutState {
1789
1817
  * Also true when a Venmo or PayPal listing's Peer Pay group send failed and its listing was withdrawn (the cashout is back in FUNDED/READY).
1790
1818
  */
1791
1819
  lastSendFailed: boolean;
1792
- /** Set when the Peer wallet no longer covers this cashout (newest first, like the wallet job): what it needs and what is left for it after the player's older cashouts, in decimal USDC. Only CANCEL is offered then. */
1820
+ /** Set when the Peer wallet no longer covers this cashout (newest first, like the wallet job): what it needs and what is left for it after the player's older cashouts, in decimal USDC. Nothing is offered then: the wallet job closes it. */
1793
1821
  walletShortfall: {
1794
1822
  requiredAmount: string;
1795
1823
  availableAmount: string;
1796
1824
  } | null;
1797
1825
  /** PARTIALLY_FUNDED means the merchant still owes a top-up; receivedAmount is the USDC that reached the player's wallet. */
1798
1826
  funding: {
1799
- status: CashoutFundingStatusType;
1827
+ status: PayoutFundingStatusType;
1800
1828
  receivedAmount: string | null;
1801
1829
  };
1802
- /** Who cancelled; PEER_APP when the player took the cashout back in the Peer app. */
1803
- cancelSource: CashoutCancelSourceType | null;
1830
+ /** Who ended it: MERCHANT before funding, PEER_APP when the player moved the money in the Peer app. */
1831
+ cancelSource: PayoutCancelSourceType | null;
1804
1832
  merchantReference: string | null;
1805
1833
  /** Once settled: the delivering transaction and its chain. */
1806
1834
  settleTx: {
@@ -1813,6 +1841,8 @@ export interface CashoutCheckoutState {
1813
1841
  buyerMatchedAt: string | null;
1814
1842
  /** Set once a buyer paid part of the cashout; decimal USDC. totalAmount is depositAmount. */
1815
1843
  partialPayment: {
1844
+ /** Fiat totals in first-paid order; null if any payment has an unknown currency or bound rate, [] if no buyer paid. */
1845
+ paidFiat: PayoutFiatValue[] | null;
1816
1846
  paidAmount: string;
1817
1847
  unpaidAmount: string;
1818
1848
  totalAmount: string;
@@ -1826,22 +1856,27 @@ export interface CashoutCheckoutState {
1826
1856
  acceptingBuyers: boolean;
1827
1857
  } | null;
1828
1858
  /** Only when status is SETTLED. */
1829
- settlement: CashoutSettlementBreakdown | null;
1859
+ settlement: PayoutSettlementBreakdown | null;
1830
1860
  actions: CashoutPlayerActionType[];
1831
1861
  }
1832
1862
  export type SetCashoutPayoutMethodRequest = {
1833
- rail: typeof CashoutRail.VENMO | typeof CashoutRail.CASHAPP;
1863
+ rail: typeof PayoutRail.VENMO | typeof PayoutRail.CASHAPP;
1834
1864
  payeeHandle: string;
1835
1865
  }
1836
1866
  /** The App Clip checks the connected PayPal account against this email. */
1837
1867
  | {
1838
- rail: typeof CashoutRail.PAYPAL;
1868
+ rail: typeof PayoutRail.PAYPAL;
1839
1869
  payeeHandle: string;
1840
1870
  paypalEmail: string;
1871
+ currency: (typeof PAYOUT_RAIL_CURRENCIES)['paypal'][number];
1841
1872
  }
1842
- /** Buyer-proof rails need only the payout account; there is no connect step. */
1873
+ /** The multi-currency rail carries the player's selected payout currency. */
1843
1874
  | {
1844
- rail: CashoutBuyerProofRailType;
1875
+ rail: typeof PayoutRail.REVOLUT;
1876
+ payeeHandle: string;
1877
+ currency: (typeof PAYOUT_RAIL_CURRENCIES)['revolut'][number];
1878
+ } | {
1879
+ rail: typeof PayoutRail.ZELLE | typeof PayoutRail.CHIME;
1845
1880
  payeeHandle: string;
1846
1881
  } | CashoutPayoutDestinationRequest;
1847
1882
  /** POST /api/v1/cashout-checkout/:id/send-to-address. The checkout requires the network tick box before sending. */
@@ -1852,8 +1887,8 @@ export interface CashoutActivityItem {
1852
1887
  checkoutUrl: string;
1853
1888
  payoutAmount: string;
1854
1889
  /** The chosen payout app, or null before the player picks one. */
1855
- payoutRail: CashoutRailType | null;
1856
- status: CashoutStatusType;
1890
+ payoutRail: PayoutRailType | null;
1891
+ status: PayoutStatusType;
1857
1892
  createdAt: string;
1858
1893
  }
1859
1894
  export interface ListCashoutActivityResponse {