@ecodrix/erix-api 3.3.0 → 3.3.1

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.
@@ -869,10 +869,34 @@ declare class Leads extends APIResource {
869
869
  * Merge two duplicate leads. Primary survives, secondary's data is merged in
870
870
  * (conversations, activities, tags) and the secondary is deleted.
871
871
  *
872
+ * Admin only. One transaction: on a 409 (`MERGE_REFERRAL_LINK`,
873
+ * `MERGE_ERASED_CONTACT`) or any error, both contacts are unchanged.
874
+ *
872
875
  * @param primaryId - The lead to keep.
873
876
  * @param secondaryId - The lead to merge into primary and delete.
874
877
  */
875
878
  merge<T = any>(primaryId: string, secondaryId: string): Promise<T>;
879
+ /**
880
+ * Possible duplicates of a lead: other live contacts in the workspace with
881
+ * the same email (any case) or the same phone number. Never merges — call
882
+ * {@link merge} once a person confirms.
883
+ */
884
+ duplicates(leadId: string): Promise<{
885
+ success: boolean;
886
+ data: DuplicateLead[];
887
+ }>;
888
+ }
889
+ /** A possible duplicate returned by `leads.duplicates()`. */
890
+ interface DuplicateLead {
891
+ id: string;
892
+ name: string;
893
+ /** A real phone number; null when the contact has none (social-only). */
894
+ phone: string | null;
895
+ email: string | null;
896
+ source: string;
897
+ /** "whatsapp" (real phone), "instagram", "facebook", "telegram", "email". */
898
+ channels: string[];
899
+ createdAt: string | null;
876
900
  }
877
901
 
878
902
  declare class Payments extends APIResource {
@@ -1228,102 +1252,510 @@ declare class Messages extends APIResource {
1228
1252
  }): Promise<OutboundMedia>;
1229
1253
  }
1230
1254
 
