@coinomad/checkout 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.
Files changed (2) hide show
  1. package/README.md +16 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -32,7 +32,19 @@ const checkout = await coinomad.checkouts.create({
32
32
  console.log(checkout.checkout_url);
33
33
  ```
34
34
 
35
- The `apiKey` is the widget's key from your Coinomad dashboard (Payments → Widget → Manage → API keys). `test_mode` checkouts are created automatically with a `ck_test_` key and never require real funds.
35
+ The `apiKey` is the widget's key from your Coinomad dashboard (Stablecoin Collections → Widget → Manage → API keys). `test_mode` checkouts are created automatically with a `ck_test_` key and never require real funds.
36
+
37
+ ## Simulate a payment (test mode)
38
+
39
+ With a `ck_test_` key, drive a checkout to completion without moving real funds:
40
+
41
+ ```ts
42
+ const result = await coinomad.checkouts.simulate(checkout.id);
43
+ // result.checkout.status === 'paid'
44
+ // result.webhook — { delivered: true, url } — the signed callback that fired
45
+ ```
46
+
47
+ `simulate` only works on test-mode checkouts — a live-key checkout rejects it.
36
48
 
37
49
  ## Verify a webhook
38
50
 
@@ -46,16 +58,17 @@ app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
46
58
  if (!ok) return res.status(401).end();
47
59
 
48
60
  const event = JSON.parse(req.body);
49
- // event.type === 'checkout.payment.confirmed' — process the payment
61
+ // event.event === 'checkout.payment.confirmed' — process the payment
50
62
  });
51
63
  ```
52
64
 
53
- The `webhook signing secret` is the `whsec_…` value from the widget's dashboard (Payments → Widget → Manage → Integration).
65
+ The `webhook signing secret` is the `whsec_…` value from the widget's dashboard (Stablecoin Collections → Widget → Manage → Integration).
54
66
 
55
67
  ## API
56
68
 
57
69
  - `new CoinomadCheckout({ apiKey, baseUrl? })`
58
70
  - `coinomad.checkouts.create(params)` → `{ id, reference_code, checkout_url, test_mode, … }`
71
+ - `coinomad.checkouts.simulate(id)` → `{ checkout, webhook }` (test mode only)
59
72
  - `verifyWebhook(rawBody, signature, secret)` → `boolean`
60
73
 
61
74
  ## Errors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinomad/checkout",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Server-side SDK for Coinomad's programmatic stablecoin checkout API.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",