Install
openclaw skills install @psyb0t/go-polarUnofficial Go client for the Polar API, generated with oapi-codegen from Polar's published OpenAPI document. Package polar (github.com/psyb0t/go-polar) provides typed REST methods for products, customers, subscriptions, checkouts, orders, payments, benefits, usage events, meters, refunds and webhook management. Use when Go code needs the Polar API or already imports go-polar.
openclaw skills install @psyb0t/go-polarUnofficial, typed Go client for the Polar API, in package polar at the module root.
For install, operation examples, pagination and response fields, see references/setup.md.
POLAR_ACCESS_TOKEN. Never hardcode, commit or log it, and never print a request with its Authorization header.https://api.polar.sh for production or https://sandbox-api.polar.sh for sandbox. Select the environment the user requested.github.com/psyb0t/go-polar.AGENTS.md in the repo.The examples below cover a few calls. Every operation in the spec has a generated method, and the spec's descriptions are on them as Go doc comments. Look names and fields up instead of guessing. After go get github.com/psyb0t/go-polar, from inside your module:
go doc github.com/psyb0t/go-polar ClientWithResponsesInterface # every endpoint method
go doc github.com/psyb0t/go-polar ProductsListParams # one method, params type or model
go doc -all github.com/psyb0t/go-polar # the whole package
The same documentation is at https://pkg.go.dev/github.com/psyb0t/go-polar.
Method names come from the spec's operation IDs. <OperationId>WithResponse takes the context, then the path parameters in order, then *<OperationId>Params when the operation has query or header parameters, then the request body when it has one. The JSON200 field (or JSON201 and so on, per declared status) holds the decoded body; it is nil for any other status.
Create a client with polar.NewClientWithResponses and a polar.WithRequestEditorFn option that sets Authorization to Bearer followed by the access token. Use the host URL without a /v1 suffix.
ProductsListWithResponse(ctx, &polar.ProductsListParams{}) lists products. CustomersListWithResponse(ctx, &polar.CustomersListParams{}) lists customers. CustomersCreateWithResponse accepts a generated customer-create union; construct a branch using the generated FromCustomerIndividualCreate or FromCustomerTeamCreate helper. Decode a customer union with AsCustomerIndividual or AsCustomerTeam.
The Go error return covers transport and decoding failures. Inspect StatusCode() and the matching success field, such as JSON200 or JSON201, before using a response. Unsupported status bodies remain available in Body.
Nullable fields can be pointers; check for nil before dereferencing. Number fields use float64; integer minor-unit amounts remain integers. Scalar-or-array query filters take slices; use one element for a single value. List methods do not paginate automatically. Continue with Page until the response's Pagination.MaxPage is reached.