Documentation
¶
Overview ¶
Package monobank is the base HTTP transport for every monobank API surface. It exposes the Client type, the Option type, and a set of constructors and options (New, WithHTTPClient, WithHTTPDoer, WithBaseURL, WithRetry, WithAuth, WithRateLimiter, WithUnsafeRetries, WithLogger, WithRequestHook, WithResponseHook), plus the shared error type APIError and sentinel errors keyed by HTTP status (ErrUnauthorized, ErrForbidden, ErrNotFound, ErrTooManyRequests).
Throttling: NewLimiter is a simple token bucket; NewKeyedLimiter gives per-key buckets (for example, per accountID) with optional TTL eviction; WithLimiterKey propagates the key through context.Context.
Application code usually does not pull in this package directly, but rather the topical sub-packages built on top of it:
- github.com/OlexiyOdarchuk/go-monobank-sdk/auth — the Authorizer interface plus implementations for the personal token and the corporate ECDSA signature.
- github.com/OlexiyOdarchuk/go-monobank-sdk/bank — the bank's public endpoints (currency rates, server key) and the shared data model (ClientInfo, Account, Jar, Transaction).
- github.com/OlexiyOdarchuk/go-monobank-sdk/personal — Personal Open API (authorization via X-Token).
- github.com/OlexiyOdarchuk/go-monobank-sdk/corporate — Corporate Open API (ECDSA signatures), including monoKEP.
- github.com/OlexiyOdarchuk/go-monobank-sdk/business — corp-api (legal entities): payroll contacts and rosters, payments, payslips.
- github.com/OlexiyOdarchuk/go-monobank-sdk/acquiring — acquiring (/api/merchant/*): invoices, holds, QR cash desks, tokenized cards.
- github.com/OlexiyOdarchuk/go-monobank-sdk/webhook — the server side: signature verification, payload parser, a ready http.Handler, and an in-memory deduper.
- github.com/OlexiyOdarchuk/go-monobank-sdk/mcc — a typed ISO 18245 MCC enum with grouping into categories ([mcc.Code.Category]).
- github.com/OlexiyOdarchuk/go-monobank-sdk/currency — a typed ISO 4217 numeric currency code with its alpha-3 name.
The base client (Client) is already embedded in each sub-package: you don't construct it separately for routine code.
Index ¶
- Variables
- func UserAgent() string
- func WithLimiterKey(ctx context.Context, key string) context.Context
- type APIError
- type Client
- type HTTPDoer
- type KeyedLimiter
- type Limiter
- type Option
- func WithAuth(a auth.Authorizer) Option
- func WithBaseURL(uri string) Option
- func WithHTTPClient(httpClient *http.Client) Option
- func WithHTTPDoer(d HTTPDoer) Option
- func WithInsecureBaseURL(allow bool) Option
- func WithLogger(l *slog.Logger) Option
- func WithRateLimiter(l RateLimiter) Option
- func WithRequestHook(fn func(*http.Request)) Option
- func WithResponseHook(fn func(*http.Response, error)) Option
- func WithRetry(attempts int, baseDelay, maxDelay time.Duration) Option
- func WithRoundTripper(rt http.RoundTripper) Option
- func WithUnsafeRetries(enabled bool) Option
- func WithUserAgent(ua string) Option
- type RateLimiter
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyRequest indicates that [Client.Do] received a nil request. ErrEmptyRequest = errors.New("empty request") // ErrInvalidURL indicates that the client's baseURL is not valid // (usually never happens because [New] always sets a default; it // can occur after [Client.SetBaseURL] with an invalid string). ErrInvalidURL = errors.New("invalid URL") // ErrInsecureBaseURL indicates that [WithBaseURL] received a // non-https URL for a non-loopback host. This guards against // accidentally sending tokens in cleartext. For tests via httptest // or a custom localhost proxy, use a loopback host or opt in via // [WithInsecureBaseURL]. ErrInsecureBaseURL = errors.New("base URL must be https for non-loopback hosts") )
Client-level errors.
var ( ErrUnauthorized = errors.New("monobank: unauthorized (401)") // ErrForbidden is HTTP 403: the token lacks rights for the endpoint. ErrForbidden = errors.New("monobank: forbidden (403)") // ErrNotFound is HTTP 404: endpoint or entity does not exist. ErrNotFound = errors.New("monobank: not found (404)") // ErrTooManyRequests is HTTP 429: rate limit exceeded. ErrTooManyRequests = errors.New("monobank: too many requests (429)") )
Sentinel errors for the common HTTP statuses. APIError.Is implements errors.Is against them, giving convenient detection:
if errors.Is(err, monobank.ErrUnauthorized) { /* token expired */ }
if errors.Is(err, monobank.ErrTooManyRequests) { /* back off */ }
On top of the sentinels, the full APIError is still reachable via errors.As (status code, ErrorDescription, raw body).
Functions ¶
func UserAgent ¶ added in v1.2.0
func UserAgent() string
UserAgent returns the User-Agent the SDK uses by default. Exported so you can compose your own value for WithUserAgent without losing the SDK portion:
cli := personal.New(token,
monobank.WithUserAgent("myapp/1.2.3 "+monobank.UserAgent()),
)
func WithLimiterKey ¶ added in v1.0.0
WithLimiterKey returns a copy of ctx carrying key, which KeyedLimiter uses to pick the matching per-key bucket. If the key is absent from the context, KeyedLimiter treats the request as "" (the shared default bucket).
ctx = monobank.WithLimiterKey(ctx, accountID) cli.Transactions(ctx, accountID, from, to)
Types ¶
type APIError ¶
type APIError struct {
Method string
URL string
StatusCode int
ExpectedStatusCodes []int
// ErrorDescription is the value of the errorDescription field from
// the JSON body of the Mono response, when the body could be
// parsed; otherwise empty.
ErrorDescription string
Body []byte
}
APIError is returned when a monobank HTTP response does not match any of the statuses the caller expected. It captures the method, full URL, received and expected status codes, plus the first 256 characters of the body for diagnostics.
If the response body is JSON of the shape {"errorDescription": "..."} (the standard Mono error format for the personal/corporate/business/ acquiring APIs), the APIError.ErrorDescription field holds the parsed message; otherwise it is empty and the original bytes remain in APIError.Body.
Example ¶
Розпізнавання конкретного типу помилки і доступ до errorDescription.
package main
import (
"context"
"errors"
"fmt"
"net/http"
"os"
monobank "github.com/OlexiyOdarchuk/go-monobank-sdk"
"github.com/OlexiyOdarchuk/go-monobank-sdk/personal"
)
func main() {
cli := personal.New(os.Getenv("MONO_TOKEN"))
_, err := cli.ClientInfo(context.Background())
var apiErr *monobank.APIError
if errors.As(err, &apiErr) {
switch apiErr.StatusCode {
case http.StatusForbidden:
fmt.Printf("token rejected: %s\n", apiErr.ErrorDescription)
case http.StatusTooManyRequests:
fmt.Println("rate limited — wait and retry")
default:
fmt.Printf("HTTP %d: %s\n", apiErr.StatusCode, apiErr.ErrorDescription)
}
}
}
Output:
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the base HTTP transport for every monobank surface. Each sub-package (bank, personal, corporate, business, acquiring) composes Client with an auth.Authorizer from the auth package and the base URL tailored to its API. Routine code does not usually construct this type directly — use the sub-package factories ([personal.New], [bank.New] etc.).
func New ¶
New returns the base Client assembled from the supplied options. Without WithAuth the client uses auth.Public (no-op) — fine for the public bank endpoints via the bank sub-package, but not for personal, corporate, business or acquiring (which require real authorization; they normally call New themselves, adding their own auth.Authorizer).
c := monobank.New(
monobank.WithHTTPClient(myHTTP),
monobank.WithRetry(5, 0, 0),
)
Options are applied in two passes so WithInsecureBaseURL takes effect regardless of where it appears in the list. Each option runs twice — they are expected to be pure setters; if you wrote a custom Option with side effects, scope them to a single pass.
func (*Client) ChainRequestHook ¶ added in v1.3.0
ChainRequestHook composes fn on top of the client's existing request hook so the previous hook still fires (first), then fn. If no hook was installed before, fn becomes the sole hook.
Used by integrations that want to add their own request-side behavior (OpenTelemetry span start, custom headers) without stomping on a hook the application installed via WithRequestHook. nil is ignored.
func (*Client) ChainResponseHook ¶ added in v1.3.0
ChainResponseHook composes fn on top of the client's existing response hook. Existing hook runs first, then fn. nil is ignored.
func (*Client) Close ¶ added in v1.2.0
Close stops the background resources attached to the client (currently the sweeper goroutine of KeyedLimiter, when such a limiter was passed via WithRateLimiter). Safe to call on a client that does not need Close (returns nil).
Implements io.Closer, so the standard defer pattern just works:
cli := personal.New(token, monobank.WithRateLimiter(klim)) defer cli.Close()
Without Close, the sweeper goroutine of KeyedLimiter stays alive until the process exits (a leak in tests, but normal in long-running services with a single global client).
Pointer receiver for consistency with Client.SetBaseURL / ChainRequestHook / ChainResponseHook. Existing callers using a value receiver via sub-package wrappers still work — Go addresses values automatically when needed.
func (Client) Do ¶
Do executes req against c.baseURL and decodes the response into v. The number of expected status codes is arbitrary; the default is http.StatusOK. If the response has a different code, returns *APIError.
The type of v selects the decoding mode:
- nil — the body is simply read and discarded;
- *[]byte — the raw body bytes are written into v;
- io.Writer — the body is copied to the Writer;
- otherwise — decoded as JSON into v.
Transient failures (5xx, 429) are retried per WithRetry (honoring Retry-After). Context cancellation exits immediately.
The method is exported so sub-packages (bank, personal, corporate, business, acquiring) share one HTTP plumbing (retry, base-URL resolution, error mapping) instead of reimplementing it. Pass an *http.Request with a path-only URL — it is resolved against the configured base URL.
func (*Client) SetBaseURL ¶
SetBaseURL overrides the base URL of an already-constructed client. On a parse failure it records the error in c.optErr (which surfaces from the very first Client.Do) and leaves the previous value in place. For routine code use WithBaseURL when constructing through New; this method exists for sub-packages that assemble Client incrementally.
Previously SetBaseURL silently kept the old value — a fat-finger in the URL would mean every request went to the default production host, which is the worst kind of "works on my machine" bug for staging configs.
type HTTPDoer ¶
HTTPDoer is the minimal subset of *http.Client that Client depends on. Any transport that implements this interface (the standard client, a custom round-tripper, a test fake) plugs in via WithHTTPDoer.
type KeyedLimiter ¶ added in v1.0.0
type KeyedLimiter struct {
// contains filtered or unexported fields
}
KeyedLimiter lazily creates a separate Limiter per key — typically the accountID, because Mono limits /personal/statement/{account}/… independently per account. Implements RateLimiter: the key is taken from the context via WithLimiterKey.
// idleTTL=10*time.Minute — buckets that have not been used for
// 10 min are removed by a background sweeper so the map does
// not grow without bound in long-running processes.
klim := monobank.NewKeyedLimiter(time.Minute, 1, 10*time.Minute)
defer klim.Stop()
cli := personal.New(token, monobank.WithRateLimiter(klim))
for _, acc := range info.Accounts {
ctx := monobank.WithLimiterKey(ctx, acc.ID)
txs, err := cli.Transactions(ctx, acc.ID, from, to)
// …
}
Safe for concurrent use.
func NewKeyedLimiter ¶ added in v1.0.0
NewKeyedLimiter returns a limiter that, for each unique key, creates its own bucket with the every / burst parameters (as in NewLimiter).
idleTTL > 0 starts a background sweeper that removes buckets not touched for longer than idleTTL (guards against memory leaks with a large number of unique keys). idleTTL <= 0 disables eviction; fine for short-lived CLI utilities, but long-running processes should always pass a reasonable value (for example, 10× every).
Always call KeyedLimiter.Stop on shutdown (via defer right after construction) to stop the sweeper goroutine.
Example ¶
Per-account ліміт виписки: на кожен accountID — окрема корзина. idleTTL=10*time.Minute видаляє корзини, до яких не зверталися довше 10 хв, щоб мапа не росла на сервісах із багатьма accountID.
package main
import (
"context"
"log"
"os"
"time"
monobank "github.com/OlexiyOdarchuk/go-monobank-sdk"
"github.com/OlexiyOdarchuk/go-monobank-sdk/personal"
)
func main() {
klim := monobank.NewKeyedLimiter(time.Minute, 1, 10*time.Minute)
defer klim.Stop()
cli := personal.New(os.Getenv("MONO_TOKEN"),
monobank.WithRateLimiter(klim),
)
to := time.Now()
from := to.Add(-time.Hour)
for _, acc := range []string{"acc-1", "acc-2"} {
ctx := monobank.WithLimiterKey(context.Background(), acc)
if _, err := cli.Transactions(ctx, acc, from, to); err != nil {
log.Printf("%s: %v", acc, err)
}
}
}
Output:
func (*KeyedLimiter) Stop ¶ added in v1.1.0
func (k *KeyedLimiter) Stop()
Stop stops the background sweeper. Safe to call multiple times, and on a limiter without a sweeper (idleTTL <= 0) — in that case it is a no-op. After Stop the limiter still serves Wait/WaitKey calls correctly; the buckets are simply no longer evicted automatically.
func (*KeyedLimiter) Wait ¶ added in v1.0.0
func (k *KeyedLimiter) Wait(ctx context.Context) error
Wait implements RateLimiter. It extracts the key from the context via WithLimiterKey; if no key is present, it uses the shared bucket with the "" key.
type Limiter ¶ added in v1.0.0
type Limiter struct {
// contains filtered or unexported fields
}
Limiter is a simple token bucket. The bucket refills at one token every every; up to burst tokens are stored at once. Safe for concurrent use.
Mono's default limits:
- /personal/client-info — 1 call per 60 s (every=time.Minute, burst=1)
- /personal/statement/{account}/… — 1 call per account per 60 s
For per-account limits, create a separate Limiter (and a separate client) for each account, or implement a custom RateLimiter.
func NewLimiter ¶ added in v1.0.0
NewLimiter returns a limiter that allows one request every every with short bursts up to burst. every <= 0 means "no limit" — Wait always returns immediately. burst < 1 is normalized to 1.
// 1 request per 60 seconds (as in /personal/client-info) lim := monobank.NewLimiter(time.Minute, 1) cli := personal.New(token, monobank.WithRateLimiter(lim))
Example ¶
Token-bucket: 1 запит на 60 секунд (типовий ліміт /personal/client-info).
package main
import (
"context"
"log"
"os"
"time"
monobank "github.com/OlexiyOdarchuk/go-monobank-sdk"
"github.com/OlexiyOdarchuk/go-monobank-sdk/personal"
)
func main() {
lim := monobank.NewLimiter(time.Minute, 1)
cli := personal.New(os.Getenv("MONO_TOKEN"),
monobank.WithRateLimiter(lim),
)
if _, err := cli.ClientInfo(context.Background()); err != nil {
log.Fatal(err)
}
}
Output:
type Option ¶
type Option func(*Client)
Option configures Client. Pass it to New (and likewise to sub-package factories — [personal.New], [bank.New] etc., which forward options to New). Additive design: new options are added without breaking existing call sites.
func WithAuth ¶
func WithAuth(a auth.Authorizer) Option
WithAuth attaches an auth.Authorizer to the client. Sub-packages (personal, corporate, business, acquiring) use it to plug in their authorization scheme (X-Token, ECDSA signature, etc.). nil is ignored — the default stays auth.Public (no authorization).
func WithBaseURL ¶
WithBaseURL overrides the default base URL (https://api.monobank.ua). Handy for testing against httptest.Server, a recorded proxy, or alternative hosts (corp-api.monobank.ua is applied automatically inside [business.New], no need to set it here).
SECURITY: if uri uses a non-https scheme AND the host is not a loopback, the client remembers ErrInsecureBaseURL and returns it from the very first Client.Do. Loopback covers the literal hostname "localhost" plus any IP for which net.IP.IsLoopback is true (127.0.0.0/8 and ::1 — not just 127.0.0.1). This guards against accidentally deploying with a staging config that sends X-Token in cleartext. Opt out deliberately via WithInsecureBaseURL.
Option order does NOT matter: New applies WithInsecureBaseURL first in a separate pass before evaluating the base-URL guard.
func WithHTTPClient ¶
WithHTTPClient sets a custom *http.Client (handy for timeouts, custom transports, proxies). nil or omission falls back to the standard &http.Client{} with no timeout.
func WithHTTPDoer ¶
WithHTTPDoer accepts any HTTPDoer. Useful for plugging in middleware (circuit breakers, custom transports, test fakes). nil is ignored.
func WithInsecureBaseURL ¶ added in v1.2.0
WithInsecureBaseURL deliberately allows an http:// URL on a non-loopback host in WithBaseURL. Useful for a recorded MITM proxy used for debugging (mitmproxy, burp) or staging setups behind a VPN where https is overkill. The default is false; turn it on only if you understand that the token will travel in cleartext and that is acceptable on your network.
Option order is irrelevant — New resolves WithInsecureBaseURL in a dedicated pass before any other option runs.
func WithLogger ¶
WithLogger attaches a *slog.Logger to the client. When set, the SDK logs:
- Debug "monobank: sending request" — before every HTTP call (method, url).
- Debug "monobank: http response" — successful response (method, url, status, duration).
- Warn "monobank: http error" — transport failure (method, url, duration, err).
The logger fires per attempt — retries produce multiple records. nil is ignored. Default: do not log.
CAUTION (PII): at Debug level the full request URL goes into the log, including the accountID path segment for /personal/statement/{acc}/... Do not enable Debug in production, or wire up a handler-side filter in your own slog.Handler (banking secrecy). Info/Warn are safe.
cli := personal.New(token, monobank.WithLogger(slog.Default()))
func WithRateLimiter ¶ added in v1.0.0
func WithRateLimiter(l RateLimiter) Option
WithRateLimiter sets a client-side throttle. RateLimiter.Wait is called on EVERY attempt, including each retry — so a burst of retries after a 502/429 cannot blow past the limiter the moment the upstream recovers. nil is ignored.
Mono has strict limits (for example, /personal/client-info is one call per 60 s); without a limiter the SDK relies solely on server-side 429 plus WithRetry backoff. A local limiter helps avoid getting 429-ed right away.
lim := monobank.NewLimiter(time.Minute, 1) cli := personal.New(token, monobank.WithRateLimiter(lim))
You can drop in any *golang.org/x/time/rate.Limiter — its Wait(ctx) signature matches RateLimiter.
func WithRequestHook ¶
WithRequestHook installs a callback invoked before every HTTP request (including each retry). The request has been resolved to its full URL and has the authorization headers set — the hook may add its own (for example, OpenTelemetry trace context, X-Correlation-Id). nil is ignored.
cli := personal.New(token, monobank.WithRequestHook(func(r *http.Request) {
r.Header.Set("X-Correlation-Id", uuid.NewString())
}))
func WithResponseHook ¶
WithResponseHook installs a callback invoked after every HTTP response (success and failure). It runs IMMEDIATELY after http.Doer.Do, before parsing and before the expected-status check. resp may be nil (if err != nil); err may be nil (when everything is fine). Useful for metrics (per-attempt latency, error counts). nil is ignored.
cli := personal.New(token, monobank.WithResponseHook(func(r *http.Response, err error) {
if r != nil {
metrics.Counter("mono.responses", "status", strconv.Itoa(r.StatusCode)).Inc()
}
}))
func WithRetry ¶
WithRetry enables automatic retry for transient failures (5xx and 429). Backoff is exponential with full jitter; Retry-After from the response is honored when present.
attempts == 0 inherits the defaults (4 attempts, base 500ms, max 30s). attempts <= 1 explicitly disables retry. Non-positive baseDelay / maxDelay inherit the defaults.
Only transient failures (5xx, 429) are retried; 4xx errors come back as APIError without a retry, because they are genuine client-side errors.
func WithRoundTripper ¶ added in v1.3.0
func WithRoundTripper(rt http.RoundTripper) Option
WithRoundTripper installs a custom http.RoundTripper without touching the rest of the embedded *http.Client settings (timeout, Cookie jar, redirect policy). This is the standard middleware slot: OpenTelemetry / Datadog / Prometheus / custom auth-refresh or circuit-breaker logic that does not require rewriting the whole HTTP stack.
type loggingRT struct{ next http.RoundTripper }
func (l loggingRT) RoundTrip(r *http.Request) (*http.Response, error) {
log.Println("→", r.Method, r.URL.Path)
return l.next.RoundTrip(r)
}
cli := personal.New(token, monobank.WithRoundTripper(
loggingRT{next: http.DefaultTransport},
))
Compose by ordinary wrapping: build the middleware chain from the outside in, or via a helper function. nil is ignored.
Option order: WithRoundTripper MUST come AFTER WithHTTPClient (otherwise WithHTTPClient overwrites the transport). If you pass your own http.Client that already has the right Transport, use WithHTTPClient alone, without WithRoundTripper.
func WithUnsafeRetries ¶ added in v1.1.0
WithUnsafeRetries enables automatic retries for POST/PATCH without an Idempotency-Key header. By default such methods are not retried, because a 502/504 from the load balancer can arrive AFTER upstream has already processed the request — a retry then creates a duplicate operation (for example, two invoices via [acquiring.Client.CreateInvoice]).
Mono accepts Idempotency-Key for every mutating endpoint where it makes sense (see [business.NewIdempotencyKey], which is set automatically in [business.Client.PreparePayment] / [business.Client.CreateSalaryRegistry]). For the remaining POST methods, if you are sure the endpoint is idempotent on Mono's side or are happy to live with duplicates, set WithUnsafeRetries(true).
Example ¶
За замовчуванням POST/PATCH без Idempotency-Key НЕ ретраяться, щоб 502 від балансера не створив дублікат операції. WithUnsafeRetries явно вмикає ретрай — лише коли впевнений, що endpoint ідемпотентний.
package main
import (
"os"
monobank "github.com/OlexiyOdarchuk/go-monobank-sdk"
"github.com/OlexiyOdarchuk/go-monobank-sdk/personal"
)
func main() {
cli := personal.New(os.Getenv("MONO_TOKEN"),
monobank.WithUnsafeRetries(true),
)
_ = cli
}
Output:
func WithUserAgent ¶ added in v1.2.0
WithUserAgent overrides the User-Agent the SDK sets on every request (default is UserAgent). Helpful so Mono support can tell your service apart from other SDK users:
cli := personal.New(token,
monobank.WithUserAgent("acme-receipts/2.1.0 "+monobank.UserAgent()),
)
An empty string is ignored (the SDK default is kept).
type RateLimiter ¶ added in v1.0.0
RateLimiter throttles outbound requests. Implementations must be safe for concurrent use. [Wait] blocks until a token is available or ctx is canceled.
The signature matches *golang.org/x/time/rate.Limiter.Wait — any existing limiter can be dropped in without a wrapper.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acquiring is the Go client for monobank's acquiring API (api.monobank.ua/api/merchant/*).
|
Package acquiring is the Go client for monobank's acquiring API (api.monobank.ua/api/merchant/*). |
|
Package auth provides authorizers for monobank API requests.
|
Package auth provides authorizers for monobank API requests. |
|
Package bank exposes the data types returned by the Open API (shared by the personal and corporate clients), plus the two unauthorized public endpoints: currency rates (/bank/currency) and the server key (/bank/sync).
|
Package bank exposes the data types returned by the Open API (shared by the personal and corporate clients), plus the two unauthorized public endpoints: currency rates (/bank/currency) and the server key (/bank/sync). |
|
Package business is the Go client for corp-api.monobank.ua, the "API for legal-entity accounts".
|
Package business is the Go client for corp-api.monobank.ua, the "API for legal-entity accounts". |
|
Package corporate is the client for monobank's Corporate Open API, including monoKEP (digital document signatures).
|
Package corporate is the client for monobank's Corporate Open API, including monoKEP (digital document signatures). |
|
Package currency provides typed ISO 4217 numeric currency codes that arrive in Mono payloads.
|
Package currency provides typed ISO 4217 numeric currency codes that arrive in Mono payloads. |
|
examples
|
|
|
acquiring
command
Command acquiring demonstrates the acquiring (merchant) API: create an invoice for 1.00 UAH, print its checkout URL, then poll until the invoice is paid, cancelled or expires.
|
Command acquiring demonstrates the acquiring (merchant) API: create an invoice for 1.00 UAH, print its checkout URL, then poll until the invoice is paid, cancelled or expires. |
|
business
command
Command business demonstrates the corp-api.monobank.ua client (юридичні особи / legal-entity API): list company accounts, fetch recent statement entries, and prepare a sample outgoing payment.
|
Command business demonstrates the corp-api.monobank.ua client (юридичні особи / legal-entity API): list company accounts, fetch recent statement entries, and prepare a sample outgoing payment. |
|
corporate
command
Command corporate demonstrates the full Corporate Open API access flow: bind the company's ECDSA key, request access on a client's behalf, wait for the client to approve, then fetch their ClientInfo using the granted request id.
|
Command corporate demonstrates the full Corporate Open API access flow: bind the company's ECDSA key, request access on a client's behalf, wait for the client to approve, then fetch their ClientInfo using the granted request id. |
|
installment
command
Command installment demonstrates monobank's «Pay-in-Parts» installment API against the sandbox: client validation → order creation → state polling → confirm-on-handover → final state.
|
Command installment demonstrates monobank's «Pay-in-Parts» installment API against the sandbox: client validation → order creation → state polling → confirm-on-handover → final state. |
|
jar
command
Command jar демонструє публічний lookup банок (jars) monobank: повна інформація по longJarId (з URL віджета банки) та резолв коротких share-посилань send.monobank.ua/<clientId> у longJarId.
|
Command jar демонструє публічний lookup банок (jars) monobank: повна інформація по longJarId (з URL віджета банки) та резолв коротких share-посилань send.monobank.ua/<clientId> у longJarId. |
|
personal
command
Command personal demonstrates the Personal Open API: fetch ClientInfo, list accounts/jars with typed currency, and print the last 7 days of transactions on the first account with a bucketed MCC category.
|
Command personal demonstrates the Personal Open API: fetch ClientInfo, list accounts/jars with typed currency, and print the last 7 days of transactions on the first account with a bucketed MCC category. |
|
webhook
command
Command webhook receives signed monobank personal-API webhooks and prints a one-line summary of each transaction.
|
Command webhook receives signed monobank personal-API webhooks and prints a one-line summary of each transaction. |
|
Package installment is the Go client for monobank's "Pay in installments" API (u2.monobank.com.ua).
|
Package installment is the Go client for monobank's "Pay in installments" API (u2.monobank.com.ua). |
|
Package jar is the client for two public (no-auth) monobank endpoints that return information about "jars":
|
Package jar is the client for two public (no-auth) monobank endpoints that return information about "jars": |
|
Package mcc provides typed helpers for ISO 18245 Merchant Category Codes that arrive in statement payloads.
|
Package mcc provides typed helpers for ISO 18245 Merchant Category Codes that arrive in statement payloads. |
|
Package money provides a typed representation of monetary amounts together with their currency — so "10 kopecks" and "10 cents" do not get conflated inside the same int64.
|
Package money provides a typed representation of monetary amounts together with their currency — so "10 kopecks" and "10 cents" do not get conflated inside the same int64. |
|
Package monobanktest provides helpers for testing code that uses monobank-sdk: a fake HTTP server with routing and ready builders for common scenarios, plus contract interfaces for each client (see the matching sub-package docs).
|
Package monobanktest provides helpers for testing code that uses monobank-sdk: a fake HTTP server with routing and ready builders for common scenarios, plus contract interfaces for each client (see the matching sub-package docs). |
|
Package personal is the client for monobank's Personal Open API: a single individual, authorized by one X-Token issued at https://api.monobank.ua/.
|
Package personal is the client for monobank's Personal Open API: a single individual, authorized by one X-Token issued at https://api.monobank.ua/. |
|
Package webhook provides server-side helpers for monobank webhooks: signature verification, payload parsing, a mountable http.Handler with automatic key rotation, plus an in-memory deduper that absorbs Mono's 60-second and 600-second redeliveries.
|
Package webhook provides server-side helpers for monobank webhooks: signature verification, payload parsing, a mountable http.Handler with automatic key rotation, plus an in-memory deduper that absorbs Mono's 60-second and 600-second redeliveries. |