@profullstack/coinpay 0.6.10 → 0.8.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/CHANGELOG.md +7 -0
- package/README.md +64 -0
- package/bin/coinpay.js +1208 -59
- package/package.json +20 -3
- package/src/auth.js +8 -1
- package/src/client.d.ts +52 -0
- package/src/client.js +138 -7
- package/src/index.d.ts +34 -1
- package/src/index.js +32 -0
- package/src/invoices.d.ts +77 -0
- package/src/invoices.js +237 -0
- package/src/lightning.js +101 -39
- package/src/tokens.d.ts +14 -0
- package/src/tokens.js +34 -0
- package/src/wallet.d.ts +11 -0
- package/src/wallet.js +229 -1
- package/src/webhooks.js +37 -3
- package/src/x402-browser.js +318 -0
- package/src/x402-pay-server.js +272 -0
- package/src/x402-v2.js +416 -0
- package/src/x402.js +164 -19
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to `@profullstack/coinpay` will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.6.11] - 2026-03-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- OAuth client management methods: `listOAuthClients()`, `createOAuthClient()`, `getOAuthClient()`, `deleteOAuthClient()`
|
|
12
|
+
- CLI `coinpay oauth` commands: `list`, `create`, `get`, `delete`
|
|
13
|
+
- OAuth section in SDK documentation
|
|
14
|
+
|
|
8
15
|
## [0.2.0] - 2025-01-15
|
|
9
16
|
|
|
10
17
|
### Added
|
package/README.md
CHANGED
|
@@ -240,6 +240,30 @@ const { payment, usage } = await client.createPayment({
|
|
|
240
240
|
}
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
+
#### `client.getTokens(params?)`
|
|
244
|
+
|
|
245
|
+
List checkout-ready tokens for a business. Use this instead of hard-coding a coin list. Business wallets take priority; merchant global wallets are used as fallback.
|
|
246
|
+
|
|
247
|
+
```javascript
|
|
248
|
+
const { tokens } = await client.getTokens({
|
|
249
|
+
businessId: 'biz_123',
|
|
250
|
+
activeOnly: true,
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
for (const token of tokens) {
|
|
254
|
+
console.log(token.code); // "btc", "usdc_pol", ...
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
| Param | Type | Required | Description |
|
|
259
|
+
|-------|------|----------|-------------|
|
|
260
|
+
| `businessId` | `string` | JWT only | Optional with a business API key; if set, it must match the key scope |
|
|
261
|
+
| `activeOnly` | `boolean` | — | Return active wallets only |
|
|
262
|
+
|
|
263
|
+
#### `client.getSupportedCoins(params?)`
|
|
264
|
+
|
|
265
|
+
Returns the lower-level `/api/supported-coins` shape with `coins` instead of token-picker `code` fields.
|
|
266
|
+
|
|
243
267
|
---
|
|
244
268
|
|
|
245
269
|
#### `client.getPayment(paymentId)`
|
|
@@ -562,10 +586,50 @@ coinpay payment get pay_abc123
|
|
|
562
586
|
# List payments
|
|
563
587
|
coinpay payment list --business-id biz_123 --status pending --limit 10
|
|
564
588
|
|
|
589
|
+
# List checkout tokens
|
|
590
|
+
coinpay tokens list --business-id biz_123 --active-only
|
|
591
|
+
|
|
565
592
|
# Get QR code
|
|
566
593
|
coinpay payment qr pay_abc123
|
|
567
594
|
```
|
|
568
595
|
|
|
596
|
+
### Invoices
|
|
597
|
+
|
|
598
|
+
Invoice creation is draft-only. It does not send the invoice or move funds.
|
|
599
|
+
The create command prints the public `/now/{invoiceId}` payment link so it can be
|
|
600
|
+
copied into chat. The payment page becomes available after the invoice is sent.
|
|
601
|
+
Create's JSON output includes the same link as `shareUrl`.
|
|
602
|
+
When using a business-scoped API key, --business-id may be omitted.
|
|
603
|
+
|
|
604
|
+
```bash
|
|
605
|
+
# Create a draft invoice
|
|
606
|
+
coinpay invoice create \
|
|
607
|
+
--amount 250 \
|
|
608
|
+
--currency USD \
|
|
609
|
+
--client-id cli_001 \
|
|
610
|
+
--crypto-currency USDC \
|
|
611
|
+
--due-date 2026-09-01 \
|
|
612
|
+
--notes "August development"
|
|
613
|
+
|
|
614
|
+
# Route eventual settlement through a saved wallet or a direct address
|
|
615
|
+
coinpay invoice create --amount 250 --wallet-id wal_001
|
|
616
|
+
coinpay invoice create --amount 250 --merchant-wallet-address 0xabc123
|
|
617
|
+
|
|
618
|
+
# Get invoice details
|
|
619
|
+
coinpay invoice get inv_abc123
|
|
620
|
+
|
|
621
|
+
# List invoices. Date filters apply to created_at and --date-to includes that day.
|
|
622
|
+
coinpay invoice list \
|
|
623
|
+
--business-id biz_123 \
|
|
624
|
+
--status sent \
|
|
625
|
+
--client-id cli_001 \
|
|
626
|
+
--date-from 2026-08-01 \
|
|
627
|
+
--date-to 2026-08-31
|
|
628
|
+
|
|
629
|
+
# Use --json with any invoice command for machine-readable output
|
|
630
|
+
coinpay invoice list --status paid --json
|
|
631
|
+
```
|
|
632
|
+
|
|
569
633
|
### Businesses
|
|
570
634
|
|
|
571
635
|
```bash
|