@delopay/sdk 0.163.0 → 0.164.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.
@@ -1763,6 +1763,16 @@ var Payments = class {
1763
1763
  * Not the hosted-shop settlement API under `settlement.*`, which is host →
1764
1764
  * shop owner and manual; this is acquirer → merchant bank, per payment.
1765
1765
  *
1766
+ * Each attempt also carries what the rail itself took for it —
1767
+ * `processor_cost_amount` with its own `processor_cost_currency` and
1768
+ * `processor_cost_exponent`, the `processor_cost_source` that says how the
1769
+ * figure was obtained, the `processor_cost_basis` behind an estimate, and
1770
+ * the `connector_method_code` it was priced under. Recorded for **every**
1771
+ * merchant, not only those that host shops. Never present an `estimated`
1772
+ * cost as an observation, and read an absent `processor_cost_source` as
1773
+ * "nothing was ever written", which is not the `unavailable` the rail
1774
+ * answers with.
1775
+ *
1766
1776
  * `GET /payments/{paymentId}/settlement`
1767
1777
  *
1768
1778
  * @param paymentId - The payment intent ID.
@@ -1781,6 +1791,9 @@ var Payments = class {
1781
1791
  * if (attempt.status === 'paid_out') {
1782
1792
  * console.log(attempt.paid_out_at, attempt.payout_reference);
1783
1793
  * }
1794
+ * if (attempt.processor_cost_source === 'estimated') {
1795
+ * // Label it an estimate — it was derived from a cost schedule.
1796
+ * }
1784
1797
  * }
1785
1798
  * ```
1786
1799
  */
@@ -5016,6 +5029,65 @@ var Settlement = class {
5016
5029
  ...options
5017
5030
  });
5018
5031
  }
5032
+ /**
5033
+ * What a period's payments cost at the rails, grouped by shop, connector
5034
+ * and payment method. Answers for **every** merchant, including one that
5035
+ * hosts nobody — it reads the per-attempt settlement record rather than the
5036
+ * settlement lines, which exist only where hosting fees are configured.
5037
+ *
5038
+ * A sibling of {@link Settlement.cost} rather than a widening of it. That
5039
+ * endpoint is a profit statement whose revenue term is hosting income, and
5040
+ * a merchant who hosts nobody has none. This publishes cost and never
5041
+ * margin.
5042
+ *
5043
+ * Send `year` and `month` together to report one UTC calendar month, or
5044
+ * neither for the running month so far.
5045
+ *
5046
+ * **The response carries no period total, and a caller must not compute
5047
+ * one here.** Every figure keeps the unit the rail reported it in, and the
5048
+ * unit is part of each bucket's key, so adding two buckets is not addition.
5049
+ * Convert caller-side if you need one number, and say which rates you used.
5050
+ * The counts are totalled, because a count has no unit.
5051
+ *
5052
+ * Two distinctions not to flatten when rendering a bucket:
5053
+ * `cost_amount` covers `reported_count + estimated_count` attempts out of
5054
+ * `attempt_count` and is a lower bound whenever those disagree; and
5055
+ * `unavailable_count` (the rail says it has no figure) means something
5056
+ * different from `unwritten_count` (a gap in our own recording).
5057
+ *
5058
+ * **Merchant scope.** A token scoped to a single shop, a role narrowed to
5059
+ * specific connector accounts, or a role without the settlement-read
5060
+ * permission group is refused `403`: what a rail charged is the merchant's
5061
+ * own cost base, and here it is the whole response, so there is nothing
5062
+ * coherent to redact down to. Gate the surface on the caller's scope rather
5063
+ * than calling it and handling the failure.
5064
+ *
5065
+ * `GET /settlement/processor-cost`
5066
+ *
5067
+ * @example
5068
+ * ```typescript
5069
+ * const period = await delopay.settlement.processorCost({
5070
+ * test_mode: false,
5071
+ * year: 2026,
5072
+ * month: 7,
5073
+ * });
5074
+ * for (const bucket of period.buckets) {
5075
+ * // Each bucket is its own unit — render per bucket, never a sum.
5076
+ * console.log(bucket.connector, bucket.cost_amount, bucket.cost_currency);
5077
+ * }
5078
+ * ```
5079
+ */
5080
+ async processorCost(params, options) {
5081
+ return this.request("GET", "/settlement/processor-cost", {
5082
+ query: {
5083
+ profile_id: params?.profile_id,
5084
+ test_mode: params?.test_mode,
5085
+ year: params?.year,
5086
+ month: params?.month
5087
+ },
5088
+ ...options
5089
+ });
5090
+ }
5019
5091
  /**
5020
5092
  * List generated settlement statements, newest first.
5021
5093
  *
@@ -9392,4 +9464,4 @@ export {
9392
9464
  decodeNativePanes,
9393
9465
  encodeNativePanes
9394
9466
  };
9395
- //# sourceMappingURL=chunk-Y6TADN6R.js.map
9467
+ //# sourceMappingURL=chunk-GCJDY4KX.js.map