@strabl-engineering/strabl-web-sdk 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +1 -46
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,50 +1,5 @@
1
1
  # Strabl Web SDK
2
2
 
3
- Accept cards, Apple Pay, Google Pay, Tabby and Tamara on your site with a secure payment form hosted by Strabl. Card number, expiry and CVC never touch your page, so no script on your site (including compromised third-party scripts) can read them. Your page only receives events such as "ready", "card brand is Visa" or "payment succeeded".
4
-
5
- ## How the charge is decided
6
-
7
- Your **backend** creates a session with your secret key. The browser never sets or sends an amount, so nobody can change what is charged from the page.
8
-
9
- ```bash
10
- curl -X POST "https://api.strabl.com/v1/api/direct/sessions" \
11
- -H "Authorization: sk_live_…" \
12
- -H "Content-Type: application/json" \
13
- -H "Idempotency-Key: order-1001" \
14
- -d '{
15
- "amount": 125.50,
16
- "currency": "AED",
17
- "description": "Order 1001",
18
- "redirectUrl": "https://shop.example/checkout",
19
- "metadata": { "orderId": "1001" }
20
- }'
21
- ```
22
-
23
- - Send the secret key as it is in `Authorization` (no `Bearer` prefix). Use `https://sandbox.api.strabl.com` with `sk_test_…` keys.
24
- - `Idempotency-Key` is optional: a retried call with the same key returns the same session instead of creating a second one.
25
- - `redirectUrl` must be `https://`.
26
-
27
- The response:
28
-
29
- ```json
30
- {
31
- "code": "2000",
32
- "message": "Operation completed successfully",
33
- "data": {
34
- "sessionId": "dps_…",
35
- "clientSecret": "…",
36
- "amount": 125.5,
37
- "currency": "AED",
38
- "status": "CREATED",
39
- "expiresAt": "2026-01-01T12:30:00Z"
40
- }
41
- }
42
- ```
43
-
44
- Pass `data.sessionId` and `data.clientSecret` to the page. The client secret is returned only once; never log it or put it in a URL. A session expires after 30 minutes and can be paid once. A declined card leaves it open for another card.
45
-
46
- **Always set `redirectUrl`** to your checkout page. Cards that need 3-D Secure send the payer away and back to it (with a `key=ref_…` parameter you can ignore), and without it the payment cannot be resumed.
47
-
48
3
  ## Before you start
49
4
 
50
5
  In the Strabl dashboard, add every origin that shows the payment form (for example `https://shop.example`) to the publishable key's allowed origins. The form refuses to render anywhere else.
@@ -58,7 +13,7 @@ npm install @strabl-engineering/strabl-web-sdk
58
13
  Or with a script tag, which defines `window.StrablElements`:
59
14
 
60
15
  ```html
61
- <script src="https://cdn.jsdelivr.net/npm/@strabl-engineering/strabl-web-sdk@1.0.0/dist/strabl-elements.js"></script>
16
+ <script src="https://cdn.jsdelivr.net/npm/@strabl-engineering/strabl-web-sdk@1.0.1/dist/strabl-elements.js"></script>
62
17
  ```
63
18
 
64
19
  There are two ways to use it. Both run the same UI:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strabl-engineering/strabl-web-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Strabl Web SDK: accept cards, Apple Pay, Google Pay, Tabby and Tamara in a secure Strabl-hosted payment form. Card details never touch your page.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",