Skip to main content

Prerequisites

  • Go 1.26 or later
  • A SolvaPay account with a product and at least one plan

Install the module

Import it as solvapay:
Agent payments live in a subpackage, 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.
For a new paid MCP server, scaffold one instead:
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

  1. In SolvaPay Console, go to Developers > API Keys and copy a sandbox secret key (sk_sandbox_…).
  2. Copy the reference (prd_…) of the product you want to charge for.
  3. 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.Z in the solvapay-sdk repository. go get …@latest picks 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.
To try the next release before it ships, ask for a preview by its version (previews are tagged go/vX.Y.Z-dev.N), or take the dev branch as a pseudo-version:
The API reference for every version is on pkg.go.dev.

Next steps