@0to1pay/fulfillment-sdk 3.1.2 → 3.1.3
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 +35 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,21 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
Verify signed payment webhooks, commit them to a PostgreSQL inbox, and grant a digital entitlement with the matching order in a single merchant transaction. Node.js 22.20.0+.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Next.js quickstart
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Start with the [integration quickstart](https://0to1pay.com/docs#nextjs-quickstart) or [빠른 시작](https://0to1pay.com/docs?lang=ko#nextjs-quickstart).
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
- **See the result first.** Inspect the chain transaction, signed webhook and grant for a completed test payment. No wallet is required. [Completed order](https://0to1pay.com/guides/nextjs-base-usdc#completed-order)
|
|
10
|
+
- **Make a test purchase.** Connect a Base Sepolia wallet with 0.01 test USDC and test ETH for gas. If you already sent the payment, recover that order and sign its proof. [Live checkout](https://0to1pay.com/demo/base-usdc)
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
To run the same merchant on your server, prepare Node.js 22.20+, writable PostgreSQL, a public HTTPS webhook and a separate continuously running worker. Create a test project and issue a scoped server key. [Merchant dashboard](https://pay.0to1pay.com/merchant)
|
|
12
13
|
|
|
13
14
|
```sh
|
|
14
|
-
|
|
15
|
+
curl -fsSLO https://0to1pay.com/examples/nextjs-base-usdc.zip
|
|
16
|
+
unzip nextjs-base-usdc.zip
|
|
17
|
+
cd nextjs-base-usdc
|
|
18
|
+
npm ci
|
|
19
|
+
cp .env.example .env
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Set `DATABASE_URL`, `ZERO_TO_ONE_PAY_API_KEY`, `MERCHANT_ID` and `PROJECT_ID`. Use the exact browser origin for `APP_ORIGIN` (local default `http://localhost:3000`) and the public HTTPS URL forwarding the original request bytes to `POST /api/webhooks/0to1pay` for `WEBHOOK_URL`. Run the app in one terminal and the worker in another, from the same directory.
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm run setup
|
|
26
|
+
npm run dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npm run worker
|
|
15
31
|
```
|
|
16
32
|
|
|
17
|
-
|
|
33
|
+
Preserve the merchant database and private `.merchant/` directory. The example associates one entitlement with its original order and guest. A signed recovery challenge lets the original paying wallet regain access after cookie loss. [Guide, setup measurements and recovery](https://0to1pay.com/guides/nextjs-base-usdc) · [Machine-readable guide](https://0to1pay.com/guides/nextjs-base-usdc.md)
|
|
18
34
|
|
|
19
|
-
|
|
35
|
+
## Add signed fulfillment to an existing app
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm install @0to1pay/server-sdk @0to1pay/fulfillment-sdk pg
|
|
39
|
+
```
|
|
20
40
|
|
|
21
41
|
1. Register an HTTPS webhook endpoint for `fulfillment.requested`. Save the returned signing key ID and base64url secret in your backend's secret store. Configure `FulfillmentInbox` with the merchant ID, project ID and environment of the same project, and decode the signing secret with `Buffer.from(secret, 'base64url')`.
|
|
22
42
|
2. Call `migrateFulfillmentInbox(pool)` on your merchant database. Pass the original HTTP body bytes and headers to `FulfillmentInbox.receive`. Acknowledge delivery after the call resolves.
|
|
@@ -26,4 +46,12 @@ Apply each command at most once and keep entitlements for distinct orders indepe
|
|
|
26
46
|
|
|
27
47
|
For direct USDC and USDT orders, the platform emits fulfillment commands after it verifies the buyer-approved transfer or records an authorized review. Integrate the [buyer approval steps in the public server SDK guide](https://www.npmjs.com/package/@0to1pay/server-sdk#buyer-approval-for-on-chain-checkout) before offering checkout.
|
|
28
48
|
|
|
49
|
+
## Beta pricing and verification
|
|
50
|
+
|
|
51
|
+
The project can use Sandbox for free with 1,000 metered requests per UTC calendar month. Prepay for 30 days with Starter (9 test tokens / 1,000 requests), Growth (29 / 5,000), or Scale (99 / 25,000). The beta accepts test USDC or USDT at zero real cost. All paid plans include Ethereum Sepolia, Base Sepolia, TRON Nile, the core APIs, webhooks and recovery. Pricing is independent of settled volume and successful payment count.
|
|
52
|
+
|
|
53
|
+
One order creation plus one quote creation uses two requests. With no other metered calls, 500 fresh checkouts consume Starter’s 1,000 requests. Include metered list/configuration reads in your estimate. Same-project, same-key, same-content creation retries count once. At 80% and 95% the API flags usage. At 100%, new starts stop and existing verification, fulfillment and redelivery continue. A manual upgrade charges the difference and retains usage and expiry. Renewals require a manual payment. The service does not bill overages. [Estimate your 30-day cost](https://0to1pay.com/pricing)
|
|
54
|
+
|
|
55
|
+
A single controlled run on Node 22.23.5/PostgreSQL 17 measured 6.534 s for cold-cache package installation and 10.810 s from setup to ready HTTP with database, HTTPS and credentials prepared. Three public Base Sepolia purchases granted three original-buyer passes with zero duplicate grants. First-merchant self-install time remains unmeasured. [Completed-order evidence](https://0to1pay.com/guides/nextjs-base-usdc#completed-order)
|
|
56
|
+
|
|
29
57
|
The SDK is available under the MIT license. See the `LICENSE` file included in the package.
|