Skip to content

AliBaig-xD/monkepay-sdk-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MonkePay SDK — Examples

Minimal working examples for each supported framework.

Includes a separate agent (client) example that shows how an x402-enabled client pays and calls your gated endpoints. It is not a server adapter.

Setup

Each example reads credentials from a .env file. Copy the template and fill in your keys:

cp .env.example .env
MONKEPAY_KEY_ID=mk_...
MONKEPAY_KEY_SECRET=sk_...

Run an example

# From the examples/ root
npm install

# Hono — http://localhost:3000
npm run hono

# Express — http://localhost:3000
npm run express

# Fastify — http://localhost:3000
npm run fastify

# Next.js — http://localhost:3000
npm run next

# Agent (client) — pays and calls the API
npm run agent

Test a gated endpoint

With no payment (expect 402):

curl http://localhost:3000/api/data

The 402 response includes the accepts array describing exactly what payment is required — this is what an x402-compatible agent reads to construct and submit payment automatically.


Examples

Example Framework Port Entry
hono/ Hono 3000 app.ts
express/ Express 3001 app.ts
fastify/ Fastify 3002 app.ts
next-app/ Next.js App Router 3003 app/api/data/route.ts
agent/ Client (x402 agent) src/index.ts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors