@paysentry/sandbox 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.
- package/README.md +50 -0
- package/package.json +7 -4
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @paysentry/sandbox
|
|
2
|
+
|
|
3
|
+
Mock payment protocols for testing AI agent payments without real money. Simulate x402, ACP, and AP2 with configurable latency, failure rates, and edge cases.
|
|
4
|
+
|
|
5
|
+
Part of [PaySentry](https://github.com/mkmkkkkk/paysentry).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @paysentry/sandbox @paysentry/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { MockX402, MockACP, MockAP2 } from '@paysentry/sandbox';
|
|
17
|
+
|
|
18
|
+
// Simulate x402 with 10% failure rate
|
|
19
|
+
const x402 = new MockX402({
|
|
20
|
+
latencyMs: 10,
|
|
21
|
+
failureRate: 0.1,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const result = await x402.processPayment(tx);
|
|
25
|
+
console.log(result.success); // true 90% of the time
|
|
26
|
+
|
|
27
|
+
// Simulate ACP agent-to-agent
|
|
28
|
+
const acp = new MockACP({ latencyMs: 50 });
|
|
29
|
+
const negotiation = await acp.negotiate(tx);
|
|
30
|
+
|
|
31
|
+
// Simulate AP2
|
|
32
|
+
const ap2 = new MockAP2({ latencyMs: 20 });
|
|
33
|
+
const receipt = await ap2.processPayment(tx);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- **MockX402** — Simulates HTTP 402 payment flow with configurable timeouts and retries
|
|
39
|
+
- **MockACP** — Agent-to-agent negotiation simulation
|
|
40
|
+
- **MockAP2** — Next-gen protocol mock with receipts
|
|
41
|
+
- **Scenarios** — Pre-built edge cases (timeout storms, duplicate payments, network failures)
|
|
42
|
+
- **Zero cost** — Test your entire payment flow without spending a cent
|
|
43
|
+
|
|
44
|
+
## Environment Variable
|
|
45
|
+
|
|
46
|
+
Set `PAYSENTRY_MODE=sandbox` to route all payments through mocks automatically.
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paysentry/sandbox",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Mock multi-protocol payment environment for testing AI agent payments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,13 +16,16 @@
|
|
|
16
16
|
"clean": "tsc --build --clean"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@paysentry/core": "1.0.0"
|
|
19
|
+
"@paysentry/core": ">=1.0.0"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
|
-
"files": [
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
23
26
|
"repository": {
|
|
24
27
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/mkmkkkkk/paysentry",
|
|
26
29
|
"directory": "packages/sandbox"
|
|
27
30
|
}
|
|
28
31
|
}
|