@waffo/waffo-node 2.5.0 → 2.6.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/README.md +41 -2
- package/dist/index.d.mts +783 -615
- package/dist/index.d.ts +783 -615
- package/dist/index.js +74 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Waffo Node.js SDK
|
|
2
2
|
|
|
3
|
-
<!-- Synced with waffo-sdk/README.md @ commit
|
|
3
|
+
<!-- Synced with waffo-sdk/README.md @ commit 738f4ca -->
|
|
4
4
|
|
|
5
5
|
**English** | [中文](README_CN.md)
|
|
6
6
|
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
Official Node.js/TypeScript SDK for [Waffo Payment Platform](https://www.waffo.com), providing one-stop global payment solutions for AI products, SaaS services, and more.
|
|
12
12
|
|
|
13
|
+
## Latest Release Highlights
|
|
14
|
+
|
|
15
|
+
- **Subscription update API**: Added `subscription().update()` with `amount`, `trialPeriodAmount`, and `scheduledAmounts` support.
|
|
16
|
+
- **Scheduled amount coverage**: Added `scheduledAmounts` fields across subscription create, change, update, and inquiry product info types.
|
|
17
|
+
- **E2E and contract hardening**: Added subscription update E2E coverage, auto-injected `captureRequestedAt` for `order.capture()`, and expanded nested schema field validation.
|
|
18
|
+
|
|
13
19
|
## Introduction
|
|
14
20
|
|
|
15
21
|
### Core Features
|
|
@@ -30,6 +36,7 @@ Official Node.js/TypeScript SDK for [Waffo Payment Platform](https://www.waffo.c
|
|
|
30
36
|
|
|
31
37
|
## Table of Contents
|
|
32
38
|
|
|
39
|
+
- [Latest Release Highlights](#latest-release-highlights)
|
|
33
40
|
- [Requirements](#requirements)
|
|
34
41
|
- [Installation](#installation)
|
|
35
42
|
- [Quick Start](#quick-start)
|
|
@@ -671,6 +678,37 @@ if (response.isSuccess()) {
|
|
|
671
678
|
}
|
|
672
679
|
```
|
|
673
680
|
|
|
681
|
+
### Wallet Address Inquiry (x402)
|
|
682
|
+
|
|
683
|
+
Inquire the on-chain stablecoin receiving address for an x402 payment. The response returns the target network, the on-chain token contract, and the Waffo platform wallet address to send funds to. Phase 1 supports `USDC`.
|
|
684
|
+
|
|
685
|
+
```typescript
|
|
686
|
+
// paymentRequestId: unique idempotency key for this inquiry
|
|
687
|
+
// orderCurrency: settlement currency of the order (Phase 1 supports USDC)
|
|
688
|
+
// merchantInfo is auto-injected from config if not provided
|
|
689
|
+
const response = await waffo.wallet().inquiry({
|
|
690
|
+
paymentRequestId: 'unique-request-id',
|
|
691
|
+
orderCurrency: 'USDC',
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
if (response.isSuccess()) {
|
|
695
|
+
const data = response.getData();
|
|
696
|
+
console.log('Network:', data?.network); // CAIP-2 network id, e.g. eip155:8453 (Base mainnet)
|
|
697
|
+
console.log('Asset:', data?.asset); // on-chain token contract address
|
|
698
|
+
console.log('Pay to:', data?.payTo); // Waffo platform receiving wallet address
|
|
699
|
+
} else {
|
|
700
|
+
console.error('Wallet inquiry failed:', response.getCode(), response.getMessage());
|
|
701
|
+
}
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
#### Wallet Inquiry Response Fields
|
|
705
|
+
|
|
706
|
+
| Field | Description |
|
|
707
|
+
|-------|-------------|
|
|
708
|
+
| `network` | CAIP-2 network id (Phase 1: `eip155:8453`, Base mainnet) |
|
|
709
|
+
| `asset` | On-chain token contract address for the network + currency |
|
|
710
|
+
| `payTo` | Waffo platform receiving wallet address (send funds here) |
|
|
711
|
+
|
|
674
712
|
## Webhook Handling
|
|
675
713
|
|
|
676
714
|
Waffo pushes payment results, refund results, subscription status changes, and more via webhooks.
|
|
@@ -855,6 +893,8 @@ The following examples show the actual payload structure for each notification t
|
|
|
855
893
|
}
|
|
856
894
|
```
|
|
857
895
|
|
|
896
|
+
For x402 stablecoin payments, `PAYMENT_NOTIFICATION.result` also includes `x402Info` with `x402Request`, `paymentSignatureHeader`, and `x402Response`.
|
|
897
|
+
|
|
858
898
|
#### SUBSCRIPTION_STATUS_NOTIFICATION / SUBSCRIPTION_PERIOD_CHANGED_NOTIFICATION
|
|
859
899
|
|
|
860
900
|
These two notification types share the same payload structure:
|
|
@@ -1421,4 +1461,3 @@ npm run test:vectors
|
|
|
1421
1461
|
## License
|
|
1422
1462
|
|
|
1423
1463
|
MIT License - See [LICENSE](LICENSE) file for details.
|
|
1424
|
-
|