@0to1pay/server-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.
Files changed (2) hide show
  1. package/README.md +39 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,33 +2,63 @@
2
2
 
3
3
  Accept USDC or USDT directly in a merchant wallet and verify onchain payment before granting access. The hosted beta serves **Base Sepolia USDC, Ethereum Sepolia USDC and TRON Nile USDT**. Install on your Node.js server (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
+ Start with the [integration quickstart](https://0to1pay.com/docs#nextjs-quickstart) or [빠른 시작](https://0to1pay.com/docs?lang=ko#nextjs-quickstart).
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
+ - **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
- 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)
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
- npm install @0to1pay/server-sdk
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
15
20
  ```
16
21
 
17
- **Build a working checkout.** The [Next.js Base USDC guide](https://0to1pay.com/guides/nextjs-base-usdc) walks through a 0.01 test USDC order, wallet authorization, transfer proof, signed webhook and PostgreSQL access pass. [Open the hosted demo](https://0to1pay.com/demo/base-usdc) · [Download the complete runnable example](https://0to1pay.com/examples/nextjs-base-usdc.zip).
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.
18
23
 
19
- [Sign in to the merchant dashboard](https://pay.0to1pay.com/merchant), create a project, and issue a test server key. Use the public API origin `https://api.0to1pay.com` and keep the key in your backend environment.
24
+ ```sh
25
+ npm run setup
26
+ npm run dev
27
+ ```
20
28
 
21
- ```ts
29
+ ```sh
30
+ npm run worker
31
+ ```
32
+
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)
34
+
35
+ ## Use the server client in an existing app
36
+
37
+ ```sh
38
+ npm install @0to1pay/server-sdk
39
+ ```
40
+
41
+ Read the assets enabled for a test project from your server. Keep the API key in the server environment.
42
+
43
+ ```js
22
44
  import { ZeroToOnePayClient } from '@0to1pay/server-sdk';
23
45
 
24
46
  const client = new ZeroToOnePayClient({
25
47
  origin: 'https://api.0to1pay.com',
26
- apiKey: process.env.ZERO_TO_ONE_PAY_API_KEY!,
48
+ apiKey: process.env.ZERO_TO_ONE_PAY_API_KEY,
27
49
  });
28
50
  const { data } = await client.call('listChainAssets', {});
29
51
  const baseUsdc = data.find(asset => asset.network_id === 'eip155:84532' && asset.symbol === 'USDC');
30
52
  ```
31
53
 
54
+ ## Beta pricing and verification
55
+
56
+ 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.
57
+
58
+ 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)
59
+
60
+ 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)
61
+
32
62
  For integration tools and coding assistants, start with the [Markdown quickstart](https://0to1pay.com/guides/nextjs-base-usdc.md), [public OpenAPI JSON](https://api.0to1pay.com/openapi.json), [API reference](https://0to1pay.com/docs), and [SDK reference](https://0to1pay.com/sdk).
33
63
 
34
64
  Use `call` for the full merchant API. Use the same idempotency key when retrying a mutation for the same logical request. The client validates requests and responses against the bundled OpenAPI contract. The hosted API also serves the contract at `/openapi.json`. Keep the scoped key on your server and route browser actions through your merchant backend.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0to1pay/server-sdk",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Server-only 0to1Pay client for direct on-chain stablecoin checkout and fulfillment",