@delopay/sdk 0.76.0 → 0.78.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.
@@ -1053,10 +1053,45 @@ var PaymentMethods = class {
1053
1053
  return this.request("DELETE", `/payment-methods/${encodeURIComponent(methodId)}`);
1054
1054
  }
1055
1055
  /**
1056
- * List payment methods using a client secret.
1056
+ * List the payment methods available for a payment — the discovery endpoint a
1057
+ * custom checkout renders its tiles from.
1057
1058
  *
1058
- * @param params - Filter by `client_secret`.
1059
- * @returns Array of payment methods.
1059
+ * Callable with a publishable key plus the payment's `client_secret`, so it
1060
+ * runs from the browser. The returned set is already filtered by country,
1061
+ * order value and the merchant's availability rules, and each entry carries
1062
+ * `display` (name + icon slug) and `amount_limits` (the order values it stays
1063
+ * available for) so you do not have to maintain either alongside.
1064
+ *
1065
+ * This is *not* the customer's saved methods — see {@link listForCustomer}.
1066
+ *
1067
+ * @param params - `client_secret`, plus optional `country`, `amount` and filters.
1068
+ * @returns The methods available for the payment, grouped by payment method.
1069
+ *
1070
+ * @example
1071
+ * ```typescript
1072
+ * const { payment_methods } = await delopay.paymentMethods.list({
1073
+ * client_secret: 'pay_abc_secret_xyz',
1074
+ * country: 'DE',
1075
+ * amount: 25000,
1076
+ * });
1077
+ *
1078
+ * for (const group of payment_methods) {
1079
+ * for (const method of group.payment_method_types) {
1080
+ * // Re-check availability yourself as the cart total changes, instead of
1081
+ * // re-listing on every keystroke.
1082
+ * const limits = method.amount_limits;
1083
+ * const available =
1084
+ * !limits ||
1085
+ * ((limits.min_amount == null || cartTotal >= limits.min_amount) &&
1086
+ * (limits.max_amount == null || cartTotal <= limits.max_amount) &&
1087
+ * !limits.excluded_ranges.some(
1088
+ * (band) => cartTotal >= band.min_amount && cartTotal <= band.max_amount,
1089
+ * ));
1090
+ *
1091
+ * if (available) render(method.display?.display_name, method.display?.icon_slug);
1092
+ * }
1093
+ * }
1094
+ * ```
1060
1095
  */
1061
1096
  async list(params) {
1062
1097
  return this.request("GET", "/payment-methods", {
@@ -1169,6 +1204,17 @@ var Payments = class {
1169
1204
  * { headers: { 'Idempotency-Key': 'order_1001' } },
1170
1205
  * );
1171
1206
  * ```
1207
+ *
1208
+ * @example Send `test_mode` to pick the environment per payment, so a staging
1209
+ * deploy cannot charge real cards and a forgotten processor toggle cannot
1210
+ * swallow production traffic:
1211
+ * ```typescript
1212
+ * const payment = await delopay.payments.create({
1213
+ * amount: 5000,
1214
+ * currency: 'EUR',
1215
+ * test_mode: process.env.NODE_ENV !== 'production',
1216
+ * });
1217
+ * ```
1172
1218
  */
1173
1219
  async create(params, options) {
1174
1220
  return this.request("POST", "/payments", { body: params, ...options });
@@ -4749,4 +4795,4 @@ export {
4749
4795
  applyBrandingVariables,
4750
4796
  shadowFor
4751
4797
  };
4752
- //# sourceMappingURL=chunk-D7DPAKI2.js.map
4798
+ //# sourceMappingURL=chunk-MX26LF5P.js.map