@tuppence/js 0.1.0 → 0.1.1
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/README.md +9 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @tuppence/js
|
|
2
2
|
|
|
3
|
-
Take a card in the browser for a [Tuppence](https://tuppence.ai) payment
|
|
3
|
+
Take a card in the browser for a [Tuppence](https://tuppence.ai) payment, through Stripe's own
|
|
4
4
|
card fields, never ours. Card details go from the payer's device to Stripe, and never through
|
|
5
5
|
Tuppence, this package, or your code.
|
|
6
6
|
|
|
@@ -35,7 +35,7 @@ form.addEventListener("submit", async (event) => {
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
`confirm` presents the card (Stripe's fields make a confirmation token), lets the payer's bank
|
|
38
|
-
check it's them if it asks
|
|
38
|
+
check it's them if it asks (in Stripe's own frame), and reads the payment back until it settles.
|
|
39
39
|
If an answer is lost on the way, it reads back what happened: a card is never presented twice.
|
|
40
40
|
A read the server briefly can't answer (a 503, no answer) is sent again, twice at most; a confirm
|
|
41
41
|
never is.
|
|
@@ -53,7 +53,7 @@ the charge, and `tuppence.confirmPayment({ clientSecret, elements })` pays with
|
|
|
53
53
|
## Bacs Direct Debit
|
|
54
54
|
|
|
55
55
|
Where the business takes Direct Debit, Stripe's Payment Element offers *Bacs Direct Debit* beside
|
|
56
|
-
cards, and shows the mandate and the Direct Debit Guarantee itself
|
|
56
|
+
cards, and shows the mandate and the Direct Debit Guarantee itself. Don't hide or clip it. A
|
|
57
57
|
debit takes a few working days, so `confirm` answers at once with the payment `processing`:
|
|
58
58
|
|
|
59
59
|
```js
|
|
@@ -66,7 +66,7 @@ if (payment.status === "processing" && payment.payment_method_type === "bacs_deb
|
|
|
66
66
|
|
|
67
67
|
Nothing waits for `succeeded`: that (or `failed`) arrives days later, by webhook
|
|
68
68
|
(`payment.succeeded`, `payment.failed`). Stripe emails the payer to confirm the mandate.
|
|
69
|
-
Where a debit can't be used
|
|
69
|
+
Where a debit can't be used (a booking's deposit, a till, a credit top-up), the payment's
|
|
70
70
|
`excluded_payment_method_types` says so, and the sheet leaves Bacs out.
|
|
71
71
|
|
|
72
72
|
## Apple Pay, Google Pay and Link on a store
|
|
@@ -133,7 +133,7 @@ const result = await sheet.confirm();
|
|
|
133
133
|
|
|
134
134
|
An environment with no Stripe sandbox behind it runs Tuppence's simulated gateway: there are no
|
|
135
135
|
card fields (`elements()` answers `null`, and a sheet's `error` event says so), and you name one
|
|
136
|
-
of Stripe's test cards instead
|
|
136
|
+
of Stripe's test cards instead:
|
|
137
137
|
`confirmPayment({ clientSecret, testPaymentMethod: "pm_card_gb" })`. `tuppence.config.stripe`
|
|
138
138
|
says which gateway you are on.
|
|
139
139
|
|
|
@@ -148,7 +148,7 @@ const tuppence = await loadTuppence("pk_test_…", { apiBase: "https://…" });
|
|
|
148
148
|
|
|
149
149
|
## Your page's Content-Security-Policy
|
|
150
150
|
|
|
151
|
-
Stripe.js is loaded from `js.stripe.com
|
|
151
|
+
Stripe.js is loaded from `js.stripe.com`, never bundled, when card fields are first asked for.
|
|
152
152
|
Allow what Stripe's integration security guide lists, and Tuppence's API, beside your page's own
|
|
153
153
|
sources (`script-src 'self'`, and so on):
|
|
154
154
|
|
|
@@ -167,8 +167,8 @@ The publishable key and client secrets travel in headers, never in a URL, and no
|
|
|
167
167
|
|
|
168
168
|
### No integrity hash on Stripe.js
|
|
169
169
|
|
|
170
|
-
Stripe serves Stripe.js from `js.stripe.com` and changes it in place
|
|
171
|
-
signals Radar relies on
|
|
170
|
+
Stripe serves Stripe.js from `js.stripe.com` and changes it in place (fixes, and the fraud
|
|
171
|
+
signals Radar relies on), so it cannot carry a Subresource Integrity (SRI) hash: Stripe does not
|
|
172
172
|
support one, and does not allow Stripe.js to be bundled or hosted anywhere else. The SDK loads it
|
|
173
173
|
through Stripe's own loader (`@stripe/stripe-js`), with no `integrity` attribute. What keeps the
|
|
174
174
|
page's scripts in check is the policy above: scripts only from your origin and Stripe's.
|
|
@@ -177,7 +177,7 @@ page's scripts in check is the policy above: scripts only from your origin and S
|
|
|
177
177
|
|
|
178
178
|
### What this package never does
|
|
179
179
|
|
|
180
|
-
It never renders a card field of its own
|
|
180
|
+
It never renders a card field of its own (Stripe's iframes take the card) and never carries
|
|
181
181
|
Stripe.js. Its build fails if either creeps in: the bundle and every published file are checked
|
|
182
182
|
for an `<input>`, for the names card fields go by (`cardnumber`, `cc-number`, `cvc`…), and for
|
|
183
183
|
Stripe.js's own code.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuppence/js",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Take a card in the browser for a Tuppence payment
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Take a card in the browser for a Tuppence payment, through Stripe's own fields, never ours.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.tuppence.ai",
|
|
7
7
|
"repository": {
|