@0to1pay/server-sdk 3.1.0 → 3.1.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 +10 -9
- package/package.json +14 -2
package/README.md
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 0to1pay Server SDK
|
|
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
5
|
```sh
|
|
6
|
-
npm install @0to1pay/server-sdk
|
|
6
|
+
npm install @0to1pay/server-sdk
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
npm install ./0to1pay-server-sdk-3.1.0.tgz
|
|
11
|
-
```
|
|
9
|
+
**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).
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
[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.
|
|
14
12
|
|
|
15
13
|
```ts
|
|
16
14
|
import { ZeroToOnePayClient } from '@0to1pay/server-sdk';
|
|
17
15
|
|
|
18
16
|
const client = new ZeroToOnePayClient({
|
|
19
|
-
origin:
|
|
17
|
+
origin: 'https://api.0to1pay.com',
|
|
20
18
|
apiKey: process.env.ZERO_TO_ONE_PAY_API_KEY!,
|
|
21
19
|
});
|
|
22
|
-
const { data } = await client.call('
|
|
20
|
+
const { data } = await client.call('listChainAssets', {});
|
|
21
|
+
const baseUsdc = data.find(asset => asset.network_id === 'eip155:84532' && asset.symbol === 'USDC');
|
|
23
22
|
```
|
|
24
23
|
|
|
24
|
+
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).
|
|
25
|
+
|
|
25
26
|
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.
|
|
26
27
|
|
|
27
28
|
## Create a stablecoin checkout
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0to1pay/server-sdk",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Server-only 0to1Pay client for direct on-chain stablecoin checkout and fulfillment",
|
|
@@ -30,5 +30,17 @@
|
|
|
30
30
|
"ajv": "8.20.0",
|
|
31
31
|
"ajv-formats": "3.0.1",
|
|
32
32
|
"yaml": "2.9.1"
|
|
33
|
-
}
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://0to1pay.com/sdk",
|
|
35
|
+
"keywords": [
|
|
36
|
+
"stablecoin-payments",
|
|
37
|
+
"usdc",
|
|
38
|
+
"usdt",
|
|
39
|
+
"base",
|
|
40
|
+
"ethereum",
|
|
41
|
+
"tron",
|
|
42
|
+
"nextjs",
|
|
43
|
+
"webhooks",
|
|
44
|
+
"checkout"
|
|
45
|
+
]
|
|
34
46
|
}
|