@delopay/sdk 0.83.0 → 0.85.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/internal.cjs CHANGED
@@ -43,6 +43,7 @@ __export(internal_exports, {
43
43
  Cache: () => Cache,
44
44
  CardIssuers: () => CardIssuers,
45
45
  Cards: () => Cards,
46
+ CheckoutSession: () => CheckoutSession,
46
47
  Configs: () => Configs,
47
48
  ConnectorRestrictionRules: () => ConnectorRestrictionRules,
48
49
  ConnectorRestrictions: () => ConnectorRestrictions,
@@ -63,11 +64,13 @@ __export(internal_exports, {
63
64
  NATIVE_PANES_MAX: () => NATIVE_PANES_MAX,
64
65
  NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
65
66
  NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
67
+ OperationLimits: () => OperationLimits,
66
68
  PlatformBilling: () => PlatformBilling,
67
69
  PlatformFees: () => PlatformFees,
68
70
  Regions: () => Regions,
69
71
  STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
70
72
  Search: () => Search,
73
+ Settlement: () => Settlement,
71
74
  Subscriptions: () => Subscriptions,
72
75
  Webhooks: () => Webhooks,
73
76
  allOf: () => allOf,
@@ -1551,6 +1554,39 @@ var Payments = class {
1551
1554
  ...options
1552
1555
  });
1553
1556
  }
1557
+ /**
1558
+ * The status timeline of client/device observations captured while the
1559
+ * buyer interacted with the payment (checkout opens, confirms, redirect
1560
+ * legs, reported client signals), oldest first.
1561
+ *
1562
+ * `GET /payments/{paymentId}/client-context`
1563
+ */
1564
+ async listClientContext(paymentId, options) {
1565
+ return this.request(
1566
+ "GET",
1567
+ `/payments/${encodeURIComponent(paymentId)}/client-context`,
1568
+ options
1569
+ );
1570
+ }
1571
+ /**
1572
+ * Soft-delete a payment. Only payments whose status is in the merchant's
1573
+ * delete policy (see {@link Payments.getDeletePolicy}) can be deleted;
1574
+ * anything else fails with a precondition error.
1575
+ *
1576
+ * `DELETE /payments/{paymentId}`
1577
+ */
1578
+ async delete(paymentId, options) {
1579
+ return this.request("DELETE", `/payments/${encodeURIComponent(paymentId)}`, options);
1580
+ }
1581
+ /**
1582
+ * The effective deletable-status set for the calling merchant — lets a
1583
+ * dashboard show the delete action only where it is allowed.
1584
+ *
1585
+ * `GET /payments/delete-policy`
1586
+ */
1587
+ async getDeletePolicy(options) {
1588
+ return this.request("GET", "/payments/delete-policy", options);
1589
+ }
1554
1590
  // --- Advanced operations (Task 3.2) ---
1555
1591
  /** Generate session tokens. `POST /payments/session-tokens` */
1556
1592
  async sessionTokens(params) {
@@ -1621,10 +1657,30 @@ var Payments = class {
1621
1657
  async listByFilter(params) {
1622
1658
  return this.request("POST", "/payments/list", { body: params });
1623
1659
  }
1660
+ /**
1661
+ * List payments by filter, scoped to the caller's profile (the shop-user
1662
+ * twin of `listByFilter`). The backend narrows to the profile from the
1663
+ * auth context, so `profile_id` / `project_id` must not be sent.
1664
+ *
1665
+ * Not to be confused with {@link Payments.listByProfile}, which is the GET
1666
+ * cursor variant and rejects this body.
1667
+ *
1668
+ * `POST /payments/profile/list`
1669
+ */
1670
+ async listByProfileFilter(params, options) {
1671
+ return this.request("POST", "/payments/profile/list", { body: params, ...options });
1672
+ }
1624
1673
  /** Get payment filter options. `GET /payments/filter` */
1625
1674
  async getFilters(params) {
1626
1675
  return this.request("GET", "/payments/filter", { query: params });
1627
1676
  }
1677
+ /**
1678
+ * Get payment filter options, scoped to the caller's profile.
1679
+ * `GET /payments/profile/filter`
1680
+ */
1681
+ async getFiltersByProfile(params) {
1682
+ return this.request("GET", "/payments/profile/filter", { query: params });
1683
+ }
1628
1684
  /** Get payment aggregates. `GET /payments/aggregate` */
1629
1685
  async aggregate(params) {
1630
1686
  return this.request("GET", "/payments/aggregate", { query: params });
@@ -1825,6 +1881,16 @@ var Profiles = class {
1825
1881
  async list(accountId) {
1826
1882
  return this.request("GET", `/account/${encodeURIComponent(accountId)}/business-profile`);
1827
1883
  }
1884
+ /**
1885
+ * List the business profiles the caller can see at profile scope — the
1886
+ * `ProfileAccountRead` twin of `list()` (which needs merchant-level read).
1887
+ * A shop-scoped user gets exactly their own shop back.
1888
+ *
1889
+ * `GET /account/{accountId}/profile`
1890
+ */
1891
+ async listByProfile(accountId) {
1892
+ return this.request("GET", `/account/${encodeURIComponent(accountId)}/profile`);
1893
+ }
1828
1894
  async update(accountId, profileId, params) {
1829
1895
  return this.request(
1830
1896
  "POST",
@@ -2468,7 +2534,7 @@ var Shops = class {
2468
2534
  /**
2469
2535
  * Upload a logo file for a shop. The file is stored in Delopay's configured
2470
2536
  * object store and a public HTTPS URL is returned. This method does NOT write
2471
- * the URL into the shop's `payment_link_config.default_config.logo` — call
2537
+ * the URL into the shop's `payment_link_config.logo` — call
2472
2538
  * `shops.update` afterwards with the returned `logo_url` to persist the change.
2473
2539
  *
2474
2540
  * Accepts PNG, JPEG, WebP or SVG. The file must be ≤ 1 MiB.
@@ -2482,7 +2548,7 @@ var Shops = class {
2482
2548
  * ```typescript
2483
2549
  * const { logo_url } = await delopay.shops.uploadLogo('merch_1', 'pro_1', file);
2484
2550
  * await delopay.shops.update('merch_1', 'pro_1', {
2485
- * payment_link_config: { default_config: { logo: logo_url } },
2551
+ * payment_link_config: { logo: logo_url },
2486
2552
  * });
2487
2553
  * ```
2488
2554
  */
@@ -2495,6 +2561,29 @@ var Shops = class {
2495
2561
  { body: form }
2496
2562
  );
2497
2563
  }
2564
+ /**
2565
+ * Update only the checkout appearance (the `payment_link_config` blob:
2566
+ * theme, logo, colours, seller name, SDK layout/rules, DeloPay-branding
2567
+ * toggle) of a shop. Applied as a whole-object replace of
2568
+ * `payment_link_config`, mirroring the shop-update semantics.
2569
+ *
2570
+ * Gated on the dedicated `CheckoutBranding` permission, so "may restyle
2571
+ * the checkout" can be granted without full account/shop write.
2572
+ *
2573
+ * `POST /shops/{merchantId}/{shopId}/checkout-branding`
2574
+ *
2575
+ * @param merchantId - The merchant account ID.
2576
+ * @param shopId - The shop (business profile) ID to restyle.
2577
+ * @param params - The new `payment_link_config` blob (full replacement).
2578
+ * @returns The updated business profile.
2579
+ */
2580
+ async updateCheckoutBranding(merchantId, shopId, params, options) {
2581
+ return this.request(
2582
+ "POST",
2583
+ `/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/checkout-branding`,
2584
+ { body: params, ...options }
2585
+ );
2586
+ }
2498
2587
  };
2499
2588
 
2500
2589
  // src/resources/stripeConnect.ts
@@ -3360,6 +3449,283 @@ var Subscriptions = class {
3360
3449
  ...options
3361
3450
  });
3362
3451
  }
3452
+ /**
3453
+ * Resolve which of the given payments were raised by a subscription.
3454
+ * `POST /subscriptions/payments/lookup`
3455
+ *
3456
+ * The linkage exists in one direction only — an invoice points at the payment
3457
+ * it settled, and nothing is stamped on the payment — so this is the only way
3458
+ * to tell a subscription charge from a one-off one when you are holding a
3459
+ * page of payments. In particular, do not use `off_session` or the presence
3460
+ * of a mandate: an ordinary saved-card charge sets those identically.
3461
+ *
3462
+ * Ids that belong to no subscription are **absent** from `links` rather than
3463
+ * returned as an error, so match on presence:
3464
+ *
3465
+ * ```ts
3466
+ * const { links } = await subscriptions.lookupPayments(
3467
+ * { payment_ids: page.map((p) => p.payment_id) },
3468
+ * { headers: { 'X-Profile-Id': profileId } },
3469
+ * );
3470
+ * const bySubscription = new Map(links.map((l) => [l.payment_id, l]));
3471
+ * ```
3472
+ *
3473
+ * Profile-scoped like every other subscription route, and that matters more
3474
+ * here than elsewhere: a `payment_id` is merchant-supplied and only unique
3475
+ * within a merchant, so the shop is part of the question, not an
3476
+ * optimisation. Pass the profile that owns **the payments** — for a list
3477
+ * spanning several shops, group the ids by shop and call once per group.
3478
+ *
3479
+ * At most 200 ids per call.
3480
+ */
3481
+ async lookupPayments(params, options) {
3482
+ return this.request("POST", "/subscriptions/payments/lookup", { body: params, ...options });
3483
+ }
3484
+ };
3485
+
3486
+ // src/resources/settlement.ts
3487
+ var Settlement = class {
3488
+ constructor(request) {
3489
+ this.request = request;
3490
+ }
3491
+ /**
3492
+ * Per-shop settlement rollup for the host merchant: unpaid totals and the
3493
+ * running current period, one row per shop.
3494
+ *
3495
+ * `GET /settlement/overview`
3496
+ */
3497
+ async overview(params, options) {
3498
+ return this.request("GET", "/settlement/overview", {
3499
+ query: { test_mode: params.test_mode },
3500
+ ...options
3501
+ });
3502
+ }
3503
+ /**
3504
+ * Live rollup of the current (not yet statemented) period.
3505
+ *
3506
+ * `GET /settlement/current`
3507
+ */
3508
+ async current(params, options) {
3509
+ return this.request("GET", "/settlement/current", {
3510
+ query: { test_mode: params.test_mode, profile_id: params.profile_id },
3511
+ ...options
3512
+ });
3513
+ }
3514
+ /**
3515
+ * List generated settlement statements, newest first.
3516
+ *
3517
+ * `GET /settlement/statements`
3518
+ */
3519
+ async listStatements(params, options) {
3520
+ return this.request("GET", "/settlement/statements", {
3521
+ query: {
3522
+ test_mode: params.test_mode,
3523
+ profile_id: params.profile_id,
3524
+ limit: params.limit,
3525
+ offset: params.offset
3526
+ },
3527
+ ...options
3528
+ });
3529
+ }
3530
+ /**
3531
+ * One statement with its per-connector/currency breakdown.
3532
+ *
3533
+ * `GET /settlement/statements/{statementId}`
3534
+ */
3535
+ async retrieveStatement(statementId, options) {
3536
+ return this.request(
3537
+ "GET",
3538
+ `/settlement/statements/${encodeURIComponent(statementId)}`,
3539
+ options
3540
+ );
3541
+ }
3542
+ /**
3543
+ * Generate (or regenerate) the statement for one shop and calendar month.
3544
+ *
3545
+ * `POST /settlement/statements/generate`
3546
+ */
3547
+ async generateStatement(params, options) {
3548
+ return this.request("POST", "/settlement/statements/generate", {
3549
+ body: params,
3550
+ ...options
3551
+ });
3552
+ }
3553
+ /**
3554
+ * Record payout progress on a statement (`unpaid` / `partial` / `paid`).
3555
+ *
3556
+ * `POST /settlement/statements/{statementId}/payout`
3557
+ */
3558
+ async updateStatementPayout(statementId, params, options) {
3559
+ return this.request(
3560
+ "POST",
3561
+ `/settlement/statements/${encodeURIComponent(statementId)}/payout`,
3562
+ { body: params, ...options }
3563
+ );
3564
+ }
3565
+ /**
3566
+ * Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
3567
+ * the same auth, retries and error handling as every other call — persist
3568
+ * or object-URL it caller-side.
3569
+ *
3570
+ * `GET /settlement/statements/{statementId}/pdf`
3571
+ *
3572
+ * @example
3573
+ * ```typescript
3574
+ * const pdf = await delopay.settlement.downloadStatementPdf('stmt_1', {
3575
+ * currency: 'EUR',
3576
+ * include_transactions: true,
3577
+ * });
3578
+ * const url = URL.createObjectURL(pdf);
3579
+ * ```
3580
+ */
3581
+ async downloadStatementPdf(statementId, params, options) {
3582
+ return this.request("GET", `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {
3583
+ query: {
3584
+ currency: params?.currency,
3585
+ include_transactions: params?.include_transactions
3586
+ },
3587
+ responseType: "blob",
3588
+ ...options
3589
+ });
3590
+ }
3591
+ /**
3592
+ * The individual settled attempts of one shop's calendar month.
3593
+ *
3594
+ * `GET /settlement/lines`
3595
+ */
3596
+ async listLines(params, options) {
3597
+ return this.request("GET", "/settlement/lines", {
3598
+ query: {
3599
+ profile_id: params.profile_id,
3600
+ year: params.year,
3601
+ month: params.month,
3602
+ test_mode: params.test_mode,
3603
+ limit: params.limit,
3604
+ offset: params.offset
3605
+ },
3606
+ ...options
3607
+ });
3608
+ }
3609
+ /**
3610
+ * The fee schedules that currently apply to a shop.
3611
+ *
3612
+ * `GET /settlement/fee-config`
3613
+ */
3614
+ async feeConfig(params, options) {
3615
+ return this.request("GET", "/settlement/fee-config", {
3616
+ query: { profile_id: params.profile_id },
3617
+ ...options
3618
+ });
3619
+ }
3620
+ /**
3621
+ * Enqueue a settlement-line backfill over historical attempts. Attempts
3622
+ * already covered by a line are always skipped.
3623
+ *
3624
+ * `POST /settlement/backfill`
3625
+ */
3626
+ async backfill(params, options) {
3627
+ return this.request("POST", "/settlement/backfill", { body: params, ...options });
3628
+ }
3629
+ /**
3630
+ * Toggle whether a shop's owner can see their own settlement figures.
3631
+ *
3632
+ * `POST /settlement/shops/visibility`
3633
+ */
3634
+ async setShopVisibility(params, options) {
3635
+ return this.request("POST", "/settlement/shops/visibility", {
3636
+ body: params,
3637
+ ...options
3638
+ });
3639
+ }
3640
+ /**
3641
+ * Manual adjustments recorded on a statement.
3642
+ *
3643
+ * `GET /settlement/statements/{statementId}/adjustments`
3644
+ */
3645
+ async listStatementAdjustments(statementId, options) {
3646
+ return this.request(
3647
+ "GET",
3648
+ `/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,
3649
+ options
3650
+ );
3651
+ }
3652
+ /**
3653
+ * Add a manual adjustment to a statement. Positive `amount_usd` charges
3654
+ * the shop (reducing their payout); negative credits them.
3655
+ *
3656
+ * `POST /settlement/statements/{statementId}/adjustments`
3657
+ */
3658
+ async createStatementAdjustment(statementId, params, options) {
3659
+ return this.request(
3660
+ "POST",
3661
+ `/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,
3662
+ { body: params, ...options }
3663
+ );
3664
+ }
3665
+ /**
3666
+ * Remove a manual adjustment from a statement.
3667
+ *
3668
+ * `DELETE /settlement/statements/{statementId}/adjustments/{adjustmentId}`
3669
+ */
3670
+ async deleteStatementAdjustment(statementId, adjustmentId, options) {
3671
+ return this.request(
3672
+ "DELETE",
3673
+ `/settlement/statements/${encodeURIComponent(statementId)}/adjustments/${encodeURIComponent(adjustmentId)}`,
3674
+ options
3675
+ );
3676
+ }
3677
+ };
3678
+
3679
+ // src/resources/operationLimits.ts
3680
+ var OperationLimits = class {
3681
+ constructor(request) {
3682
+ this.request = request;
3683
+ }
3684
+ /**
3685
+ * List the merchant's limit rules, optionally for one operation.
3686
+ *
3687
+ * `GET /operation-limits/rules`
3688
+ */
3689
+ async listRules(params, options) {
3690
+ return this.request("GET", "/operation-limits/rules", {
3691
+ query: { operation: params?.operation },
3692
+ ...options
3693
+ });
3694
+ }
3695
+ /**
3696
+ * Create or replace the limit rule for one target. Full-replace upsert:
3697
+ * absent limit fields clear that dimension.
3698
+ *
3699
+ * `PUT /operation-limits/rules`
3700
+ */
3701
+ async upsertRule(params, options) {
3702
+ return this.request("PUT", "/operation-limits/rules", { body: params, ...options });
3703
+ }
3704
+ /**
3705
+ * Delete a limit rule.
3706
+ *
3707
+ * `DELETE /operation-limits/rules/{ruleId}`
3708
+ */
3709
+ async deleteRule(ruleId, options) {
3710
+ return this.request("DELETE", `/operation-limits/rules/${encodeURIComponent(ruleId)}`, options);
3711
+ }
3712
+ /**
3713
+ * The merchant-level enforcement settings. An untouched merchant gets the
3714
+ * defaults: rolling window, admins not exempt.
3715
+ *
3716
+ * `GET /operation-limits/settings`
3717
+ */
3718
+ async retrieveSettings(options) {
3719
+ return this.request("GET", "/operation-limits/settings", options);
3720
+ }
3721
+ /**
3722
+ * Update the enforcement settings. Only provided fields change.
3723
+ *
3724
+ * `PUT /operation-limits/settings`
3725
+ */
3726
+ async updateSettings(params, options) {
3727
+ return this.request("PUT", "/operation-limits/settings", { body: params, ...options });
3728
+ }
3363
3729
  };
3364
3730
 
3365
3731
  // src/client.ts
@@ -3489,6 +3855,8 @@ var Delopay = class {
3489
3855
  this.relay = new Relay(request);
3490
3856
  this.stripeConnect = new StripeConnect(request);
3491
3857
  this.threeDsRules = new ThreeDsRules(request);
3858
+ this.settlement = new Settlement(request);
3859
+ this.operationLimits = new OperationLimits(request);
3492
3860
  this.subscriptions = new Subscriptions(request);
3493
3861
  this.files = new Files(request);
3494
3862
  this.export = new Export(request);
@@ -3612,7 +3980,8 @@ var Delopay = class {
3612
3980
  method,
3613
3981
  headers,
3614
3982
  body: serializedBody,
3615
- signal: combined.signal
3983
+ signal: combined.signal,
3984
+ ...options?.keepalive !== void 0 ? { keepalive: options.keepalive } : {}
3616
3985
  });
3617
3986
  const requestId = response.headers?.get("x-request-id") ?? response.headers?.get("x-trace-id") ?? void 0;
3618
3987
  emit("response", { status: response.status, method, path, requestId });
@@ -3659,6 +4028,12 @@ var Delopay = class {
3659
4028
  }
3660
4029
  throw error;
3661
4030
  }
4031
+ if (options?.responseType === "blob") {
4032
+ return await response.blob();
4033
+ }
4034
+ if (options?.responseType === "arraybuffer") {
4035
+ return await response.arrayBuffer();
4036
+ }
3662
4037
  const text = await response.text();
3663
4038
  return text ? JSON.parse(text) : void 0;
3664
4039
  } catch (err) {
@@ -4902,6 +5277,205 @@ function shadowFor(style) {
4902
5277
  }
4903
5278
  }
4904
5279
 
5280
+ // src/checkoutSession.ts
5281
+ function withoutCredentialHeaders(extra) {
5282
+ if (!extra) return {};
5283
+ const out = {};
5284
+ for (const [key, value] of Object.entries(extra)) {
5285
+ const lower = key.toLowerCase();
5286
+ if (lower === "api-key" || lower === "authorization") continue;
5287
+ out[key] = value;
5288
+ }
5289
+ return out;
5290
+ }
5291
+ var CheckoutSession = class {
5292
+ constructor(options) {
5293
+ this.merchantId = options.merchantId;
5294
+ this.paymentId = options.paymentId;
5295
+ this.publishableKey = options.publishableKey;
5296
+ this.clientSecret = options.clientSecret;
5297
+ this.client = new Delopay("", {
5298
+ baseUrl: options.baseUrl,
5299
+ sandbox: options.sandbox,
5300
+ timeout: options.timeout,
5301
+ maxRetries: options.maxRetries,
5302
+ debug: options.debug,
5303
+ logger: options.logger
5304
+ });
5305
+ }
5306
+ get linkBase() {
5307
+ return `/payment-link/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`;
5308
+ }
5309
+ /** Headers for the client-secret bearer routes (`/payment-link/*`). */
5310
+ bearerHeaders(extra) {
5311
+ return {
5312
+ ...withoutCredentialHeaders(extra),
5313
+ Authorization: `Bearer ${this.requireClientSecret()}`
5314
+ };
5315
+ }
5316
+ /** Headers for the publishable-key routes (`/payments/*`, `/payment-methods`). */
5317
+ pkHeaders(extra) {
5318
+ if (!this.publishableKey) {
5319
+ throw new DelopayError("This call requires the publishable key", {
5320
+ status: 0,
5321
+ code: "MISSING_CREDENTIAL",
5322
+ type: "invalid_request"
5323
+ });
5324
+ }
5325
+ return { ...withoutCredentialHeaders(extra), "api-key": this.publishableKey };
5326
+ }
5327
+ requireClientSecret() {
5328
+ if (!this.clientSecret) {
5329
+ throw new DelopayError("This call requires the payment client secret", {
5330
+ status: 0,
5331
+ code: "MISSING_CREDENTIAL",
5332
+ type: "invalid_request"
5333
+ });
5334
+ }
5335
+ return this.clientSecret;
5336
+ }
5337
+ /**
5338
+ * The Paysepro rail catalog for the buyer's country.
5339
+ *
5340
+ * `GET /payment-link/{merchantId}/{paymentId}/paysepro/methods`
5341
+ *
5342
+ * @param country - Lowercase ISO 3166-1 alpha-2 country code.
5343
+ */
5344
+ async payseproMethods(country, options) {
5345
+ return this.client.request("GET", `${this.linkBase}/paysepro/methods`, {
5346
+ query: { cc: country },
5347
+ ...options,
5348
+ headers: this.bearerHeaders(options?.headers)
5349
+ });
5350
+ }
5351
+ /**
5352
+ * The e-Payouts rail catalog for the buyer's country, plus the set of
5353
+ * countries that have at least one vendor.
5354
+ *
5355
+ * `GET /payment-link/{merchantId}/{paymentId}/epayouts/methods`
5356
+ *
5357
+ * @param country - Lowercase ISO 3166-1 alpha-2 country code.
5358
+ */
5359
+ async epayoutsMethods(country, options) {
5360
+ return this.client.request("GET", `${this.linkBase}/epayouts/methods`, {
5361
+ query: { cc: country },
5362
+ ...options,
5363
+ headers: this.bearerHeaders(options?.headers)
5364
+ });
5365
+ }
5366
+ /**
5367
+ * Record a buyer-side checkout event on the payment's status timeline.
5368
+ *
5369
+ * Telemetry semantics, built in so callers can genuinely fire-and-forget:
5370
+ * the request is sent with `keepalive: true` (it survives the document
5371
+ * navigating away, e.g. right before a `window.open`), and transport or
5372
+ * server failures resolve to `undefined` instead of rejecting — telemetry
5373
+ * must never break a checkout or surface an unhandled rejection. Do not
5374
+ * `await` this in a click handler that must stay synchronous.
5375
+ *
5376
+ * A missing client secret still throws `MISSING_CREDENTIAL`: that is a
5377
+ * wiring bug, not a telemetry failure.
5378
+ *
5379
+ * `POST /payment-link/{merchantId}/{paymentId}/checkout-events`
5380
+ */
5381
+ async recordEvent(params, options) {
5382
+ const headers = this.bearerHeaders(options?.headers);
5383
+ try {
5384
+ return await this.client.request("POST", `${this.linkBase}/checkout-events`, {
5385
+ body: params,
5386
+ keepalive: true,
5387
+ ...options,
5388
+ headers
5389
+ });
5390
+ } catch {
5391
+ return void 0;
5392
+ }
5393
+ }
5394
+ /**
5395
+ * A short-lived VGS Collect session for browser-side card capture.
5396
+ *
5397
+ * A 404 — or a 400 carrying the "shop has no vault" code — means the shop
5398
+ * has no vault configured; other errors must NOT be treated that way (a
5399
+ * refused vault falling back to an unprotected card pane is exactly the
5400
+ * bug this endpoint's error contract exists to prevent).
5401
+ *
5402
+ * `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
5403
+ */
5404
+ async vaultCollectSession(options) {
5405
+ return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
5406
+ ...options,
5407
+ headers: this.bearerHeaders(options?.headers)
5408
+ });
5409
+ }
5410
+ /**
5411
+ * Register the aliased card as a payment method and mint the one-shot
5412
+ * `payment_token` the confirm call spends.
5413
+ *
5414
+ * `POST /payment-link/{merchantId}/{paymentId}/vault/payment-method`
5415
+ */
5416
+ async registerVaultPaymentMethod(params, options) {
5417
+ return this.client.request("POST", `${this.linkBase}/vault/payment-method`, {
5418
+ body: params,
5419
+ ...options,
5420
+ headers: this.bearerHeaders(options?.headers)
5421
+ });
5422
+ }
5423
+ /**
5424
+ * The payment's current state — status polling for redirect/popup rails.
5425
+ *
5426
+ * `GET /payments/{paymentId}` (publishable key + client secret)
5427
+ */
5428
+ async retrievePayment(options) {
5429
+ return this.client.request("GET", `/payments/${encodeURIComponent(this.paymentId)}`, {
5430
+ query: { client_secret: this.requireClientSecret() },
5431
+ ...options,
5432
+ headers: this.pkHeaders(options?.headers)
5433
+ });
5434
+ }
5435
+ /**
5436
+ * Update the payment before confirmation (e.g. persist custom-field
5437
+ * answers as `metadata` on rails that never hit `/confirm`). The client
5438
+ * secret is attached automatically.
5439
+ *
5440
+ * `POST /payments/{paymentId}` (publishable key)
5441
+ */
5442
+ async updatePayment(params, options) {
5443
+ return this.client.request("POST", `/payments/${encodeURIComponent(this.paymentId)}`, {
5444
+ body: { ...params, client_secret: this.requireClientSecret() },
5445
+ ...options,
5446
+ headers: this.pkHeaders(options?.headers)
5447
+ });
5448
+ }
5449
+ /**
5450
+ * Confirm the payment. The client secret is attached automatically; pass
5451
+ * an `Idempotency-Key` header via `options` to make retries safe.
5452
+ *
5453
+ * `POST /payments/{paymentId}/confirm` (publishable key)
5454
+ */
5455
+ async confirmPayment(params, options) {
5456
+ return this.client.request("POST", `/payments/${encodeURIComponent(this.paymentId)}/confirm`, {
5457
+ body: { ...params, client_secret: this.requireClientSecret() },
5458
+ ...options,
5459
+ headers: this.pkHeaders(options?.headers)
5460
+ });
5461
+ }
5462
+ /**
5463
+ * Payment methods available for this payment.
5464
+ *
5465
+ * `GET /payment-methods` (publishable key + client secret)
5466
+ *
5467
+ * @param params - Optional filters; `country` is the highest-precedence
5468
+ * geo hint, ahead of billing address and IP geolocation.
5469
+ */
5470
+ async listPaymentMethods(params, options) {
5471
+ return this.client.request("GET", "/payment-methods", {
5472
+ query: { client_secret: this.requireClientSecret(), country: params?.country },
5473
+ ...options,
5474
+ headers: this.pkHeaders(options?.headers)
5475
+ });
5476
+ }
5477
+ };
5478
+
4905
5479
  // src/nativePanes.ts
4906
5480
  var STRIPE_NATIVE_PANE_METHODS = [
4907
5481
  {
@@ -5331,6 +5905,212 @@ var AdminPortal = class {
5331
5905
  { body: { iframe_allowed_origins: origins } }
5332
5906
  );
5333
5907
  }
5908
+ /**
5909
+ * Soft-delete a transaction of ANY merchant. Only payments whose status
5910
+ * is in the admin delete policy can be deleted; the action is audited.
5911
+ *
5912
+ * `DELETE /admin-portal/transactions/{paymentId}`
5913
+ */
5914
+ async deleteTransaction(paymentId) {
5915
+ return this.request("DELETE", `/admin-portal/transactions/${encodeURIComponent(paymentId)}`);
5916
+ }
5917
+ /**
5918
+ * Recover (undelete) a soft-deleted transaction. Audited.
5919
+ *
5920
+ * `POST /admin-portal/transactions/{paymentId}/recover`
5921
+ */
5922
+ async recoverTransaction(paymentId) {
5923
+ return this.request(
5924
+ "POST",
5925
+ `/admin-portal/transactions/${encodeURIComponent(paymentId)}/recover`
5926
+ );
5927
+ }
5928
+ /**
5929
+ * Client/device observations captured while the buyer interacted with a
5930
+ * transaction of ANY merchant, oldest first.
5931
+ *
5932
+ * `GET /admin-portal/transactions/{paymentId}/client-context`
5933
+ */
5934
+ async getTransactionClientContext(paymentId) {
5935
+ return this.request(
5936
+ "GET",
5937
+ `/admin-portal/transactions/${encodeURIComponent(paymentId)}/client-context`
5938
+ );
5939
+ }
5940
+ /**
5941
+ * The global payment auto-close policy.
5942
+ * `GET /admin-portal/auto-close-config`
5943
+ */
5944
+ async getAutoCloseConfig() {
5945
+ return this.request("GET", "/admin-portal/auto-close-config");
5946
+ }
5947
+ /**
5948
+ * Update the global payment auto-close policy. PATCH semantics — omitted
5949
+ * fields are left unchanged.
5950
+ *
5951
+ * `PUT /admin-portal/auto-close-config`
5952
+ */
5953
+ async updateAutoCloseConfig(params) {
5954
+ return this.request("PUT", "/admin-portal/auto-close-config", { body: params });
5955
+ }
5956
+ /**
5957
+ * One merchant's auto-close override plus the effective values.
5958
+ * `GET /admin-portal/accounts/{merchantId}/auto-close-config`
5959
+ */
5960
+ async getMerchantAutoCloseConfig(merchantId) {
5961
+ return this.request(
5962
+ "GET",
5963
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/auto-close-config`
5964
+ );
5965
+ }
5966
+ /**
5967
+ * Replace one merchant's auto-close override. REPLACE semantics — sending
5968
+ * both fields as `null` removes the override entirely.
5969
+ *
5970
+ * `PUT /admin-portal/accounts/{merchantId}/auto-close-config`
5971
+ */
5972
+ async updateMerchantAutoCloseConfig(merchantId, params) {
5973
+ return this.request(
5974
+ "PUT",
5975
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/auto-close-config`,
5976
+ { body: params }
5977
+ );
5978
+ }
5979
+ /**
5980
+ * The global transaction soft-delete policy (statuses admins may delete,
5981
+ * plus the deploy-time env ceiling).
5982
+ *
5983
+ * `GET /admin-portal/transaction-delete-config`
5984
+ */
5985
+ async getTransactionDeleteConfig() {
5986
+ return this.request("GET", "/admin-portal/transaction-delete-config");
5987
+ }
5988
+ /**
5989
+ * Replace the global deletable-status set. Must be a subset of the env
5990
+ * ceiling.
5991
+ *
5992
+ * `PUT /admin-portal/transaction-delete-config`
5993
+ */
5994
+ async updateTransactionDeleteConfig(params) {
5995
+ return this.request("PUT", "/admin-portal/transaction-delete-config", { body: params });
5996
+ }
5997
+ /**
5998
+ * One merchant's deletable-status override plus the effective set.
5999
+ * `GET /admin-portal/accounts/{merchantId}/transaction-delete-config`
6000
+ */
6001
+ async getMerchantTransactionDeleteConfig(merchantId) {
6002
+ return this.request(
6003
+ "GET",
6004
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/transaction-delete-config`
6005
+ );
6006
+ }
6007
+ /**
6008
+ * Replace one merchant's deletable-status override. `statuses: null`
6009
+ * removes the override; an empty list forbids deletion entirely.
6010
+ *
6011
+ * `PUT /admin-portal/accounts/{merchantId}/transaction-delete-config`
6012
+ */
6013
+ async updateMerchantTransactionDeleteConfig(merchantId, params) {
6014
+ return this.request(
6015
+ "PUT",
6016
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/transaction-delete-config`,
6017
+ { body: params }
6018
+ );
6019
+ }
6020
+ /**
6021
+ * A merchant's settlement statements. Same shapes as the merchant-facing
6022
+ * `settlement` resource, admin-authenticated.
6023
+ *
6024
+ * `GET /admin-portal/accounts/{merchantId}/settlement/statements`
6025
+ */
6026
+ async listSettlementStatements(merchantId, params) {
6027
+ return this.request(
6028
+ "GET",
6029
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/statements`,
6030
+ {
6031
+ query: {
6032
+ test_mode: params.test_mode,
6033
+ profile_id: params.profile_id,
6034
+ limit: params.limit,
6035
+ offset: params.offset
6036
+ }
6037
+ }
6038
+ );
6039
+ }
6040
+ /**
6041
+ * One settlement statement with its breakdown.
6042
+ * `GET /admin-portal/accounts/{merchantId}/settlement/statements/{statementId}`
6043
+ */
6044
+ async getSettlementStatement(merchantId, statementId) {
6045
+ return this.request(
6046
+ "GET",
6047
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/statements/${encodeURIComponent(statementId)}`
6048
+ );
6049
+ }
6050
+ /**
6051
+ * Export a settlement statement as PDF. Returns the raw bytes as a `Blob`
6052
+ * with the same auth and error handling as every other call.
6053
+ *
6054
+ * `GET /admin-portal/accounts/{merchantId}/settlement/statements/{statementId}/pdf`
6055
+ */
6056
+ async downloadSettlementStatementPdf(merchantId, statementId, params) {
6057
+ return this.request(
6058
+ "GET",
6059
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/statements/${encodeURIComponent(statementId)}/pdf`,
6060
+ {
6061
+ query: {
6062
+ currency: params?.currency,
6063
+ include_transactions: params?.include_transactions
6064
+ },
6065
+ responseType: "blob"
6066
+ }
6067
+ );
6068
+ }
6069
+ /**
6070
+ * A merchant's per-shop settlement overview.
6071
+ * `GET /admin-portal/accounts/{merchantId}/settlement/overview`
6072
+ */
6073
+ async settlementOverview(merchantId, params) {
6074
+ return this.request(
6075
+ "GET",
6076
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/overview`,
6077
+ { query: { test_mode: params.test_mode } }
6078
+ );
6079
+ }
6080
+ /**
6081
+ * A merchant's live current-period settlement rollup.
6082
+ * `GET /admin-portal/accounts/{merchantId}/settlement/current`
6083
+ */
6084
+ async settlementCurrent(merchantId, params) {
6085
+ return this.request(
6086
+ "GET",
6087
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/current`,
6088
+ { query: { test_mode: params.test_mode, profile_id: params.profile_id } }
6089
+ );
6090
+ }
6091
+ /**
6092
+ * A merchant's vault state: the attach entitlement, and the vault
6093
+ * configuration of every shop.
6094
+ *
6095
+ * `GET /admin-portal/accounts/{merchantId}/vault`
6096
+ */
6097
+ async getVaultState(merchantId) {
6098
+ return this.request("GET", `/admin-portal/accounts/${encodeURIComponent(merchantId)}/vault`);
6099
+ }
6100
+ /**
6101
+ * Attach a vault to one of a merchant's shops — creates the vault
6102
+ * connector account and points the profile at it in one request. The
6103
+ * Collect credentials are verified write-only before anything is stored.
6104
+ *
6105
+ * `POST /admin-portal/accounts/{merchantId}/vault/attach`
6106
+ */
6107
+ async attachVault(merchantId, params) {
6108
+ return this.request(
6109
+ "POST",
6110
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/vault/attach`,
6111
+ { body: params }
6112
+ );
6113
+ }
5334
6114
  /**
5335
6115
  * Fetch the global welcome promotional-credit config (amount + message)
5336
6116
  * granted to newly created billing profiles. Internal-admin route.
@@ -5718,6 +6498,7 @@ var DelopayInternal = class extends Delopay {
5718
6498
  Cache,
5719
6499
  CardIssuers,
5720
6500
  Cards,
6501
+ CheckoutSession,
5721
6502
  Configs,
5722
6503
  ConnectorRestrictionRules,
5723
6504
  ConnectorRestrictions,
@@ -5738,11 +6519,13 @@ var DelopayInternal = class extends Delopay {
5738
6519
  NATIVE_PANES_MAX,
5739
6520
  NATIVE_PANE_CATEGORY_KEYS,
5740
6521
  NATIVE_PANE_ICON_KEYS,
6522
+ OperationLimits,
5741
6523
  PlatformBilling,
5742
6524
  PlatformFees,
5743
6525
  Regions,
5744
6526
  STRIPE_NATIVE_PANE_METHODS,
5745
6527
  Search,
6528
+ Settlement,
5746
6529
  Subscriptions,
5747
6530
  Webhooks,
5748
6531
  allOf,