@arnaudjnn/billing-tools 0.70.1 → 0.70.2
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.
|
@@ -37,14 +37,28 @@ export declare function ensurePaymentMethodConfig(opts: PaymentMethodConfigOptio
|
|
|
37
37
|
* The configuration a payment form gets when the app names none — i.e. the
|
|
38
38
|
* library's default answer to "what does this form offer".
|
|
39
39
|
*
|
|
40
|
-
*
|
|
41
|
-
* card and the wallets: a Klarna authorization is not a reusable payment method,
|
|
42
|
-
* and listing it there is an error the customer discovers after picking it.
|
|
43
|
-
* `payment` is a real charge, so it keeps every method the account has enabled
|
|
44
|
-
* (SEPA, iDEAL, Klarna, whatever the Dashboard says) and only adds the wallets
|
|
45
|
-
* and removes Link.
|
|
40
|
+
* Card and the two wallets, for BOTH kinds, and nothing else.
|
|
46
41
|
*
|
|
47
|
-
*
|
|
42
|
+
* The alternative was tried and reverted: for `payment` this used to inherit
|
|
43
|
+
* every method the account had enabled (`enable` the wallets, `disable` Link) on
|
|
44
|
+
* the reasoning that a charge should offer whatever the Dashboard offers. What
|
|
45
|
+
* that produced on a subscription checkout was a row of tabs — Carta, Klarna,
|
|
46
|
+
* Amazon Pay, Satispay — where the app had always shown one. A method reaches a
|
|
47
|
+
* customer because someone chose to sell that way; inheriting it from a
|
|
48
|
+
* Dashboard toggle is not that choice, and a tab row is a question asked of
|
|
49
|
+
* every customer forever.
|
|
50
|
+
*
|
|
51
|
+
* So the default is the narrow, explicable one. An account that deliberately
|
|
52
|
+
* sells via SEPA or iDEAL passes its own `paymentMethodConfiguration` (or an
|
|
53
|
+
* explicit `paymentMethods` list on checkout), which is the same amount of work
|
|
54
|
+
* as before and now says so out loud.
|
|
55
|
+
*
|
|
56
|
+
* Wallets stay in because they are not another way to pay: Apple Pay and Google
|
|
57
|
+
* Pay ARE the card, with the typing removed. They also cost a tap and cost the
|
|
58
|
+
* account nothing, so they should not depend on remembering a Dashboard toggle —
|
|
59
|
+
* which is why they are forced on rather than inherited.
|
|
60
|
+
*
|
|
61
|
+
* Link is out because it cannot be removed anywhere else — see
|
|
48
62
|
* `BillingConfig.paymentMethods.link`. Pass `link: true` and this returns
|
|
49
63
|
* undefined, leaving Stripe's own behaviour untouched.
|
|
50
64
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-method-config.d.ts","sourceRoot":"","sources":["../src/payment-method-config.ts"],"names":[],"mappings":"AAqBA,oFAAoF;AACpF,KAAK,SAAS,GAAG,MAAM,CAAC;AAExB,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAC/B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CAC7B;AAwBD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CA4C3F;AAMD
|
|
1
|
+
{"version":3,"file":"payment-method-config.d.ts","sourceRoot":"","sources":["../src/payment-method-config.ts"],"names":[],"mappings":"AAqBA,oFAAoF;AACpF,KAAK,SAAS,GAAG,MAAM,CAAC;AAExB,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAC/B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAC9B;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CAC7B;AAwBD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CA4C3F;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,0BAA0B,CAK9C,IAAI,EAAE,OAAO,GAAG,SAAS,EACzB,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,GAC/C,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAW7B;AAED,yEAAyE;AACzE,wBAAgB,8BAA8B,IAAI,IAAI,CAErD"}
|
|
@@ -74,14 +74,28 @@ const CARD_AND_WALLETS = ["card", "apple_pay", "google_pay"];
|
|
|
74
74
|
* The configuration a payment form gets when the app names none — i.e. the
|
|
75
75
|
* library's default answer to "what does this form offer".
|
|
76
76
|
*
|
|
77
|
-
*
|
|
78
|
-
* card and the wallets: a Klarna authorization is not a reusable payment method,
|
|
79
|
-
* and listing it there is an error the customer discovers after picking it.
|
|
80
|
-
* `payment` is a real charge, so it keeps every method the account has enabled
|
|
81
|
-
* (SEPA, iDEAL, Klarna, whatever the Dashboard says) and only adds the wallets
|
|
82
|
-
* and removes Link.
|
|
77
|
+
* Card and the two wallets, for BOTH kinds, and nothing else.
|
|
83
78
|
*
|
|
84
|
-
*
|
|
79
|
+
* The alternative was tried and reverted: for `payment` this used to inherit
|
|
80
|
+
* every method the account had enabled (`enable` the wallets, `disable` Link) on
|
|
81
|
+
* the reasoning that a charge should offer whatever the Dashboard offers. What
|
|
82
|
+
* that produced on a subscription checkout was a row of tabs — Carta, Klarna,
|
|
83
|
+
* Amazon Pay, Satispay — where the app had always shown one. A method reaches a
|
|
84
|
+
* customer because someone chose to sell that way; inheriting it from a
|
|
85
|
+
* Dashboard toggle is not that choice, and a tab row is a question asked of
|
|
86
|
+
* every customer forever.
|
|
87
|
+
*
|
|
88
|
+
* So the default is the narrow, explicable one. An account that deliberately
|
|
89
|
+
* sells via SEPA or iDEAL passes its own `paymentMethodConfiguration` (or an
|
|
90
|
+
* explicit `paymentMethods` list on checkout), which is the same amount of work
|
|
91
|
+
* as before and now says so out loud.
|
|
92
|
+
*
|
|
93
|
+
* Wallets stay in because they are not another way to pay: Apple Pay and Google
|
|
94
|
+
* Pay ARE the card, with the typing removed. They also cost a tap and cost the
|
|
95
|
+
* account nothing, so they should not depend on remembering a Dashboard toggle —
|
|
96
|
+
* which is why they are forced on rather than inherited.
|
|
97
|
+
*
|
|
98
|
+
* Link is out because it cannot be removed anywhere else — see
|
|
85
99
|
* `BillingConfig.paymentMethods.link`. Pass `link: true` and this returns
|
|
86
100
|
* undefined, leaving Stripe's own behaviour untouched.
|
|
87
101
|
*
|
|
@@ -89,17 +103,20 @@ const CARD_AND_WALLETS = ["card", "apple_pay", "google_pay"];
|
|
|
89
103
|
* configurations returns undefined and the form renders with the account
|
|
90
104
|
* default. A missing permission must not take down checkout.
|
|
91
105
|
*/
|
|
92
|
-
export async function defaultPaymentMethodConfig(
|
|
106
|
+
export async function defaultPaymentMethodConfig(
|
|
107
|
+
// Kept as a parameter although both answers are currently the same: a form
|
|
108
|
+
// that saves a method and a form that charges have different constraints (only
|
|
109
|
+
// reusable methods can be saved), so the day they diverge is a change here and
|
|
110
|
+
// nowhere else.
|
|
111
|
+
kind, config) {
|
|
93
112
|
if (config?.paymentMethods?.link)
|
|
94
113
|
return undefined;
|
|
114
|
+
void kind;
|
|
95
115
|
try {
|
|
96
|
-
return await ensurePaymentMethodConfig(
|
|
97
|
-
|
|
98
|
-
:
|
|
99
|
-
|
|
100
|
-
enable: CARD_AND_WALLETS,
|
|
101
|
-
disable: ["link"],
|
|
102
|
-
});
|
|
116
|
+
return await ensurePaymentMethodConfig({
|
|
117
|
+
name: "billing-tools: card and wallets",
|
|
118
|
+
only: CARD_AND_WALLETS,
|
|
119
|
+
});
|
|
103
120
|
}
|
|
104
121
|
catch {
|
|
105
122
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-method-config.js","sourceRoot":"","sources":["../src/payment-method-config.ts"],"names":[],"mappings":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;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B;AAC9C,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC/E,gBAAgB;AAChB,IAAyB,EACzB,MAAgD;IAEhD,IAAI,MAAM,EAAE,cAAc,EAAE,IAAI;QAAE,OAAO,SAAS,CAAC;IACnD,KAAK,IAAI,CAAC;IACV,IAAI,CAAC;QACH,OAAO,MAAM,yBAAyB,CAAC;YACrC,IAAI,EAAE,iCAAiC;YACvC,IAAI,EAAE,gBAAgB;SACvB,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,8BAA8B;IAC5C,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arnaudjnn/billing-tools",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.2",
|
|
4
4
|
"description": "The get-paid engine for Stripe + WorkOS apps, for humans and AI agents. Drop-in API-key auth, token/credit + subscription billing, auth.md agent registration, and MPP machine payments, as MCP tools, a REST API, and a CLI. Framework-agnostic, storage-pluggable.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Arnaud Jeannin",
|