@aifinpay/skill 2.2.0 → 2.4.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 CHANGED
@@ -1,3 +1,19 @@
1
+ ## 2.4.0 — 2026-09-24
2
+
3
+ - Merchant skill: Python servers use `pip install aifinpay-gate` (ASGI for
4
+ FastAPI/Starlette, WSGI for Flask/Django) instead of hand-written checks.
5
+ - Payer skill: Python `aifinpay-agent` 2.2.1 (default gas cap that lets USDC
6
+ purchases through at current Polygon fees).
7
+
8
+ ## 2.3.0 — 2026-09-24
9
+
10
+ - Payer skill: Python `aifinpay-agent` 2.2.0 pays — `agent.fetch_paid(...)` in
11
+ POL or USDC, `agent.recover_paid(journal_path)` after an unconfirmed payment.
12
+ Current versions: MCP 2.3.0, Node 2.2.0, Python 2.2.0.
13
+ - Merchant skill: AiFinPay is not an x402 facilitator (run the gate next to an
14
+ existing x402 middleware, route by `AIFP-Receipt`); what a Python gate must
15
+ check; API registration with one `pay_to.evm`, claim, and moving the payout.
16
+
1
17
  ## 2.2.0 — 2026-09-24
2
18
 
3
19
  - Payer skill: agents can pay in USDC. MCP 2.3.0 `payable_fetch` pays in USDC
@@ -5,7 +5,7 @@ description: Pay for x402-gated APIs and sites as an agent (AIFP-1 on Polygon,
5
5
  and read wallet, payment history, prepaid quotas and Agent Passport records
6
6
  through the AiFinPay MCP server or SDK.
7
7
  license: MIT
8
- version: 2.2.0
8
+ version: 2.4.0
9
9
  author: AiFinPay Support
10
10
  metadata:
11
11
  hermes:
@@ -41,7 +41,7 @@ metadata:
41
41
  wallet, within limits its owner sets, and gets a receipt that unlocks a batch of
42
42
  requests. Settlement is non-custodial: the agent's private key signs locally and
43
43
  no AiFinPay-controlled custodian touches funds. MCP `payable_fetch` (2.2.0+) and
44
- Node `fetchPaid` (2.1.0+) execute payments; the Python SDK does not yet.
44
+ Node `fetchPaid` (2.1.0+) and Python `fetch_paid` (2.2.0+) execute payments.
45
45
 
46
46
  ## Prerequisites — required packages
47
47
 
@@ -60,7 +60,7 @@ your language. There is no "install together" scenario.
60
60
 
61
61
  ## Version and release status
62
62
 
63
- Released and current: MCP **2.3.0**, Node SDK **2.2.0**, Python **2.1.1**.
63
+ Released and current: MCP **2.3.0**, Node SDK **2.2.0**, Python **2.2.1**.
64
64
  Payments are released — `payable_fetch` has shipped since MCP 2.2.0. An older
65
65
  copy of this skill that calls MCP "read-only" or payments "release pending" is
66
66
  out of date; follow this one. Install the `latest` release.
@@ -69,7 +69,7 @@ out of date; follow this one. Install the `latest` release.
69
69
  |---|---|
70
70
  | MCP `@aifinpay/mcp` 2.3.x | Yes — `payable_fetch`, once the owner enables payments; POL, or USDC with `AIFINPAY_PAY_ASSET=USDC` |
71
71
  | Node `@aifinpay/agent` 2.2.x | Yes — `fetchPaid` with a v14 journal and gas cap; POL (with your own POL/USD rate) or USDC (`v14.asset: "USDC"`) |
72
- | Python `aifinpay-agent` | No — use MCP or Node to pay |
72
+ | Python `aifinpay-agent` 2.2.x | Yes — `agent.fetch_paid(url, allowed_origins=…, max_amount_usd=…, daily_amount_usd=…)`; POL (priced independently) or USDC (`asset="USDC"`); recover an unconfirmed payment with `agent.recover_paid(journal_path)` |
73
73
 
74
74
  # AiFinPay agent workflow
75
75
 
@@ -5,7 +5,7 @@ description: Turn any website or API into one that charges AI agents to access
5
5
  in stablecoins or native tokens on Polygon and Solana. Non-custodial — you
6
6
  keep 99%.
7
7
  license: MIT
8
- version: 2.2.0
8
+ version: 2.4.0
9
9
  author: AiFinPay Support
10
10
  metadata:
11
11
  hermes:
@@ -76,6 +76,35 @@ That is it. `aifpGate` returns a 402 with everything an agent needs to pay
76
76
  (`how_to_pay`, price, scope). `aifpDiscovery` serves `/.well-known/x402.json` so
77
77
  an agent that arrives at just your domain learns which routes cost money.
78
78
 
79
+ **Already running x402 (PayAI, Coinbase)?** AiFinPay is not an x402
80
+ facilitator — there is no `/verify` or `/settle` to point your middleware at,
81
+ and swapping a facilitator URL does nothing. Mount the gate next to it and
82
+ route by header: a request carrying `AIFP-Receipt` goes to AiFinPay.
83
+
84
+ ### Python (FastAPI, Starlette, Flask, Django)
85
+
86
+ ```bash
87
+ pip install aifinpay-gate
88
+ ```
89
+
90
+ ```python
91
+ from aifinpay_gate import AifpGateMiddleware, Gate, Route
92
+
93
+ gate = Gate("mrch_…", routes=[
94
+ Route("/api/agent/data", "standard"),
95
+ Route("/create", "premium", methods={"POST"}),
96
+ ])
97
+ app.add_middleware(AifpGateMiddleware, gate=gate) # FastAPI / Starlette
98
+ # Flask / Django: app.wsgi_app = AifpGateWSGI(app.wsgi_app, gate)
99
+ ```
100
+
101
+ Same 402, same receipt checks, same metering as `@aifinpay/gate`; it also
102
+ serves `/.well-known/x402.json`. A paid call reaches the handler with
103
+ `request.state.aifp` (ASGI) or `environ["aifp"]` (WSGI). Route patterns are
104
+ exact or end in `/*`. With more than one worker process, pass
105
+ `store=RedisStore(redis.Redis.from_url(...))` — the default counters are
106
+ per process.
107
+
79
108
  ### Next.js
80
109
 
81
110
  `aifpGate` is Express middleware and does not run in `middleware.ts`. Use
@@ -150,6 +179,13 @@ The gate needs a `merchant_id`. Two ways to get one:
150
179
  Do not guess a `merchant_id` or invent a payout address. The owner sets the
151
180
  payout wallet; that is the address money is sent to, and only they can choose
152
181
  it.
182
+ 3. **API (scripts):** `POST https://api.aifinpay.io/v1/merchants` with
183
+ `{"name", "pay_to": {"evm": "0x…"}, "settlement_version": "1.4"}` returns the
184
+ id and a `merchant_secret` shown once. Claim the merchant in the dashboard
185
+ with that secret, or it belongs to no account. Send ONE `pay_to.evm` — it
186
+ receives on every EVM chain; per-chain keys such as `base` are refused. To
187
+ move the payout later, `PATCH /v1/merchants/{id}` with header
188
+ `AIFP-Merchant-Secret` and `{"pay_to": {"evm": "0x…"}}`.
153
189
 
154
190
  ## What the owner must decide
155
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aifinpay/skill",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "AiFinPay agent skills: pay for x402-gated APIs as an agent (aifinpay) and charge agents for your API as a merchant (aifinpay-merchant).",
5
5
  "type": "module",
6
6
  "files": [