@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/{chunk-RODMYISN.js → chunk-MX26LF5P.js} +39 -4
- package/dist/chunk-MX26LF5P.js.map +1 -0
- package/dist/index.cjs +38 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +241 -5
- package/dist/index.d.ts +241 -5
- package/dist/index.js +1 -1
- package/dist/internal.cjs +38 -3
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-RODMYISN.js.map +0 -1
|
@@ -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
|
|
1056
|
+
* List the payment methods available for a payment — the discovery endpoint a
|
|
1057
|
+
* custom checkout renders its tiles from.
|
|
1057
1058
|
*
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
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", {
|
|
@@ -4760,4 +4795,4 @@ export {
|
|
|
4760
4795
|
applyBrandingVariables,
|
|
4761
4796
|
shadowFor
|
|
4762
4797
|
};
|
|
4763
|
-
//# sourceMappingURL=chunk-
|
|
4798
|
+
//# sourceMappingURL=chunk-MX26LF5P.js.map
|