Skip to content

noncept/openpayment

Repository files navigation

OpenPayment

NPM Package CI MIT licensed

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 openpayment

Global CLI:

npm i -g openpayment

SDK Usage

import { create } from "openpayment";

const result = await create({
  type: "SINGLE_USE",
  price: "10",
  payTo: "0xYourWalletAddress",
  network: "eip155:84532",
  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:84532" \
  --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-f4f3ba821424

Json

openpayment create \
  --type "SINGLE_USE" \
  --price "10" \
  --payTo "0xYourWalletAddress" \
  --network "eip155:8453" \
  --description "Example payment" \
  --json

Output:

{
  "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)
  • price: positive decimal string/number (example: 10, 0.01)
  • payTo: EVM address (0x + 40 hex chars)
  • network: eip155:8453 or eip155:84532
  • description: optional string, max 500 chars

Links:

License

OpenPayment is released under the MIT License.

About

Create a USDC payment link in under a minute. Powered by OpenPayment and x402.

Topics

Resources

License

Stars

Watchers

Forks

Contributors