{"id":47601884,"url":"https://github.com/solana-foundation/mpp-sdk","last_synced_at":"2026-04-01T18:52:32.229Z","repository":{"id":345352587,"uuid":"1185407216","full_name":"solana-foundation/mpp-sdk","owner":"solana-foundation","description":"Solana payment method for the Machine Payments Protocol.","archived":false,"fork":false,"pushed_at":"2026-03-29T05:55:56.000Z","size":1688,"stargazers_count":48,"open_issues_count":5,"forks_count":8,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-29T05:56:19.908Z","etag":null,"topics":["mpp","solana","tempo"],"latest_commit_sha":null,"homepage":"http://paymentauth.org/draft-solana-charge-00","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/solana-foundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-18T14:52:28.000Z","updated_at":"2026-03-29T05:50:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/solana-foundation/mpp-sdk","commit_stats":null,"previous_names":["solana-foundation/solana-mpp-sdk","solana-foundation/mpp-sdk","solana-foundation/mpp-ts"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/solana-foundation/mpp-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solana-foundation%2Fmpp-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solana-foundation%2Fmpp-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solana-foundation%2Fmpp-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solana-foundation%2Fmpp-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solana-foundation","download_url":"https://codeload.github.com/solana-foundation/mpp-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solana-foundation%2Fmpp-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mpp","solana","tempo"],"created_at":"2026-04-01T18:52:31.643Z","updated_at":"2026-04-01T18:52:32.224Z","avatar_url":"https://github.com/solana-foundation.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/solana-foundation/mpp-sdk/raw/main/assets/banner.png\" alt=\"MPP\" width=\"100%\" /\u003e\n\u003c/p\u003e\n\n# @solana/mpp\n\nSolana payment method for the [Machine Payments Protocol](https://mpp.dev).\n\n**MPP** is [an open protocol proposal](https://paymentauth.org) that lets any HTTP API accept payments using the `402 Payment Required` flow.\n\n\u003e [!IMPORTANT]\n\u003e This repository is under active development. The [Solana MPP spec](https://github.com/tempoxyz/mpp-specs/pull/188) is not yet finalized — APIs and wire formats are subject to change.\n\n## Install\n\n```bash\npnpm add @solana/mpp\n```\n\n## Features\n\n**Charge** (one-time payments)\n- Native SOL and SPL token transfers (USDC, PYUSD, Token-2022, etc.)\n- Two settlement modes: pull (`type=\"transaction\"`, default) and push (`type=\"signature\"`)\n- Fee sponsorship: server pays transaction fees on behalf of clients\n- Split payments: send one charge to multiple recipients in a single transaction\n- Replay protection via consumed transaction signatures\n\n**General**\n- Works with [ConnectorKit](https://www.connectorkit.dev), `@solana/kit` keypair signers, and [Solana Keychain](https://github.com/solana-foundation/solana-keychain) remote signers\n- Server pre-fetches `recentBlockhash` to save client an RPC round-trip\n- Transaction simulation before broadcast to prevent wasted fees\n- Optional `tokenProgram` hint; clients resolve the mint owner and fail closed if discovery fails\n\n## Architecture\n\n```\nmpp-sdk/\n├── typescript/                    # TypeScript SDK\n│   └── packages/mpp/src/\n│       ├── Methods.ts             # Shared charge + session schemas\n│       ├── constants.ts           # Token programs, USDC mints, RPC URLs\n│       ├── server/\n│       │   ├── Charge.ts          # Server: challenge, verify, broadcast\n│       │   └── Session.ts         # Server: session channel management\n│       ├── client/\n│       │   ├── Charge.ts          # Client: build tx, sign, send\n│       │   └── Session.ts         # Client: session lifecycle\n│       └── session/\n│           ├── Types.ts           # Session types and interfaces\n│           ├── Voucher.ts         # Voucher signing and verification\n│           ├── ChannelStore.ts    # Persistent channel state\n│           └── authorizers/       # Pluggable authorization strategies\n├── rust/                          # Rust SDK (coming soon)\n│   └── src/lib.rs\n└── demo/                          # Interactive playground\n```\n\n**Exports:**\n- `@solana/mpp` — shared schemas, session types, and authorizers only\n- `@solana/mpp/server` — server-side charge + session, `Mppx`, `Store`\n- `@solana/mpp/client` — client-side charge + session, `Mppx`\n\n## Quick Start\n\n### Charge (one-time payment)\n\n**Server:**\n\n```ts\nimport { Mppx, solana } from '@solana/mpp/server'\n\nconst mppx = Mppx.create({\n  secretKey: process.env.MPP_SECRET_KEY,\n  methods: [\n    solana.charge({\n      recipient: 'RecipientPubkey...',\n      currency: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',\n      decimals: 6,\n    }),\n  ],\n})\n\nconst result = await mppx.charge({\n  amount: '1000000', // 1 USDC\n  currency: 'USDC',\n})(request)\n\nif (result.status === 402) return result.challenge\nreturn result.withReceipt(Response.json({ data: '...' }))\n```\n\n**Client:**\n\n```ts\nimport { Mppx, solana } from '@solana/mpp/client'\n\nconst mppx = Mppx.create({\n  methods: [solana.charge({ signer })], // any TransactionSigner\n})\n\nconst response = await mppx.fetch('https://api.example.com/paid-endpoint')\n```\n\n### Fee Sponsorship (charge)\n\nThe server can pay transaction fees on behalf of clients:\n\n```ts\n// Server — pass a TransactionPartialSigner to cover fees\nsolana.charge({\n  recipient: '...',\n  signer: feePayerSigner, // KeyPairSigner, Keychain SolanaSigner, etc.\n})\n\n// Client — no changes needed, fee payer is handled automatically\n```\n\n## How It Works\n\n### Charge Flow\n\n1. Client requests a resource\n2. Server returns **402 Payment Required** with a challenge (`recipient`, `amount`, `currency`, optional `tokenProgram`, optional `recentBlockhash`)\n3. Client builds and signs a Solana transfer transaction\n4. Server simulates, broadcasts, confirms on-chain, and verifies the transfer\n5. Server returns the resource with a `Payment-Receipt` header\n\nWith fee sponsorship, the client partially signs (transfer authority only) and the server co-signs as fee payer before broadcasting.\n\n### Splits (charge)\n\nUse `splits` when one charge should pay multiple recipients in the same asset.\nThe top-level `amount` is the total paid. The primary `recipient` receives\n`amount - sum(splits)`, and each split recipient receives its own `amount`.\n\n```ts\nimport { Mppx, solana } from '@solana/mpp/server'\n\nconst mppx = Mppx.create({\n  secretKey: process.env.MPP_SECRET_KEY,\n  methods: [\n    solana.charge({\n      recipient: 'SellerPubkey...',\n      currency: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',\n      decimals: 6,\n      splits: [\n        { recipient: 'PlatformPubkey...', amount: '50000', memo: 'platform fee' },\n        { recipient: 'ReferrerPubkey...', amount: '20000', memo: 'referral fee' },\n      ],\n    }),\n  ],\n})\n\nconst result = await mppx.charge({\n  amount: '1000000', // total: 1.00 USDC\n  currency: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',\n})(request)\n```\n\nIn this example:\n- seller receives `930000`\n- platform receives `50000`\n- referrer receives `20000`\n\nThe same `splits` shape works for native SOL charges.\n\n## Demo\n\nAn interactive playground with a React frontend and Express backend, running against [Surfpool](https://surfpool.run).\n\n- Charge flow demo: `http://localhost:5173/charges`\n- Session flow demo: `http://localhost:5173/sessions`\n\n```bash\nsurfpool start\npnpm demo:install\npnpm demo:server\npnpm demo:app\n```\n\nSee [demo/README.md](demo/README.md) for full details.\n\n## Development\n\n```bash\n# TypeScript\ncd typescript \u0026\u0026 pnpm install\n\njust ts-fmt              # Format and lint\njust ts-build            # Build\njust ts-test             # Unit tests (charge + session, no network)\njust ts-test-integration # Integration tests (requires Surfpool)\n# Rust\ncd rust \u0026\u0026 cargo build\n\n# Everything\njust build            # Build both\njust test             # Test both\njust pre-commit       # Full pre-commit checks\n```\n\n## Spec\n\nThis SDK implements the [Solana Charge Intent](https://github.com/tempoxyz/mpp-specs/pull/188) for the [HTTP Payment Authentication Scheme](https://paymentauth.org).\n\nSession method docs and implementation notes are intentionally kept out of this\nREADME for now. See [docs/methods/sessions.md](docs/methods/sessions.md).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolana-foundation%2Fmpp-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolana-foundation%2Fmpp-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolana-foundation%2Fmpp-sdk/lists"}