{"id":50473896,"url":"https://github.com/tempoxyz/mpp-go","last_synced_at":"2026-06-01T12:00:58.214Z","repository":{"id":351456560,"uuid":"1185363707","full_name":"tempoxyz/mpp-go","owner":"tempoxyz","description":"Go SDK for the Machine Payments Protocol","archived":false,"fork":false,"pushed_at":"2026-05-29T13:01:06.000Z","size":254,"stargazers_count":7,"open_issues_count":8,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-29T13:21:55.194Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/tempoxyz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-18T14:04:22.000Z","updated_at":"2026-05-29T13:01:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tempoxyz/mpp-go","commit_stats":null,"previous_names":["tempoxyz/mpp-go"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tempoxyz/mpp-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tempoxyz%2Fmpp-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tempoxyz%2Fmpp-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tempoxyz%2Fmpp-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tempoxyz%2Fmpp-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tempoxyz","download_url":"https://codeload.github.com/tempoxyz/mpp-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tempoxyz%2Fmpp-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33773782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-01T12:00:38.524Z","updated_at":"2026-06-01T12:00:58.188Z","avatar_url":"https://github.com/tempoxyz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr\u003e\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://mpp.dev\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tempoxyz/mpp/refs/heads/main/public/lockup-light.svg\"\u003e\n      \u003cimg alt=\"Machine Payments Protocol\" src=\"https://raw.githubusercontent.com/tempoxyz/mpp/refs/heads/main/public/lockup-dark.svg\" width=\"auto\" height=\"120\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n# mpp-go\n\nGo SDK for the [**Machine Payments Protocol**](https://mpp.dev)\n\n[![Website](https://img.shields.io/badge/website-mpp.dev-black)](https://mpp.dev)\n[![Docs](https://img.shields.io/badge/docs-mpp.dev-blue)](https://mpp.dev/sdk/go)\n[![Go Reference](https://pkg.go.dev/badge/github.com/tempoxyz/mpp-go.svg)](https://pkg.go.dev/github.com/tempoxyz/mpp-go)\n[![License](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue)](LICENSE)\n\n[MPP](https://mpp.dev) lets any client — agents, apps, or humans — pay for any service in the same HTTP request. It standardizes [HTTP 402](https://mpp.dev/protocol/http-402) with an open [IETF specification](https://paymentauth.org), so servers can charge and clients can pay without API keys, billing accounts, or checkout flows.\n## Documentation\n\nYou can get started today by reading the [Go SDK docs](https://mpp.dev/sdk/go), the module-level [Go doc reference](https://pkg.go.dev/github.com/tempoxyz/mpp-go), exploring the [protocol overview](https://mpp.dev/protocol/), or jumping straight to the [quickstart](https://mpp.dev/quickstart/).\n\nPackage docs:\n\n- [`pkg/client`](https://pkg.go.dev/github.com/tempoxyz/mpp-go/pkg/client)\n- [`pkg/server`](https://pkg.go.dev/github.com/tempoxyz/mpp-go/pkg/server)\n- [`pkg/tempo`](https://pkg.go.dev/github.com/tempoxyz/mpp-go/pkg/tempo)\n- [`pkg/tempo/client`](https://pkg.go.dev/github.com/tempoxyz/mpp-go/pkg/tempo/client)\n- [`pkg/tempo/server`](https://pkg.go.dev/github.com/tempoxyz/mpp-go/pkg/tempo/server)\n\n## Install\n\n```bash\ngo get github.com/tempoxyz/mpp-go\n```\n\n## Quick Start\n\n### Server\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\n\t\"github.com/tempoxyz/mpp-go/pkg/server\"\n\tcharge \"github.com/tempoxyz/mpp-go/pkg/tempo/server\"\n)\n\nfunc main() {\n\tmethod, _ := charge.MethodFromConfig(charge.Config{\n\t\tRPCURL: \"https://rpc.moderato.tempo.xyz\",\n\t\tRecipient: \"0x70997970c51812dc3a010c7d01b50e0d17dc79c8\",\n\t})\n\n\tpayment := server.New(method, \"api.example.com\", \"replace-me\")\n\n\thandler := server.ChargeMiddleware(payment, server.ChargeParams{\n\t\tAmount:      \"0.50\",\n\t\tDescription: \"Paid content\",\n\t})(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t_ = json.NewEncoder(w).Encode(map[string]any{\n\t\t\t\"data\":  \"paid content\",\n\t\t\t\"payer\": server.CredentialFromContext(r.Context()).Source,\n\t\t})\n\t}))\n\n\t_ = http.ListenAndServe(\":8080\", handler)\n}\n```\n\n### Client\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/tempoxyz/mpp-go/pkg/client\"\n\t\"github.com/tempoxyz/mpp-go/pkg/mpp\"\n\tcharge \"github.com/tempoxyz/mpp-go/pkg/tempo/client\"\n)\n\nfunc main() {\n\tmethod, _ := charge.New(charge.Config{\n\t\tPrivateKey: os.Getenv(\"MPP_PRIVATE_KEY\"),\n\t\tRPCURL:     \"https://rpc.moderato.tempo.xyz\",\n\t})\n\n\tc := client.New([]client.Method{method})\n\tresponse, err := c.Get(context.Background(), \"https://api.example.com/paid\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\treceipt, _ := mpp.ParseReceipt(response.Header.Get(\"Payment-Receipt\"))\n\n\tvar body struct {\n\t\tData  string `json:\"data\"`\n\t\tPayer string `json:\"payer\"`\n\t}\n\t_ = json.NewDecoder(response.Body).Decode(\u0026body)\n\n\tfmt.Printf(\"paid request for %q from %s with receipt %s\\n\", body.Data, body.Payer, receipt.Reference)\n}\n```\n\n## Examples\n\n| Example | Description |\n|---------|-------------|\n| [basic](./examples/basic/) | Separate-process demo with a long-running server and standalone client, mirroring the `mpp-rs` sample layout |\n| [chi/server](./examples/chi/server/) | Chi router example using the existing `net/http` middleware helpers |\n| [gin/server](./examples/gin/server/) | Gin example using the dedicated adapter package and context helpers |\n| [echo/server](./examples/echo/server/) | Echo example using the dedicated adapter package and context helpers |\n| [fiber/server](./examples/fiber/server/) | Fiber example using the dedicated adapter package and context helpers |\n| [charge-basic](./examples/charge-basic/) | Generic Tempo charge flow using the high-level MPP client and server helpers, available in both one-command and separate-process layouts |\n| [charge-hash](./examples/charge-hash/) | Push-mode charge flow with a hash credential, available in both one-command and separate-process layouts |\n| [charge-fee-payer](./examples/charge-fee-payer/) | Sponsored Tempo charge flow where the server co-signs as a fee payer, available in both one-command and separate-process layouts |\n\n## Web Frameworks\n\nThe most common Go HTTP stacks today are `net/http`, Gin, Echo, Chi, and Fiber.\nMPP already integrates directly with `net/http`, which also covers Chi because\nChi handlers and middleware use the standard `http.Handler` interfaces.\n\nFor the most common non-stdlib frameworks, mpp-go ships first-class adapters:\n\n- [`pkg/server/gin`](https://pkg.go.dev/github.com/tempoxyz/mpp-go/pkg/server/gin) for Gin\n- [`pkg/server/echo`](https://pkg.go.dev/github.com/tempoxyz/mpp-go/pkg/server/echo) for Echo\n- [`pkg/server/fiber`](https://pkg.go.dev/github.com/tempoxyz/mpp-go/pkg/server/fiber) for Fiber\n\nChi needs no special adapter:\n\n```go\nrouter.With(server.ChargeMiddleware(payment, server.ChargeParams{\n\tAmount:      \"0.50\",\n\tDescription: \"Paid content\",\n})).Get(\"/paid\", func(w http.ResponseWriter, r *http.Request) {\n\tcredential := server.CredentialFromContext(r.Context())\n\treceipt := server.ReceiptFromContext(r.Context())\n\t_ = json.NewEncoder(w).Encode(map[string]any{\n\t\t\"payer\":   credential.Source,\n\t\t\"receipt\": receipt.Reference,\n\t})\n})\n```\n\nGin route middleware:\n\n```go\nrouter.GET(\"/paid\", ginadapter.ChargeMiddleware(payment, server.ChargeParams{\n\tAmount:      \"0.50\",\n\tDescription: \"Paid content\",\n}), func(c *gin.Context) {\n\tcredential := ginadapter.Credential(c)\n\treceipt := ginadapter.Receipt(c)\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"payer\":   credential.Source,\n\t\t\"receipt\": receipt.Reference,\n\t})\n})\n```\n\nEcho route middleware:\n\n```go\ne.GET(\"/paid\", func(c echo.Context) error {\n\tcredential := echoadapter.Credential(c)\n\treceipt := echoadapter.Receipt(c)\n\treturn c.JSON(http.StatusOK, map[string]any{\n\t\t\"payer\":   credential.Source,\n\t\t\"receipt\": receipt.Reference,\n\t})\n}, echoadapter.ChargeMiddleware(payment, server.ChargeParams{\n\tAmount:      \"0.50\",\n\tDescription: \"Paid content\",\n}))\n```\n\nFiber route middleware:\n\n```go\napp.Get(\"/paid\", fiberadapter.ChargeMiddleware(payment, server.ChargeParams{\n\tAmount:      \"0.50\",\n\tDescription: \"Paid content\",\n}), func(c *fiber.Ctx) error {\n\tcredential := fiberadapter.Credential(c)\n\treceipt := fiberadapter.Receipt(c)\n\treturn c.Status(http.StatusOK).JSON(fiber.Map{\n\t\t\"payer\":   credential.Source,\n\t\t\"receipt\": receipt.Reference,\n\t})\n})\n```\n\n## Protocol\n\nBuilt on the [\"Payment\" HTTP Authentication Scheme](https://paymentauth.org), an open specification proposed to the IETF. See [mpp.dev/protocol](https://mpp.dev/protocol/) for the full protocol overview, or the [IETF specification](https://paymentauth.org) for the wire format.\n\n## Contributing\n\n```\ngit clone https://github.com/tempoxyz/mpp-go\ncd mpp-go\ngo test ./...\n```\n\n## Security\n\nSee [`SECURITY.md`](./SECURITY.md) for reporting vulnerabilities.\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](./LICENSE-APACHE) or [MIT License](./LICENSE-MIT) at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this project by you, as defined in the Apache-2.0 license,\nshall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftempoxyz%2Fmpp-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftempoxyz%2Fmpp-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftempoxyz%2Fmpp-go/lists"}