1231
- interface CheckoutProduct {
1232
- externalId: string;
1255
+ /**
1256
+ * One-click checkout (v1). Money is always whole paise (`…Paise`); the buyer
1257
+ * pays into the SHOP's own Razorpay/Stripe, never ECODrIx's.
1258
+ */
1259
+ /** One cart line, priced by the shop (paise, incl. GST). */
1260
+ interface CheckoutItem {
1261
+ sku: string;
1233
1262
  name: string;
1234
- price: number;
1263
+ /** Unit price in paise. */
1264
+ pricePaise: number;
1265
+ quantity: number;
1266
+ /** https:// only. */
1235
1267
  image?: string;
1268
+ /** The item's page on the shop's site (https://). */
1269
+ url?: string;
1270
+ }
1271
+ /** Every checkout endpoint answers `{ success: true, data }`. */
1272
+ interface CheckoutResponse<T> {
1273
+ success: true;
1274
+ data: T;
1236
1275
  }
1237
- interface CheckoutAmountBreakdown {
1238
- subtotal: number;
1239
- discount: number;
1240
- delivery: number;
1241
- total: number;
1276
+ interface CheckoutAmounts {
1277
+ subtotalPaise: number;
1278
+ discountPaise: number;
1279
+ deliveryFeePaise: number;
1280
+ totalPaise: number;
1242
1281
  }
1243
- interface CheckoutSession {
1282
+ interface CheckoutAddress {
1283
+ line1: string;
1284
+ area?: string;
1285
+ city: string;
1286
+ state: string;
1287
+ /** 6-digit Indian PIN code. */
1288
+ pincode: string;
1289
+ }
1290
+ interface CheckoutProduct {
1291
+ /** Goes in the buy link: `/buy/{clientCode}/{id}`. */
1292
+ id: string;
1293
+ name: string;
1294
+ /** Price including GST. */
1295
+ pricePaise: number;
1296
+ image: string | null;
1297
+ description: string | null;
1298
+ isActive: boolean;
1299
+ createdAt: string;
1300
+ updatedAt: string;
1301
+ }
1302
+ interface CheckoutProductInput {
1303
+ name: string;
1304
+ /** At least 100 (₹1). */
1305
+ pricePaise: number;
1306
+ /** https:// only. */
1307
+ image?: string | null;
1308
+ description?: string | null;
1309
+ isActive?: boolean;
1310
+ }
1311
+ interface CheckoutCouponLimits {
1312
+ /** ISO date-time with offset; null clears it. */
1313
+ expiryDate?: string | null;
1314
+ minOrderPaise?: number | null;
1315
+ /** 0 / null = unlimited. */
1316
+ usageLimit?: number | null;
1317
+ isActive?: boolean;
1318
+ }
1319
+ type CheckoutCouponInput = CheckoutCouponLimits & {
1320
+ /** 3–32 of A–Z 0–9 - _ (upper-cased). */
1321
+ code: string;
1322
+ } & ({
1323
+ type: "FLAT";
1324
+ amountPaise: number;
1325
+ } | {
1326
+ type: "PERCENT";
1327
+ percent: number;
1328
+ maxDiscountPaise?: number | null;
1329
+ });
1330
+ /** A coupon's code and type never change; send its `type` with any edit. */
1331
+ type CheckoutCouponPatch = CheckoutCouponLimits & ({
1332
+ type: "FLAT";
1333
+ amountPaise?: number;
1334
+ } | {
1335
+ type: "PERCENT";
1336
+ percent?: number;
1337
+ maxDiscountPaise?: number | null;
1338
+ });
1339
+ interface CheckoutCoupon {
1340
+ id: string;
1341
+ code: string;
1342
+ type: "FLAT" | "PERCENT";
1343
+ amountPaise?: number;
1344
+ percent?: number;
1345
+ maxDiscountPaise?: number | null;
1346
+ expiryDate: string | null;
1347
+ minOrderPaise: number | null;
1348
+ usageLimit: number | null;
1349
+ usedCount: number;
1350
+ isActive: boolean;
1351
+ createdAt: string;
1352
+ }
1353
+ type CheckoutOrderStatus = "placed" | "processing" | "shipped" | "delivered" | "cancelled" | "returned" | "failed";
1354
+ /** What a seller may move an order to (confirm = `processing`, COD only). */
1355
+ type CheckoutOrderAction = "processing" | "shipped" | "delivered" | "cancelled" | "returned";
1356
+ interface CheckoutOrder {
1357
+ orderId: string;
1358
+ status: CheckoutOrderStatus;
1359
+ /** The CRM contact the order is filed under. */
1360
+ leadId: string | null;
1361
+ customer: {
1362
+ name: string;
1363
+ phone: string;
1364
+ email?: string;
1365
+ address?: CheckoutAddress;
1366
+ };
1367
+ /** The first line (kept for single-product orders); use `items` for the cart. */
1368
+ product: {
1369
+ id: string;
1370
+ name: string;
1371
+ pricePaise: number;
1372
+ quantity: number;
1373
+ };
1374
+ /** Every line of the order (one for an ERIX product link). */
1375
+ items: CheckoutItem[];
1376
+ /** A shop server's cart as it sent it (the buyer may have dropped lines); null otherwise. */
1377
+ itemsOriginal: CheckoutItem[] | null;
1378
+ /** The shop's own order id, when its server created the session. */
1379
+ merchantOrderRef: string | null;
1380
+ amounts: CheckoutAmounts;
1381
+ payment: {
1382
+ method: "online" | "cod";
1383
+ /** pending → paid · cod_pending → cod_confirmed · failed */
1384
+ status: string;
1385
+ provider: string;
1386
+ linkUrl: string | null;
1387
+ paymentId: string | null;
1388
+ paidAt: string | null;
1389
+ confirmedAt: string | null;
1390
+ };
1391
+ /** COD not yet confirmed by the buyer on WhatsApp — check before shipping. */
1392
+ codUnconfirmed: boolean;
1393
+ trackingUrl: string | null;
1394
+ createdAt: string;
1395
+ updatedAt: string;
1396
+ }
1397
+ interface CheckoutOrderList {
1398
+ orders: CheckoutOrder[];
1399
+ hasMore: boolean;
1400
+ }
1401
+ interface CheckoutSettings {
1402
+ /** Cash on delivery offered (default on). */
1403
+ cod: boolean;
1404
+ /** One flat fee per order (default 0, max 1,000,000 = ₹10,000). */
1405
+ deliveryFeePaise: number;
1406
+ /** Read-only: the shop has Razorpay/Stripe connected (Connect → Payments). */
1407
+ online: boolean;
1408
+ /**
1409
+ * The shop's server gets `checkout.order.placed|paid|status_changed` here,
1410
+ * signed with the workspace webhook secret (`x-ecodrix-signature`). Public
1411
+ * https:// only; null = off.
1412
+ */
1413
+ webhookUrl: string | null;
1414
+ }
1415
+ /**
1416
+ * A checkout the shop's SERVER opens for its cart (workspace API key, never
1417
+ * from a browser). ERIX takes the prices as sent: the shop applies its own
1418
+ * discounts; coupons don't apply.
1419
+ */
1420
+ interface MerchantCheckoutSessionInput {
1421
+ /** 1–50 lines; `pricePaise` > 0, `quantity` 1–100. */
1422
+ items: CheckoutItem[];
1423
+ currency: "INR";
1424
+ /** Your own order id (≤ 64), echoed on the order and in webhooks. */
1425
+ merchantOrderRef?: string;
1426
+ /** Prefill for the buyer's form (shown to the buyer, not verified). */
1427
+ customer?: {
1428
+ name?: string;
1429
+ phone?: string;
1430
+ email?: string;
1431
+ };
1432
+ /** Added to the cart total (default 0). */
1433
+ deliveryFeePaise?: number;
1434
+ /** Your thank-you page (https://), handed to the buyer page. */
1435
+ successUrl?: string;
1436
+ }
1437
+ interface MerchantCheckoutSession {
1244
1438
  sessionId: string;
1439
+ /** Signed, ids only; expires with the session (30 minutes). */
1440
+ token: string;
1441
+ /** Open this (popup or redirect): `/buy/{clientCode}/s?t=…`. */
1442
+ checkoutUrl: string;
1443
+ expiresAt: string;
1444
+ }
1445
+ interface CheckoutProductLink {
1446
+ url: string;
1447
+ /** Signed links (sent to a contact) expire; a plain product link doesn't. */
1448
+ expiresAt: string | null;
1449
+ }
1450
+ interface PublicCheckoutProduct {
1245
1451
  product: {
1452
+ id: string;
1246
1453
  name: string;
1247
- price: number;
1248
- image?: string;
1454
+ pricePaise: number;
1455
+ image: string | null;
1456
+ description: string | null;
1457
+ };
1458
+ shop: {
1459
+ name: string | null;
1460
+ cod: boolean;
1461
+ online: boolean;
1462
+ /** Online is Razorpay Standard Checkout in the page (else a payment link). */
1463
+ razorpay: boolean;
1464
+ /** False: no gateway and COD off — the shop isn't taking orders. */
1465
+ accepting: boolean;
1466
+ deliveryFeePaise: number;
1467
+ };
1468
+ }
1469
+ /** A shop server's cart as the buyer page sees it (current lines and totals). */
1470
+ interface PublicMerchantCart {
1471
+ /** For the items / verify / order steps. */
1472
+ sessionId: string;
1473
+ expiresAt: string;
1474
+ /** What the buyer is buying now; `maxQuantity` = the shop's own count (the cap). */
1475
+ items: Array<CheckoutItem & {
1476
+ maxQuantity: number;
1477
+ }>;
1478
+ /** As the shop sent it (removed lines included): the most of each line the buyer may keep. */
1479
+ itemsOriginal: CheckoutItem[];
1480
+ amounts: CheckoutAmounts;
1481
+ }
1482
+ /** A merchant session's cart for the buyer page (`/buy/{clientCode}/s?t=…`). */
1483
+ interface PublicMerchantSession extends PublicMerchantCart {
1484
+ shop: {
1485
+ name: string | null;
1486
+ cod: boolean;
1487
+ online: boolean;
1488
+ razorpay: boolean;
1489
+ accepting: boolean;
1249
1490
  };
1250
- amounts: CheckoutAmountBreakdown;
1491
+ /** What the shop's server sent about its buyer, to prefill the form. */
1492
+ customerPrefill: {
1493
+ name?: string;
1494
+ phone?: string;
1495
+ email?: string;
1496
+ } | null;
1497
+ /** The shop's thank-you page, when it gave one. */
1498
+ successUrl: string | null;
1499
+ }
1500
+ interface PublicMerchantSessionResponse extends CheckoutResponse<PublicMerchantSession> {
1501
+ consentNotice: string;
1502
+ privacyPolicyUrl: string | null;
1503
+ }
1504
+ /**
1505
+ * The buyer's cart after dropping lines or lowering counts: every sku must be
1506
+ * in `itemsOriginal`, each count at most the original, at least one line.
1507
+ * Lines left out are removed. Prices always stay the shop's.
1508
+ */
1509
+ interface CheckoutCartEditInput {
1510
+ clientCode: string;
1511
+ sessionId: string;
1512
+ /** The session token (`t` of the shop's `checkoutUrl`). */
1513
+ token: string;
1251
1514
  items: Array<{
1252
- productId: string;
1515
+ sku: string;
1253
1516
  quantity: number;
1254
1517
  }>;
1255
1518
  }
1256
- interface CreateSessionPayload {
1257
- productId: string;
1519
+ interface PublicCheckoutProductResponse extends CheckoutResponse<PublicCheckoutProduct> {
1520
+ /** Show next to the required consent box; the server records this text. */
1521
+ consentNotice: string;
1522
+ privacyPolicyUrl: string | null;
1523
+ }
1524
+ interface CheckoutSession {
1525
+ sessionId: string;
1258
1526
  quantity: number;
1259
- couponCode?: string;
1527
+ expiresAt: string;
1528
+ verified: boolean;
1529
+ coupon: string | null;
1530
+ amounts: CheckoutAmounts;
1260
1531
  }
1261
- interface ApplyCouponPayload {
1532
+ type CheckoutVerifyInput = {
1533
+ clientCode: string;
1262
1534
  sessionId: string;
1263
- couponCode: string;
1535
+ method: "truecaller";
1536
+ accessToken: string;
1264
1537
  }
1265
- interface VerifyPayload {
1538
+ /** `token` = the `t` query parameter of a signed buy link. */
1539
+ | {
1540
+ clientCode: string;
1266
1541
  sessionId: string;
1267
- method: "truecaller" | "otp";
1268
- token?: string;
1269
- phone?: string;
1270
- otp?: string;
1542
+ method: "link";
1543
+ token: string;
1544
+ };
1545
+ interface CheckoutVerifyResult {
1546
+ verified: true;
1547
+ via: "truecaller" | "link";
1548
+ name: string;
1549
+ /** e.g. "•••••• 3210" — the full number never comes back. */
1550
+ phoneMasked: string;
1551
+ city: string | null;
1552
+ state: string | null;
1271
1553
  }
1272
- interface CreateOrderPayload {
1554
+ interface PlaceCheckoutOrderInput {
1555
+ clientCode: string;
1273
1556
  sessionId: string;
1557
+ paymentMethod: "online" | "cod";
1274
1558
  customer: {
1275
1559
  name: string;
1276
- phone: string;
1560
+ /** Not needed when the session was verified (its number is used). */
1561
+ phone?: string;
1277
1562
  email?: string;
1278
- address: {
1279
- line1: string;
1280
- city: string;
1281
- state: string;
1282
- pincode: string;
1283
- };
1563
+ address: CheckoutAddress;
1284
1564
  };
1285
- paymentProvider: "razorpay" | "cod";
1565
+ /** The buyer ticked the `consentNotice` box (required). */
1566
+ consent: true;
1286
1567
  }
1287
- interface CheckoutOrderResponse {
1288
- order_id: string;
1289
- payment_order_id?: string;
1290
- amount?: number;
1291
- currency?: string;
1292
- status?: string;
1293
- message?: string;
1568
+ /**
1569
+ * Options for Razorpay `checkout.js` (`new Razorpay({ key: keyId, order_id:
1570
+ * orderId, amount, currency, name, prefill, handler })`): an order on the
1571
+ * shop's own Razorpay account and its PUBLIC key id.
1572
+ */
1573
+ interface RazorpayCheckoutOptions {
1574
+ keyId: string;
1575
+ /** Razorpay `order_…`. */
1576
+ orderId: string;
1577
+ /** Paise. */
1578
+ amount: number;
1579
+ currency: string;
1580
+ /** The shop's name for the Razorpay sheet. */
1581
+ name: string | null;
1582
+ /** What this buyer just typed (their own browser only). */
1583
+ prefill: {
1584
+ name: string;
1585
+ contact: string;
1586
+ email?: string;
1587
+ };
1588
+ }
1589
+ interface PlacedCheckoutOrder {
1590
+ orderId: string;
1591
+ status: CheckoutOrderStatus;
1592
+ paymentMethod: "online" | "cod";
1593
+ amounts: CheckoutAmounts;
1594
+ /** Online on a payment link (Stripe shops): send the buyer here to pay. */
1595
+ paymentUrl: string | null;
1596
+ /**
1597
+ * Online on Razorpay: open `checkout.js` in the page with these, then pass
1598
+ * its handler's response to `buyer.verifyRazorpay`. Never navigate away.
1599
+ */
1600
+ razorpay: RazorpayCheckoutOptions | null;
1601
+ /** The order's status page (the gateway returns here too). */
1602
+ statusUrl: string | null;
1603
+ }
1604
+ /** Razorpay `checkout.js` handler response, relayed for server-side checks. */
1605
+ interface CheckoutRazorpayVerifyInput {
1606
+ clientCode: string;
1607
+ sessionId: string;
1608
+ orderId: string;
1609
+ /** `razorpay_order_id` (`order_…`). */
1610
+ razorpayOrderId: string;
1611
+ /** `razorpay_payment_id` (`pay_…`). */
1612
+ razorpayPaymentId: string;
1613
+ /** `razorpay_signature` (64 hex). */
1614
+ razorpaySignature: string;
1615
+ }
1616
+ interface PublicCheckoutOrder {
1617
+ orderId: string;
1618
+ status: CheckoutOrderStatus;
1619
+ paymentMethod: "online" | "cod";
1620
+ paymentStatus: string;
1621
+ /** The first line; use `items` for the cart. */
1622
+ product: {
1623
+ name: string;
1624
+ quantity: number;
1625
+ };
1626
+ items: CheckoutItem[];
1627
+ amounts: CheckoutAmounts;
1628
+ /** Still unpaid online: the same link, to try again. */
1629
+ paymentUrl: string | null;
1630
+ trackingUrl: string | null;
1631
+ createdAt: string;
1294
1632
  }
1295
1633
 
1296
1634
  /**
1297
- * Resource for managing the ErixCheckout one-click flow.
1635
+ * The buyer's side of one-click checkout — the public buy page
1636
+ * (`/buy/{clientCode}/{productId}`). No workspace key is involved: every call
1637
+ * names the shop by its client code and the server prices everything.
1298
1638
  *
1299
- * This resource handles session creation, coupon application,
1300
- * identity verification, and final order placement.
1639
+ * @example
1640
+ * ```typescript
1641
+ * const buyer = ecod.product.erix.checkout.buyer;
1642
+ * const { data } = await buyer.getProduct("ERIX_CLNT_ABC123", "p_x1y2z3");
1643
+ * const { data: s } = await buyer.startSession({ clientCode, productId, quantity: 1 });
1644
+ * const { data: order } = await buyer.placeOrder({ clientCode, sessionId: s.sessionId, ... });
1645
+ * if (order.razorpay) {
1646
+ * // Razorpay shops: checkout.js in the page, then the server checks it.
1647
+ * new Razorpay({ key: order.razorpay.keyId, order_id: order.razorpay.orderId,
1648
+ * handler: (r) => buyer.verifyRazorpay({ clientCode, sessionId: s.sessionId,
1649
+ * orderId: order.orderId, razorpayOrderId: r.razorpay_order_id,
1650
+ * razorpayPaymentId: r.razorpay_payment_id, razorpaySignature: r.razorpay_signature }),
1651
+ * }).open();
1652
+ * } else if (order.paymentUrl) window.location.href = order.paymentUrl;
1653
+ * ```
1301
1654
  */
1302
- declare class Checkout extends APIResource {
1303
- /**
1304
- * Retrieves product information for the checkout modal.
1305
- * @param productId - External SKU/ID of the product.
1306
- */
1307
- getProduct(productId: string): Promise<CheckoutProduct>;
1308
- /**
1309
- * Initializes a new checkout session.
1310
- */
1311
- createSession(payload: CreateSessionPayload): Promise<CheckoutSession>;
1655
+ declare class CheckoutBuyer extends APIResource {
1656
+ /** Product, what the shop takes (COD / online / delivery fee) and the consent notice. */
1657
+ getProduct(clientCode: string, productId: string): Promise<PublicCheckoutProductResponse>;
1658
+ /** A cart the shop's server opened (`t` of its `checkoutUrl`); 410 once expired. */
1659
+ viewSession(clientCode: string, token: string): Promise<PublicMerchantSessionResponse>;
1660
+ /** Drop lines or lower counts of the shop's cart (never add or raise). */
1661
+ updateItems(input: CheckoutCartEditInput): Promise<CheckoutResponse<PublicMerchantCart>>;
1662
+ /** Start a 15-minute checkout for one product (quantity 1–10). */
1663
+ startSession(input: {
1664
+ clientCode: string;
1665
+ productId: string;
1666
+ quantity: number;
1667
+ }): Promise<CheckoutResponse<CheckoutSession>>;
1668
+ applyCoupon(input: {
1669
+ clientCode: string;
1670
+ sessionId: string;
1671
+ code: string;
1672
+ }): Promise<CheckoutResponse<CheckoutSession>>;
1673
+ /** Truecaller one-tap, or the signed link the shop sent from a chat. */
1674
+ verify(input: CheckoutVerifyInput): Promise<CheckoutResponse<CheckoutVerifyResult>>;
1312
1675
  /**
1313
- * Applies a discount coupon to an active session.
1676
+ * Place the order. Online returns `razorpay` (open checkout.js in the page)
1677
+ * for Razorpay shops, or `paymentUrl` (a payment link) for Stripe shops.
1314
1678
  */
1315
- applyCoupon(payload: ApplyCouponPayload): Promise<CheckoutSession>;
1679
+ placeOrder(input: PlaceCheckoutOrderInput): Promise<CheckoutResponse<PlacedCheckoutOrder>>;
1316
1680
  /**
1317
- * Verifies user identity via Truecaller or OTP.
1681
+ * Relay Razorpay checkout.js's success response: the server checks the
1682
+ * signature with the shop's key secret and reads the payment from Razorpay
1683
+ * before marking the order paid. `paymentStatus` still "pending" = not
1684
+ * captured yet; ask again shortly (the shop's webhook also settles it).
1318
1685
  */
1319
- verify(payload: VerifyPayload): Promise<{
1320
- verified: boolean;
1321
- data?: any;
1322
- }>;
1686
+ verifyRazorpay(input: CheckoutRazorpayVerifyInput): Promise<CheckoutResponse<PublicCheckoutOrder>>;
1323
1687
  /**
1324
- * Finalizes the order and initiates payment.
1688
+ * The status / return page (`?t=` of `statusUrl`). For an unpaid online
1689
+ * order the server asks the gateway, so the order shows paid without a webhook.
1325
1690
  */
1326
- createOrder(payload: CreateOrderPayload): Promise<CheckoutOrderResponse>;
1691
+ orderStatus(clientCode: string, token: string): Promise<CheckoutResponse<PublicCheckoutOrder>>;
1692
+ /** The WhatsApp "confirm before we ship" page (`?t=` of the confirm link). */
1693
+ confirmCod(clientCode: string, token: string): Promise<CheckoutResponse<PublicCheckoutOrder>>;
1694
+ }
1695
+ /**
1696
+ * Checkouts the shop's own SERVER opens for its cart (website plugin): call
1697
+ * with the workspace API key from your backend, never from a browser. ERIX
1698
+ * uses your prices as sent and never changes them.
1699
+ *
1700
+ * @example
1701
+ * ```typescript
1702
+ * const { data } = await ecod.product.erix.checkout.sessions.create({
1703
+ * items: [{ sku: "KIT-1", name: "Beard Kit", pricePaise: 99_900, quantity: 2 }],
1704
+ * currency: "INR",
1705
+ * merchantOrderRef: "WC-1042",
1706
+ * });
1707
+ * // Hand data.checkoutUrl (or data.token) to the buyer's page.
1708
+ * ```
1709
+ */
1710
+ declare class CheckoutSessions extends APIResource {
1711
+ create(input: MerchantCheckoutSessionInput): Promise<CheckoutResponse<MerchantCheckoutSession>>;
1712
+ }
1713
+ /**
1714
+ * One-click checkout for the seller: products, coupons, orders, settings and
1715
+ * "Send product link". Mounted at `/product/erix/commerce/checkout`. Viewers
1716
+ * can read but not change anything (403 `VIEWER_READ_ONLY`). The buyer's
1717
+ * public calls are under {@link CheckoutBuyer} (`checkout.buyer`); the shop
1718
+ * server's cart sessions under {@link CheckoutSessions} (`checkout.sessions`).
1719
+ */
1720
+ declare class Checkout extends APIResource {
1721
+ readonly buyer: CheckoutBuyer;
1722
+ readonly sessions: CheckoutSessions;
1723
+ constructor(client: AxiosInstance);
1724
+ listProducts(): Promise<CheckoutResponse<CheckoutProduct[]>>;
1725
+ createProduct(input: CheckoutProductInput): Promise<CheckoutResponse<CheckoutProduct>>;
1726
+ updateProduct(productId: string, input: Partial<CheckoutProductInput>): Promise<CheckoutResponse<CheckoutProduct>>;
1727
+ /** Admins: deleted if never ordered, else archived (switched off). */
1728
+ deleteProduct(productId: string): Promise<CheckoutResponse<{
1729
+ deleted: boolean;
1730
+ archived: boolean;
1731
+ }>>;
1732
+ listCoupons(): Promise<CheckoutResponse<CheckoutCoupon[]>>;
1733
+ createCoupon(input: CheckoutCouponInput): Promise<CheckoutResponse<CheckoutCoupon>>;
1734
+ updateCoupon(couponId: string, input: CheckoutCouponPatch): Promise<CheckoutResponse<CheckoutCoupon>>;
1735
+ /** Admins only. */
1736
+ deleteCoupon(couponId: string): Promise<CheckoutResponse<{
1737
+ deleted: true;
1738
+ }>>;
1739
+ /** Newest first; `limit` 1–100 (default 50). */
1740
+ listOrders(params?: {
1741
+ status?: CheckoutOrderStatus;
1742
+ limit?: number;
1743
+ offset?: number;
1744
+ }): Promise<CheckoutResponse<CheckoutOrderList>>;
1745
+ getOrder(orderId: string): Promise<CheckoutResponse<CheckoutOrder>>;
1746
+ /** Confirm (COD), ship (+ https tracking link), deliver, cancel or mark returned. */
1747
+ updateOrderStatus(orderId: string, input: {
1748
+ status: CheckoutOrderAction;
1749
+ trackingUrl?: string | null;
1750
+ }): Promise<CheckoutResponse<CheckoutOrder>>;
1751
+ getSettings(): Promise<CheckoutResponse<CheckoutSettings>>;
1752
+ /** Admins only. */
1753
+ updateSettings(input: Partial<Pick<CheckoutSettings, "cod" | "deliveryFeePaise" | "webhookUrl">>): Promise<CheckoutResponse<Omit<CheckoutSettings, "online">>>;
1754
+ /** "Send product link": with `leadId`, a signed one-tap link for that contact. */
1755
+ createProductLink(input: {
1756
+ productId: string;
1757
+ leadId?: string;
1758
+ }): Promise<CheckoutResponse<CheckoutProductLink>>;
1327
1759
  }
1328
1760
 
1329
1761
  /**
@@ -5368,4 +5800,4 @@ declare function getRetryConfig(error: any): {
5368
5800
  readonly reason: "Generic API errors may be transient and worth retrying";
5369
5801
  };
5370
5802
 
5371
- export { type AIPersona, APIError, APIResource, type AgentAutonomy, type AgentBudget, AiAgent, type AiAgentSettings, type AiAgentTool, type AiHumanTopics, type AiOutcomeChannel, type AiOutcomeCounts, type AiOutcomes, type AiReviewItem, type AiReviewStats, type AiReviewVerdict, type AiSuggestion, type AnswerFollowupBody, type AnswerOnboardingPayload, type AnswerOnboardingResponse, type ApplyCouponPayload, type AssignEventPayload, AuthenticationError, type BehaviorRules, type CheckboxConfig, type CheckoutAmountBreakdown, type CheckoutOrderResponse, type CheckoutProduct, type CheckoutSession, type ColorRule, type ColumnConfig, type CompleteOnboardingPayload, type CompleteOnboardingResponse, type ConfidenceResponse, ConnectInfra, type Conversation, type ListParams as ConversationListParams, type Correction, type CreateLeadParams, type CreateOrderPayload, type CreatePipelineParams, type CreateSessionPayload, type CrmView, type CurrencyConfig, type CurrencyValue, type CustomFieldFilter, type DateConfig, type DateTimeConfig, type DropdownConfig, ECODrIxAPI as ECODrIx, ECODrIxAPI, type ECODrIxAPIOptions, ERROR_RETRY_CONFIG, type EditOnboardingPayload, type EditOnboardingResponse, type EmailConfig, EmailConnect, ErixChat, ErixProduct, type EventDefinition, type FieldConfig, type FieldDefinition, type FieldManifest, type FieldType, type FileConfig, type FilterOperator, type FilterRule, type FormulaConfig, type GlobalOnboardingPayload, HTTP_STATUS_ERROR_MAP, type ICP, type InboxChannel, InfraDomain, KNOWLEDGE_FILE_TYPES, Knowledge, type KnowledgePassage, type KnowledgeSource, LEAD_STATUS_VALUES, type LayoutType, type Lead, type LeadPattern, type LeadSource, type LeadStatus, type LearningMemory, type ListLeadsParams, type ManifestFieldType, type MappingField, type MappingPreviewResult, type MappingSources, type MappingValidationResult, type Message, type ModuleAgent, type ModuleAgentPatch, type ModuleAgentSettings, type ModuleAgentTool, type NichePack, type NichePackResearchConfig, type NichePackStatus, type NormalizedFieldValue, type NumberConfig, Onboarding, type OnboardingCohortRange, type OnboardingConfig, type OnboardingExperiment, type OnboardingExperimentStatus, type OnboardingExperimentVariant, type OnboardingMemoryMapping, type OnboardingOption, type OnboardingSession, type OnboardingSessionStatus, type OnboardingStateResponse, type OnboardingStep, type OnboardingStepType, type OutboundMedia, type OutreachEdit, type PaginatedResponse, type PausedRun, Persona, type PersonaFollowupQuestion, type PersonaFollowupsResponse, type PersonaIdentity, type PersonaTimelineEntry, type PersonaTimelineOptions, type PersonaTimelineResponse, type PhoneConfig, type Pipeline, type PipelineStage, type PipelineStageParams, PlatformDomain, PlatformTenants, PlatformUsers, ProductDomain, type ProgressConfig, RateLimitError, type RatingConfig, type ReinforceResponse, type ReinforcementEvent, type RelationConfig, type RelationValue, type RequestOptions, type ResourceManifest, type SendMessageParams, type SendTemplateParams, type ServiceConfig, type ServiceConfigGlobal, type ServiceConfigPerProduct, type SortRule, type StartOnboardingPayload, type StartOnboardingResponse, StorageInfra, type StoredFieldValue, type SuggestionEvent, type TagsConfig, type Template, type TemplateApiResponse, type TemplateBinding, type TemplateBindingSource, type TemplateComponent, type TemplateEmptyPolicy, type TemplateMapping, type TextConfig, type TriggerPayload, type TriggerResponse, type UpsertLeadParams, type UrlConfig, type VerifyPayload, type ViewConfig, type Vocabulary, WebchatOwnerSettings, WebchatSettingsPatch, WebhookSignatureError, Webhooks, WhatsAppConnect, type WorkspaceDashboardLayout, type WorkspaceDefaultAutomation, type WorkspaceDefaultField, type WorkspaceDefaultPipeline, type WorkspaceModuleConfig, type WorkspaceProfile, ECODrIxAPI as default, getErrorDetails, getRetryConfig, handleAPIError, isAPIError };
5803
+ export { type AIPersona, APIError, APIResource, type AgentAutonomy, type AgentBudget, AiAgent, type AiAgentSettings, type AiAgentTool, type AiHumanTopics, type AiOutcomeChannel, type AiOutcomeCounts, type AiOutcomes, type AiReviewItem, type AiReviewStats, type AiReviewVerdict, type AiSuggestion, type AnswerFollowupBody, type AnswerOnboardingPayload, type AnswerOnboardingResponse, type AssignEventPayload, AuthenticationError, type BehaviorRules, type CheckboxConfig, type CheckoutAddress, type CheckoutAmounts, type CheckoutCartEditInput, type CheckoutCoupon, type CheckoutCouponInput, type CheckoutCouponPatch, type CheckoutItem, type CheckoutOrder, type CheckoutOrderAction, type CheckoutOrderList, type CheckoutOrderStatus, type CheckoutProduct, type CheckoutProductInput, type CheckoutProductLink, type CheckoutRazorpayVerifyInput, type CheckoutResponse, type CheckoutSession, type CheckoutSettings, type CheckoutVerifyInput, type CheckoutVerifyResult, type ColorRule, type ColumnConfig, type CompleteOnboardingPayload, type CompleteOnboardingResponse, type ConfidenceResponse, ConnectInfra, type Conversation, type ListParams as ConversationListParams, type Correction, type CreateLeadParams, type CreatePipelineParams, type CrmView, type CurrencyConfig, type CurrencyValue, type CustomFieldFilter, type DateConfig, type DateTimeConfig, type DropdownConfig, type DuplicateLead, ECODrIxAPI as ECODrIx, ECODrIxAPI, type ECODrIxAPIOptions, ERROR_RETRY_CONFIG, type EditOnboardingPayload, type EditOnboardingResponse, type EmailConfig, EmailConnect, ErixChat, ErixProduct, type EventDefinition, type FieldConfig, type FieldDefinition, type FieldManifest, type FieldType, type FileConfig, type FilterOperator, type FilterRule, type FormulaConfig, type GlobalOnboardingPayload, HTTP_STATUS_ERROR_MAP, type ICP, type InboxChannel, InfraDomain, KNOWLEDGE_FILE_TYPES, Knowledge, type KnowledgePassage, type KnowledgeSource, LEAD_STATUS_VALUES, type LayoutType, type Lead, type LeadPattern, type LeadSource, type LeadStatus, type LearningMemory, type ListLeadsParams, type ManifestFieldType, type MappingField, type MappingPreviewResult, type MappingSources, type MappingValidationResult, type MerchantCheckoutSession, type MerchantCheckoutSessionInput, type Message, type ModuleAgent, type ModuleAgentPatch, type ModuleAgentSettings, type ModuleAgentTool, type NichePack, type NichePackResearchConfig, type NichePackStatus, type NormalizedFieldValue, type NumberConfig, Onboarding, type OnboardingCohortRange, type OnboardingConfig, type OnboardingExperiment, type OnboardingExperimentStatus, type OnboardingExperimentVariant, type OnboardingMemoryMapping, type OnboardingOption, type OnboardingSession, type OnboardingSessionStatus, type OnboardingStateResponse, type OnboardingStep, type OnboardingStepType, type OutboundMedia, type OutreachEdit, type PaginatedResponse, type PausedRun, Persona, type PersonaFollowupQuestion, type PersonaFollowupsResponse, type PersonaIdentity, type PersonaTimelineEntry, type PersonaTimelineOptions, type PersonaTimelineResponse, type PhoneConfig, type Pipeline, type PipelineStage, type PipelineStageParams, type PlaceCheckoutOrderInput, type PlacedCheckoutOrder, PlatformDomain, PlatformTenants, PlatformUsers, ProductDomain, type ProgressConfig, type PublicCheckoutOrder, type PublicCheckoutProduct, type PublicCheckoutProductResponse, type PublicMerchantCart, type PublicMerchantSession, type PublicMerchantSessionResponse, RateLimitError, type RatingConfig, type RazorpayCheckoutOptions, type ReinforceResponse, type ReinforcementEvent, type RelationConfig, type RelationValue, type RequestOptions, type ResourceManifest, type SendMessageParams, type SendTemplateParams, type ServiceConfig, type ServiceConfigGlobal, type ServiceConfigPerProduct, type SortRule, type StartOnboardingPayload, type StartOnboardingResponse, StorageInfra, type StoredFieldValue, type SuggestionEvent, type TagsConfig, type Template, type TemplateApiResponse, type TemplateBinding, type TemplateBindingSource, type TemplateComponent, type TemplateEmptyPolicy, type TemplateMapping, type TextConfig, type TriggerPayload, type TriggerResponse, type UpsertLeadParams, type UrlConfig, type ViewConfig, type Vocabulary, WebchatOwnerSettings, WebchatSettingsPatch, WebhookSignatureError, Webhooks, WhatsAppConnect, type WorkspaceDashboardLayout, type WorkspaceDefaultAutomation, type WorkspaceDefaultField, type WorkspaceDefaultPipeline, type WorkspaceModuleConfig, type WorkspaceProfile, ECODrIxAPI as default, getErrorDetails, getRetryConfig, handleAPIError, isAPIError };