openpayment
v0.1.2
Published
OpenPayment SDK and CLI for creating x402 payment links
Downloads
31
Maintainers
Readme
OpenPayment SDK + CLI
SDK and CLI for creating x402 stablecoin payment links that settle in USDC on Base.
Powered by OpenPayment and x402.
About OpenPayment
OpenPayment lets merchants, creators, developers, and AI agents accept USDC payments with shareable payment links and APIs. 0% platform fees, instant settlement to recipient wallet, and no sign-up required. Powered by x402.
Discover more about OpenPayment.
Features
- Public SDK method:
create(...) - CLI command:
openpayment create ... - Strict input validation before network calls
- Zero runtime dependencies
Install
npm i openpaymentGlobal CLI:
npm i -g openpaymentInstall SKILL:
npx skills add https://github.com/noncept/openpaymentIf you are an AI Agent, check AGENTS.md.
SDK Usage
import { create } from "openpayment";
const result = await create({
type: "SINGLE_USE",
price: "10",
payTo: "0xYourWalletAddress",
network: "eip155:8453",
description: "Example payment",
});
console.log(result.paymentId); // "ed5b8e83-607b-4853-90c6-f4f3ba821424"
console.log(result.url); // "https://openpayment.link/pay/?paymentId=ed5b8e83-607b-4853-90c6-f4f3ba821424"SDK API
create(input) returns:
{
paymentId: string;
url: string;
}CLI Usage
Default
openpayment create \
--type "SINGLE_USE" \
--price "10" \
--payTo "0xYourWalletAddress" \
--network "eip155:8453" \
--description "Example payment"Output:
Payment created successfully
paymentId: <paymentId>
url: <paymentUrl>Example:
Payment created successfully
paymentId: ed5b8e83-607b-4853-90c6-f4f3ba821424
url: https://openpayment.link/pay/?paymentId=ed5b8e83-607b-4853-90c6-f4f3ba821424Json
openpayment create \
--type "SINGLE_USE" \
--price "10" \
--payTo "0xYourWalletAddress" \
--network "eip155:8453" \
--description "Example payment" \
--jsonOutput:
{
"paymentId": "<paymentId>",
"url": "<paymentUrl>"
}Example:
{
"paymentId": "ed5b8e83-607b-4853-90c6-f4f3ba821424",
"url": "https://openpayment.link/pay/?paymentId=ed5b8e83-607b-4853-90c6-f4f3ba821424"
}Validation Rules
type:SINGLE_USE(one-time)MULTI_USE(reusable fixed amount)VARIABLE(reusable custom amount)PROXY(reusable fixed amount + upstream API proxy call after settlement)
price: positive decimal string/number (example:10,0.01)payTo: EVM address (0x+ 40 hex chars)network:eip155:8453oreip155:84532description: optional string, max 500 charsresourceUrl: required only forPROXY(https://...)
Links:
License
OpenPayment is released under the MIT License.
