@0to1pay/fulfillment-sdk 3.1.2 → 3.1.4

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.
Files changed (2) hide show
  1. package/README.md +30 -7
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,21 +2,38 @@
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
- **Before installing** you need Node.js 22.20+, PostgreSQL, public HTTPS for the signed webhook, a running merchant worker and a test wallet with Base Sepolia ETH for gas and 0.01 test USDC. [Live Next.js demo](https://0to1pay.com/demo/base-usdc) · [Guide, recovery steps and setup measurements](https://0to1pay.com/guides/nextjs-base-usdc)
5
+ ## Next.js quickstart
6
6
 
7
- A single OrbStack run with Node 22.23.5 and PostgreSQL 17 measured 6.534 s for cold-cache package installation and 10.810 s from setup to a production HTTP response with the database, keys and HTTPS ready. One public Base Sepolia purchase took 2.028 s from recognized confirmation to grant. A signed webhook replay left one active pass. First-merchant self-install time is unmeasured. [Measurement conditions and demo](https://0to1pay.com/guides/nextjs-base-usdc)
7
+ The Next.js example takes a 0.01 test USDC payment on Base Sepolia and grants the buyer one access pass from a signed webhook. Follow the [Next.js quickstart](https://0to1pay.com/docs#nextjs-quickstart) or [한국어 빠른 시작](https://0to1pay.com/docs?lang=ko#nextjs-quickstart). To make a [test purchase](https://0to1pay.com/demo/base-usdc), use a Base Sepolia wallet with test USDC and test ETH for gas. If you have already sent the payment, reopen your original order.
8
8
 
9
- **Project pricing.** Sandbox includes 1,000 requests per UTC calendar month for free. For 30 prepaid days, Starter is 9 test tokens / 1,000 requests, Growth 29 / 5,000, Scale 99 / 25,000. The beta uses test USDC or USDT and costs zero real money. Every paid plan includes Ethereum Sepolia, Base Sepolia, TRON Nile, core APIs, webhooks and recovery. Pricing is independent of volume settled and successful payment count.
9
+ To run the example 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)
10
10
 
11
- Count one request for order creation and one for quote creation. With no other metered calls, 500 fresh checkouts consume Starter’s 1,000 requests. Add any metered list or configuration reads to the estimate. Identical creation retries in the same project with the same idempotency key and content count once. Usage signals are sent at 80% and 95%. At 100% new starts stop. Existing confirmation, fulfillment and webhook redelivery remain available. Manual upgrades cost the price difference and preserve expiry and consumption. Renewals and overages are never charged automatically. [Estimate costs](https://0to1pay.com/pricing)
11
+ ```sh
12
+ curl -fsSLO https://0to1pay.com/examples/nextjs-base-usdc.zip
13
+ unzip nextjs-base-usdc.zip
14
+ cd nextjs-base-usdc
15
+ npm ci
16
+ cp .env.example .env
17
+ ```
18
+
19
+ 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.
12
20
 
13
21
  ```sh
14
- npm install @0to1pay/server-sdk @0to1pay/fulfillment-sdk pg
22
+ npm run setup
23
+ npm run dev
24
+ ```
25
+
26
+ ```sh
27
+ npm run worker
15
28
  ```
16
29
 
17
- **Run the complete integration.** The [Next.js Base USDC guide](https://0to1pay.com/guides/nextjs-base-usdc) includes a Base Sepolia checkout, raw-body webhook handler, PostgreSQL worker and protected members' route. The same signed delivery can be retried without issuing another pass. [Try the hosted demo](https://0to1pay.com/demo/base-usdc) · [Download the example](https://0to1pay.com/examples/nextjs-base-usdc.zip).
30
+ 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. [Setup and purchase recovery](https://0to1pay.com/guides/nextjs-base-usdc) · [Machine-readable guide](https://0to1pay.com/guides/nextjs-base-usdc.md)
18
31
 
19
- Create a [beta merchant project](https://pay.0to1pay.com/merchant) and issue a scoped test key. Point the server SDK at `https://api.0to1pay.com`. The beta uses test tokens on Base Sepolia, Ethereum Sepolia and TRON Nile. [API reference](https://0to1pay.com/docs) · [OpenAPI JSON](https://api.0to1pay.com/openapi.json) · [Markdown quickstart](https://0to1pay.com/guides/nextjs-base-usdc.md).
32
+ ## Add signed fulfillment to an existing app
33
+
34
+ ```sh
35
+ npm install @0to1pay/server-sdk @0to1pay/fulfillment-sdk pg
36
+ ```
20
37
 
21
38
  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
39
  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 +43,10 @@ Apply each command at most once and keep entitlements for distinct orders indepe
26
43
 
27
44
  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
45
 
46
+ ## Plans and usage
47
+
48
+ 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.
49
+
50
+ 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)
51
+
29
52
  The SDK is available under the MIT license. See the `LICENSE` file included in the package.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0to1pay/fulfillment-sdk",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "0to1Pay signed webhook receiver and PostgreSQL fulfillment worker",