@delopay/sdk 0.77.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.
package/dist/internal.cjs CHANGED
@@ -1165,10 +1165,45 @@ var PaymentMethods = class {
1165
1165
  return this.request("DELETE", `/payment-methods/${encodeURIComponent(methodId)}`);
1166
1166
  }
1167
1167
  /**
1168
- * List payment methods using a client secret.
1168
+ * List the payment methods available for a payment — the discovery endpoint a
1169
+ * custom checkout renders its tiles from.
1169
1170
  *
1170
- * @param params - Filter by `client_secret`.
1171
- * @returns Array of payment methods.
1171
+ * Callable with a publishable key plus the payment's `client_secret`, so it
1172
+ * runs from the browser. The returned set is already filtered by country,
1173
+ * order value and the merchant's availability rules, and each entry carries
1174
+ * `display` (name + icon slug) and `amount_limits` (the order values it stays
1175
+ * available for) so you do not have to maintain either alongside.
1176
+ *
1177
+ * This is *not* the customer's saved methods — see {@link listForCustomer}.
1178
+ *
1179
+ * @param params - `client_secret`, plus optional `country`, `amount` and filters.
1180
+ * @returns The methods available for the payment, grouped by payment method.
1181
+ *
1182
+ * @example
1183
+ * ```typescript
1184
+ * const { payment_methods } = await delopay.paymentMethods.list({
1185
+ * client_secret: 'pay_abc_secret_xyz',
1186
+ * country: 'DE',
1187
+ * amount: 25000,
1188
+ * });
1189
+ *
1190
+ * for (const group of payment_methods) {
1191
+ * for (const method of group.payment_method_types) {
1192
+ * // Re-check availability yourself as the cart total changes, instead of
1193
+ * // re-listing on every keystroke.
1194
+ * const limits = method.amount_limits;
1195
+ * const available =
1196
+ * !limits ||
1197
+ * ((limits.min_amount == null || cartTotal >= limits.min_amount) &&
1198
+ * (limits.max_amount == null || cartTotal <= limits.max_amount) &&
1199
+ * !limits.excluded_ranges.some(
1200
+ * (band) => cartTotal >= band.min_amount && cartTotal <= band.max_amount,
1201
+ * ));
1202
+ *
1203
+ * if (available) render(method.display?.display_name, method.display?.icon_slug);
1204
+ * }
1205
+ * }
1206
+ * ```
1172
1207
  */
1173
1208
  async list(params) {
1174
1209
  return this.request("GET", "/payment-methods", {