Prerequisites
- Go 1.26 or later
- A SolvaPay account with a product and at least one plan
Install the module
solvapay:
github.com/solvapay/solvapay-sdk/go/agents. See Agent payments.
Set up with the CLI
In an existing project,npx solvapay init signs you in, writes SOLVAPAY_SECRET_KEY and SOLVAPAY_PRODUCT_REF to .env, and runs go get for the module, pinned exactly. It needs Node.js 22 or later to run. The SDK reads environment variables, not .env, so load .env when your app starts or export the variables.
npx solvapay doctor checks that the SDK is the newest release and prints the upgrade command. See CLI setup for the flags.
Set your keys
- In SolvaPay Console, go to Developers > API Keys and copy a sandbox secret key (
sk_sandbox_…). - Copy the reference (
prd_…) of the product you want to charge for. - Set them in your environment:
Keep the secret key on your server. Never ship it to a browser or a client app.
Versions
- The Go SDK has its own version line, starting at v0.1.0. Its numbers don’t follow the TypeScript packages.
- Releases are tagged
go/vX.Y.Zin the solvapay-sdk repository.go get …@latestpicks the newest release. - Until v1.0.0, a minor release (v0.x to v0.y) may change the API.
- Each release behaves like the TypeScript SDK: a shared conformance suite checks the paywall, its messages, the MCP tools and webhook verification on every change.
go/vX.Y.Z-dev.N), or take the dev branch as a pseudo-version:
Next steps
- Quick start: make your first paid function.
- MCP server: sell MCP tools.
- The TypeScript equivalent of this page: Installation.