Apr 21, 2026
Go and Ruby SDKs
Two new SDKs for the Machine Payments Protocol
MPP now has official SDKs for Go and Ruby. Both implement the full MPP flow: core types, payment methods, server middleware, and client transports.
mpp-go is maintained by Tempo Labs, and mpp-rb is maintained by Stripe. They join the existing TypeScript, Python, and Rust SDKs, as well as the community SDKs in other languages.
Go
Install:
$ go get github.com/tempoxyz/mpp-goCharge for a route:
package main
import (
"encoding/json"
"net/http"
"os"
"github.com/tempoxyz/mpp-go/pkg/server"
charge "github.com/tempoxyz/mpp-go/pkg/tempo/server"
)
func main() {
intent, _ := charge.NewIntent(charge.IntentConfig{
RPCURL: "https://rpc.moderato.tempo.xyz",
})
method := charge.NewMethod(charge.MethodConfig{
Intent: intent,
Recipient: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
})
payment := server.New(
method,
"api.example.com",
os.Getenv("MPP_SECRET_KEY"),
)
handler := server.ChargeMiddleware(payment, server.ChargeParams{
Amount: "0.50",
Description: "Paid content",
})(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_ = json.NewEncoder(w).Encode(map[string]any{
"data": "paid content",
"payer": server.CredentialFromContext(r.Context()).Source,
})
}))
_ = http.ListenAndServe(":8080", handler)
}Make a paid request:
package main
import (
"context"
"os"
"fmt"
"github.com/tempoxyz/mpp-go/pkg/client"
charge "github.com/tempoxyz/mpp-go/pkg/tempo/client"
)
func main() {
method, _ := charge.New(charge.Config{
PrivateKey: os.Getenv("MPP_PRIVATE_KEY"),
RPCURL: "https://rpc.moderato.tempo.xyz",
})
c := client.New([]client.Method{method})
resp, _ := c.Get(context.Background(), "https://api.example.com/paid")
defer resp.Body.Close()
fmt.Println(resp.StatusCode)
}The middleware returns a 402 with a Challenge; the client handles it automatically and retries with a Credential. mpp-go ships with adapters for Gin, Echo, and Chi (via net/http compatibility). Full docs at mpp.dev/sdk/go.
Ruby
Install:
$ gem install mpp-rbOr add to your Gemfile:
gem "mpp-rb"Charge for a route:
require "mpp-rb"
server = Mpp.create(
method: Mpp::Methods::Tempo.tempo(
intents: {
"charge" => Mpp::Methods::Tempo::ChargeIntent.new,
},
recipient: "0x742d35Cc6634c0532925a3b844bC9e7595F8fE00",
),
)
result = server.charge(
authorization_header,
"0.50",
description: "Paid endpoint",
)
if result.is_a?(Mpp::Challenge)
resp = Mpp::Server::Decorator.make_challenge_response(
result,
server.realm,
)
else
credential, receipt = result
endMake a paid request:
require "mpp-rb"
account = Mpp::Methods::Tempo::Account.from_key(ENV.fetch("MPP_PRIVATE_KEY"))
transport = Mpp::Client::Transport.new(
methods: [
Mpp::Methods::Tempo.tempo(
account: account,
intents: {
"charge" => Mpp::Methods::Tempo::ChargeIntent.new,
},
),
],
)
response = transport.request(:get, "https://api.example.com/paid")mpp-rb supports both Tempo and Stripe payment methods. It works with any Rack-based framework—Rails, Sinatra, or plain Rack. Full docs at mpp.dev/sdk/ruby.
Get started
Pick the SDK that fits your application, or learn more about MPP.
- Go: github.com/tempoxyz/mpp-go
- Ruby: github.com/stripe/mpp-rb
- Quickstart: mpp.dev/quickstart
- IETF Specification: paymentauth.org