@0to1pay/fulfillment-sdk 0.0.0-stage → 1.0.0
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/LICENSE +21 -0
- package/README.md +20 -2
- package/dist/contracts/openapi.yaml +3862 -0
- package/dist/packages/domain/contract.d.ts +27 -0
- package/dist/packages/domain/contract.js +19 -0
- package/dist/packages/domain/shared.js +45 -0
- package/dist/packages/fulfillment-sdk/inbox.sql +59 -0
- package/dist/packages/fulfillment-sdk/index.d.ts +4 -0
- package/dist/packages/fulfillment-sdk/index.js +2 -0
- package/dist/packages/fulfillment-sdk/postgres.d.ts +69 -0
- package/dist/packages/fulfillment-sdk/postgres.js +247 -0
- package/dist/packages/fulfillment-sdk/signature.d.ts +37 -0
- package/dist/packages/fulfillment-sdk/signature.js +150 -0
- package/dist/packages/server-sdk/index.d.ts +184 -0
- package/dist/packages/server-sdk/recipient-proof.d.ts +10 -0
- package/dist/packages/server-sdk/schema.d.ts +2712 -0
- package/dist/packages/server-sdk/solana-recipient-proof.d.ts +3 -0
- package/dist/packages/server-sdk/tron-recipient-proof.d.ts +3 -0
- package/package.json +37 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 apfl99
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 0to1Pay Fulfillment SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node.js 22.20.0 or newer and a merchant PostgreSQL database. Install the verified tarballs in your merchant backend.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install ./0to1pay-server-sdk-1.0.0.tgz ./0to1pay-fulfillment-sdk-1.0.0.tgz
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Once the packages are published to npm, use their scoped names.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @0to1pay/server-sdk@1.0.0 @0to1pay/fulfillment-sdk@1.0.0
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
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')`.
|
|
16
|
+
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.
|
|
17
|
+
3. Configure `FulfillmentWorker` with your scoped server SDK client and an `apply` callback for your product. Run `worker.tick()` regularly in your backend worker. Apply the product update and record its effect in the supplied PostgreSQL transaction. The SDK commits the execution record and result outbox with the effect.
|
|
18
|
+
|
|
19
|
+
Apply each command at most once and keep entitlements for distinct orders independent. Return `unknown` when an external product update has an uncertain outcome, then reconcile that update before repeating it.
|
|
20
|
+
|
|
21
|
+
The SDK is available under the MIT license. See the `LICENSE` file included in the package.
|