wise

package module
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

wise-go

Go Reference Coverage Lint Go

The unofficial Go SDK for the Wise (TransferWise) API.

Wise publishes no official Go SDK. An OpenAPI spec exists, but it reflects Wise's wire types directly — float64 for money, untyped string IDs, inconsistent date formats. wise-go fills that gap with hand-written types that make invalid states hard to reach: monetary amounts as int64 cents (never float64), branded IDs that prevent mixing ProfileID with BalanceID at compile time, and behavioral error classification so you can retry on intent rather than string-matching status codes.

Status: active development (v0.16.0). The core transfer flow is implemented end-to-end — profiles, users, balances, transactions and statement file downloads (CSV/PDF/XLSX/CAMT.053/MT940/QIF), exchange rates, quotes (with paymentOptions fees), recipients, transfers (create / get / list / cancel / fund / receipt / MT103 payout info / payments list / US combined receipt / Indian NOC), third-party (originator) transfers, delivery estimates, and transfer-requirements validation — plus webhook subscriptions with typed event decoding, webhook signature verification, programmatic SCA challenge clearing (one-time-token endpoints), observability hooks, and balance lifecycle management. See FEATURES.md for the honest inventory and ROADMAP.md for what's next.

Design story: I needed a Go SDK for Wise. Nobody built one.

Table of Contents

Features

  • Money is never float64 — Every amount is int64 minor units (cents). No IEEE-754 representation error, ever.
  • Branded IDs prevent entity-mixing bugs — ProfileID, BalanceID, TransactionID, TransferID, RecipientID, and QuoteID are distinct types; passing one where another belongs is a compile error.
  • Automatic retries with backoff — Exponential backoff with jitter on 429 (rate limit), 5xx, and network errors via go-retry, honoring Wise's Retry-After (capped at the configured max delay). Auth, not-found, and client errors fail immediately.
  • Typed, classifiable errors — AuthError, RateLimitError (with parsed Retry-After), NotFoundError, ServerError. Each carries its Wise API detail and implements ErrorCode() / ErrorFamily() / IsRetryable() from go-error-family.
  • Two-layer type system — Raw wire types live in internal/raw; result types expose clean Go with Money value objects and branded Currency. The mapping is the only bridge.
  • Write operations — create quotes (authenticated and unauthenticated), recipients, and transfers; fund transfers from a balance; cancel transfers; validate transfer requirements; fetch delivery estimates.
  • SCA challenge support — SCA-protected endpoints (e.g. balance statements for UK/EEA profiles) surface as *SCAChallengeError with the one-time approval token; complete the challenge with WithSCAApprovalToken and retry. See SCA.
  • Statement & receipt downloads — balance statements in CSV/PDF/XLSX/CAMT.053/MT940/QIF, transfer receipts (PDF), and MT103 payout proofs returned as raw bytes with client-side validation.
  • Profile activity feed — page through a profile's activity feed (transfers, card payments, deposits, conversions) with ListActivities; served to a personal API token without SCA, even while statements are challenge-blocked. Display-oriented visibility, not the statement ledger. See Activity feed.
  • Webhook subscriptions & typed events — register, list, and delete profile webhook subscriptions, then parse deliveries with ParseWebhookEvent: typed payloads for transfer state changes, payout failures, and balance credits; unknown event types never break your handler.
  • Identify your integration — WithUserAgent replaces Go's default client agent with your own (bank-sync/1.0), as Wise recommends.
  • Tolerant timestamp handling — Wise emits four different timestamp formats. One parser accepts them all (zoneless = UTC), and outgoing query timestamps are normalized to UTC Z (Wise rejects zone offsets with 422).
  • Sandbox support — One-line switch to the Wise sandbox environment.
  • Few, focused dependencies — go-retry, go-branded-id, go-error-family, and samber/oops for error construction, plus the Money bridge.
  • Errors with a stack trace — Every contextual wrap the SDK adds is a samber/oops layer: the message text is unchanged, %+v prints where it happened. See Where an error happened.

Installation

go get github.com/larsartmann/wise-go

Requires Go 1.27 or later with the jsonv2 experiment enabled. The go-branded-id and go-error-family dependencies use encoding/json/v2, which only builds when the experiment is on:

export GOEXPERIMENT=jsonv2   # add to ~/.bashrc / ~/.zshrc for persistence

Every invocation of the Go toolchain (go build, go test, go vet, go mod tidy) needs this variable set. On NixOS, nix develop sets it for you (see flake.nix).

Quick Start

package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/larsartmann/wise-go"
)

func main() {
    client := wise.New("your-api-key")

    ctx := context.Background()

    // Validate your API key
    if err := client.Authenticate(ctx); err != nil {
        log.Fatal(err)
    }

    // List profiles
    profiles, err := client.ListProfiles(ctx)
    if err != nil {
        log.Fatal(err)
    }

    // List balances for the first profile (kept outside the loop so the
    // transaction query below can reference it)
    balances, err := client.ListBalances(ctx, profiles[0].ID)
    if err != nil {
        log.Fatal(err)
    }

    for _, p := range profiles {
        fmt.Printf("%s (%s)\n", p.Name, p.Type)

        // List balances for each profile
        profileBalances, err := client.ListBalances(ctx, p.ID)
        if err != nil {
            log.Fatal(err)
        }

        for _, b := range profileBalances {
            fmt.Printf("  %s %s: %d cents\n", b.Currency, b.Name, b.Amount.Cents)
        }
    }

    // List transactions for a balance within a date range
    resp, err := client.ListTransactions(ctx, wise.ListTransactionsRequest{
        ProfileID: profiles[0].ID,
        BalanceID: balances[0].ID,
        Currency:  wise.Currency("EUR"),
        From:      time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),
        To:        time.Date(2025, 12, 31, 23, 59, 59, 0, time.UTC),
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, tx := range resp.Transactions {
        sign := "+"
        if tx.Total.Cents < 0 {
            sign = ""
        }

        fmt.Printf("%s%d cents — %s (%s)\n", sign, tx.Total.Cents, tx.Description, tx.Type)
    }
}

Configuration

// Sandbox environment
client := wise.New("sandbox-key", wise.WithSandbox())

// Custom base URL
client := wise.New("key", wise.WithBaseURL("https://custom.proxy.example.com"))

// Custom timeout (default: 30s)
client := wise.New("key", wise.WithTimeout(10*time.Second))

// Custom retry policy (default: 3 retries, 100ms–5s backoff)
client := wise.New("key", wise.WithRetry(5, time.Second, 30*time.Second))

// Custom HTTP client
client := wise.New("key", wise.WithHTTPClient(&http.Client{Timeout: 15*time.Second}))

// Compose multiple options
client := wise.New("key",
    wise.WithSandbox(),
    wise.WithTimeout(15*time.Second),
    wise.WithRetry(5, time.Second, 30*time.Second),
)

Retry composition — multiply carefully. The SDK already retries the transient class (429, 5xx, network) with backoff and Retry-After honoring; a consumer-side retry loop around SDK calls multiplies with it (5 SDK attempts × 3 loop passes = 15 hits per logical operation, each backing off). Set WithRetry to the total attempts you want and let the SDK own the delays; if you loop anyway, stop when the error is not retryable (IsRetryable is absent on Rejection-family errors like auth and 4xx) so permanent failures fail fast instead of pacing out.

Observability
// WithLogger observes every HTTP attempt, retries included — latency
// tracking and retry visibility without wrapping the transport.
client := wise.New("key", wise.WithLogger(wise.RequestLogFunc(func(e wise.RequestLog) {
    slog.Info("wise request",
        "method", e.Method, "url", e.URL, "status", e.Status,
        "duration", e.Duration, "attempt", e.Attempt, "err", e.Error)
})))

// Per-request correlation ID: one traceable X-External-Correlation-Id per
// logical operation, overriding the client-wide WithCorrelationID value.
ctx := wise.WithRequestCorrelationID(ctx, "bank-sync-2026-08-21-run-42")
_, err := client.ListTransfers(ctx, req)

RequestLog.Attempt is 1-based; a value above 1 means the request was retried.

OpenTelemetry

The SDK ships zero telemetry dependencies by design (it is a library, not a service); WithHTTPClient (transport seam) and WithLogger (per-attempt metadata) are the OpenTelemetry surface. The bridges below were verified end-to-end against otelhttp v0.72.0 / otel v1.47.0.

Traces — wrap the transport with otelhttp.NewTransport: every HTTP attempt (retries included) becomes a client span with W3C trace context injected, nested under whatever span is active in the context.Context you pass to SDK calls:

tp := sdktrace.NewTracerProvider() // add your exporter here
defer func() { _ = tp.Shutdown(context.Background()) }()
otel.SetTracerProvider(tp)

client := wise.New("api-token",
    wise.WithHTTPClient(&http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)}))

ctx, span := otel.Tracer("app").Start(ctx, "bankSync.fetchRate")
defer span.End()

rate, err := client.GetExchangeRate(ctx, "EUR", "USD", time.Time{})
if err != nil {
    span.RecordError(err)
    span.SetStatus(codes.Error, err.Error())
}

A client span ends when the response body closes — the SDK closes it after decoding, so attempt spans complete promptly. Retried attempts appear as separate sibling spans; the transport span classifies the HTTP outcome (a 429 attempt ends with Error status), while Wise's typed API errors are yours to record on the operation span, as above. For Wise-side correlation across its own systems, keep using WithRequestCorrelationID — the two are complementary.

Metrics — bridge WithLogger to an OTel meter. Skip RetryAfterDelay > 0 entries: they are retry-delay decisions emitted between attempts, not exchanges, and counting them would double-count throttled operations:

meter := otel.Meter("wise-go")
attempts, _ := meter.Int64Counter("wise.http.attempts")
duration, _ := meter.Float64Histogram("wise.http.duration", metric.WithUnit("s"))

otelBridge := wise.RequestLogFunc(func(e wise.RequestLog) {
    if e.RetryAfterDelay > 0 {
        return // delay decision, not an HTTP exchange
    }
    attrs := metric.WithAttributes(attribute.String("http.request.method", e.Method))
    attempts.Add(context.Background(), 1, attrs)
    duration.Record(context.Background(), e.Duration.Seconds(), attrs)
})

client := wise.New("api-token", wise.WithLogger(otelBridge))
mTLS (client-certificate authentication)

Wise serves compliance-heavy integrations from dedicated mTLS endpoints (api-mtls.wise.com, sandbox api-mtls.wise-sandbox.com) that authenticate the client certificate in addition to the API token. The SDK supports this without a dedicated option: swap the base URL and inject a TLS-configured http.Client via WithHTTPClient:

clientCert, err := tls.LoadX509KeyPair("client-cert.pem", "client-key.pem")
if err != nil {
    log.Fatal(err)
}

transport := &http.Transport{
    TLSClientConfig: &tls.Config{
        Certificates: []tls.Certificate{clientCert},
        MinVersion:   tls.VersionTLS12,
    },
}

client := wise.New("api-token",
    wise.WithBaseURL("https://api-mtls.wise.com"),
    wise.WithHTTPClient(&http.Client{Transport: transport, Timeout: 30 * time.Second}),
)

The same WithHTTPClient pattern covers custom root CAs, corporate proxies, and connection-pool tuning; retries, logging, and typed errors work unchanged.

Injected transports see everything. A custom Transport (or http.RoundTripper middleware) observes the Authorization header and the full request/response bodies — bank details, balances, transfer amounts. Whatever you log or forward from that layer must be redacted accordingly; the SDK's own RequestLog deliberately carries metadata only (method, URL, status, duration, attempt), never bodies or tokens.

API Reference

Authentication
// Validate API key (calls ListProfiles internally, rides the retry ladder)
err := client.Authenticate(ctx)

// Readiness probe: authenticated ListProfiles through the retry executor.
// A *RateLimitError proves reachability (answered, throttled); an *AuthError
// proves reachability with bad credentials; worst case spends the full
// default budget (4 attempts x 30s + honored Retry-After waits, up to
// 2 min 15 s) unless ctx carries a deadline. Not a cheap liveness check.
err = client.Health(ctx)

// Fail-fast credential check: a single authenticated round-trip — the
// retry ladder is disabled, the typed errors match Health. Use at
// startup; use Health for readiness polling.
err = client.VerifyCredentials(ctx)
Profiles
profiles, err := client.ListProfiles(ctx)
// []Profile{
//   {ID: 12345, Type: ProfileTypePersonal, Name: "John Doe", Email: "john@example.com", CreatedAt: ...},
//   {ID: 67890, Type: ProfileTypeBusiness, Name: "Acme Corp", Email: "billing@acme.com", CreatedAt: ...},
// }
Activity feed
page, err := client.ListActivities(ctx, wise.ListActivitiesRequest{
    ProfileID: profileID,
    Size:      100, // 1 to 100
})
for _, activity := range page.Activities {
    if activity.PrimaryAmount.Present {
        fmt.Println(activity.CreatedOn.Format("2006-01-02"), activity.Type,
            activity.PrimaryAmount.Amount)
    }
}

Pass page.NextCursor as Cursor to read the next page; it is empty on the last page. Since / Until bound the window on creation time, ResourceType and Status are optional filters.

The feed is real-time visibility, not the statement ledger:

  • It is profile-scoped, not balance-scoped: a two-legged row does not say which balance moved.
  • Amounts arrive as Wise's display text. ActivityAmount.Amount is set only when Present is true and Text always keeps the raw value; Credit marks money in.
  • Fees are not itemized, so rows can differ from the statement where the two overlap.

Read ListStatements for the book of record and the feed for what happened recently. Unlike statements, the endpoint is not SCA-protected and answers a personal API token.

Users
// The account behind the API token — the identity of ListProfiles' userId values
me, err := client.GetMe(ctx)
// me.ID, me.Name, me.Email, me.Active
// me.Details → *UserDetails (nil when Wise has none on file):
//   FirstName, LastName, PhoneNumber, DateOfBirth (UTC date; zero when unset),
//   Occupation, Avatar, PrimaryAddress, Address (*UserAddress)

// A user by ID — personal tokens may only read their own user
user, err := client.GetUser(ctx, userID)

Details and Details.Address are pointers: nil means Wise has nothing on file, not an error. DateOfBirth is parsed from Wise's date-only wire format as a UTC midnight time.Time.

Balances
// List visible, non-investment balances for a profile
balances, err := client.ListBalances(ctx, profileID)
// []Balance{
//   {ID: 100, Currency: "EUR", Type: BalanceTypeStandard, Name: "Main Account", Amount.Cents: 123456, ...},
// }

// Get a specific balance by ID (direct per-balance endpoint)
balance, err := client.GetBalance(ctx, profileID, balanceID)

// Open a new balance (savings balances require a name)
created, err := client.CreateBalance(ctx, wise.CreateBalanceRequest{
    ProfileID: profileID,
    Currency:  wise.Currency("USD"),
    Type:      wise.BalanceTypeSavings,
    Name:      "Vacation",
})

// Profile-wide funds overview converted to one currency
total, err := client.GetTotalFunds(ctx, profileID, wise.Currency("EUR"))
// total.Worth     → cash + invested portfolio valuation (Money)
// total.Available → cash + approved overdraft limit (Money)

ListBalances filters to Visible: true and InvestmentState == "NOT_INVESTED" only. GetBalance reads the direct per-balance endpoint (GET /v4/profiles/{id}/balances/{id}) and does not filter — hidden and invested balances are retrievable individually even though ListBalances drops them.

Transactions
resp, err := client.ListTransactions(ctx, wise.ListTransactionsRequest{
    ProfileID: wise.NewProfileID(12345),
    BalanceID: wise.NewBalanceID(100),
    Currency:  wise.Currency("EUR"),
    From:      time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),
    To:        time.Date(2025, 1, 31, 23, 59, 59, 0, time.UTC),
    Type:      wise.StatementTypeFlat, // optional statement layout (COMPACT or FLAT)
})
// resp.Transactions → []Transaction

Transaction type classification — The SDK maps Wise detail types to Go enums:

Wise details.type TransactionType Note
CARD_PAYMENT TransactionTypeCard
CARD_REFUND (amount > 0) TransactionTypeRefund
CARD_REFUND (amount ≤ 0) TransactionTypeCard
TRANSFER TransactionTypeTransfer
PAYMENT TransactionTypePayment
CONVERSION, EXCHANGE TransactionTypeExchange
FEE TransactionTypeFee
Other (amount > 0) TransactionTypeCredit Default for positive amounts
Other (amount ≤ 0) TransactionTypeDebit Default for negative amounts

Amount semantics:

  • Amount.Cents — absolute value (always positive)
  • Total.Cents — signed value (negative for debits, positive for credits)
  • RunningBalance.Cents — the balance after this transaction (signed int64)
  • Exchange — *TransactionExchange with from/to amounts and rate; nil for non-conversion transactions
  • All amounts use int64 minor units (cents) to avoid IEEE 754 floating-point errors

Date timezone: Transaction.Date is in UTC. Wise statement dates carry no timezone; the SDK interprets them as UTC via time.Parse. Convert explicitly before comparing against local-time values to avoid off-by-one-day errors at boundaries.

Validation — ListTransactions rejects invalid requests before hitting the API:

  • Empty Currency → "wise.transactions.invalid_request: currency is required"
  • From after To → "wise.transactions.invalid_request: intervalStart must not be after intervalEnd"
Statements

GetStatement downloads a balance statement as a file and returns its raw bytes — for imports, archival, or PDF rendering. Use ListTransactions for the typed JSON statement.

pdf, err := client.GetStatement(ctx, wise.GetStatementRequest{
    ProfileID: profileID,
    BalanceID: balanceID,
    Currency:  wise.Currency("EUR"),
    From:      intervalStart, // UTC
    To:        intervalEnd,   // UTC
    Type:      wise.StatementTypeFlat,  // optional statement layout (COMPACT or FLAT)
    Locale:    "de",                      // optional 2-char statement language
    Format:    wise.StatementFormatPDF,
})

Six formats: StatementFormatCSV, StatementFormatPDF (includes Wise branding), StatementFormatXLSX (Excel), StatementFormatCAMT (CAMT.053 XML), StatementFormatMT940, and StatementFormatQIF. Unknown formats are rejected client-side. The interval rules mirror ListTransactions; the interval must not exceed 469 days (Wise limit) — longer periods are rejected client-side with an actionable error, so split them into multiple requests. Locale (2-character language code) localizes column headers and descriptions. Like the JSON statement, the endpoint is SCA-protected for UK/EEA profiles — see SCA.

Transfer receipts & payout paperwork

GetTransferReceipt downloads the branded confirmation receipt for a paid-out transfer as raw PDF bytes. Wise answers 404 until the transfer reached outgoing_payment_sent — treat *wise.NotFoundError as "no receipt (yet)", not a hard failure. Unlike statements, the endpoint is not SCA-protected.

pdf, err := client.GetTransferReceipt(ctx, transferID)

GetTransferPayoutInfo returns the banking-partner proof of payment, including the SWIFT MT103 message (MT103 is *string, nil for non-SWIFT corridors):

info, err := client.GetTransferPayoutInfo(ctx, transferID)

The rest of the payout paperwork set, all raw-byte downloads unless noted:

// Completed funding payments of a transfer ([]TransferPayment)
payments, err := client.ListTransferPayments(ctx, transferID)

// US combined receipt (transfer confirmation + funding proof in one PDF;
// required by some US institutions). 404 = does not exist yet.
usPdf, err := client.GetUSCombinedReceipt(ctx, transferID)

// Indian FIRC no-objection certificate. 404 before payout = not issued yet.
noc, err := client.GetTransferNOC(ctx, transferID)
Quotes
// Authenticated quote locks the rate for 30 minutes and can back a transfer.
// preferredPayIn=BALANCE keeps fees consistent when funding from a balance.
quote, err := client.CreateQuote(ctx, profileID, wise.CreateQuoteRequest{
    SourceCurrency: wise.Currency("EUR"),
    TargetCurrency: wise.Currency("USD"),
    SourceAmount:   &wise.Money{Cents: 100_000, Currency: wise.Currency("EUR")},
    PreferredPayIn: wise.PayInBalance,
    PayOut:         wise.PayOutBankTransfer,
})
// quote.PaymentOptions → per pay-in/pay-out fee breakdown + estimated delivery
// quote.Notices → messages to show the user (BLOCKED means: don't use it)

// Fetch an existing quote
quote, err = client.GetQuote(ctx, profileID, quote.ID)

// Illustrative quote without a user token (no ID, cannot back a transfer)
quote, err = client.CreateUnauthenticatedQuote(ctx, req)
Recipients
recipient, err := client.CreateRecipient(ctx, wise.CreateRecipientRequest{
    ProfileID:         profileID,
    Currency:          wise.Currency("GBP"),
    Type:              "sort_code",
    AccountHolderName: "Jane Doe",
    Details: map[string]string{
        "sortCode":      "040075",
        "accountNumber": "37778842",
    },
})

recipient, err = client.GetRecipient(ctx, recipient.ID)
recipients, err := client.ListRecipients(ctx, wise.ListRecipientsRequest{
    ProfileID: profileID,
})

ListRecipients follows Wise's page cursor and returns every recipient of the profile (an empty, non-nil slice when there is none). Recipient.AccountHolderName comes from Wise's name.fullName field.

Recipient.Details is a map[string]string; required keys vary by currency and route — use the account-requirements endpoint to discover them per corridor (the map is flat: corridors that require nested values such as an address object are outside what the map can express today):

requirements, err := client.GetQuoteAccountRequirements(ctx, wise.QuoteAccountRequirementsRequest{
    QuoteID: quote.ID,
})

// Second pass: when a returned field is flagged RefreshRequirementsOnChange,
// submit the partial form with that field set and Wise returns the revised
// field set for the route (e.g. legalEntityType reveals further fields).
requirements, err = client.RefreshQuoteAccountRequirements(ctx, wise.RefreshQuoteAccountRequirementsRequest{
    QuoteID: quote.ID,
    Recipient: wise.CreateRecipientRequest{
        Currency: quote.TargetCurrency,
        Type:     requirements[0].Type,
        Details:  map[string]string{"legalEntityType": "PRIVATE"},
    },
})
Exchange rates
// Current rate
rate, err := client.GetExchangeRate(ctx, wise.Currency("EUR"), wise.Currency("USD"), time.Time{})
// Historical rate (pass a time.Time; UTC recommended)
rate, err = client.GetExchangeRate(ctx, wise.Currency("EUR"), wise.Currency("USD"), someTime)
Transfers
transfers, err := client.ListTransfers(ctx, wise.ListTransfersRequest{
    ProfileID: wise.NewProfileID(12345),                          // optional, defaults to personal profile
    From:      time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),       // optional createdDateStart
    To:        time.Date(2025, 12, 31, 23, 59, 59, 0, time.UTC),  // optional createdDateEnd
    Status:    []wise.TransferStatus{wise.TransferStatusDelivered}, // optional status filter
})
// transfers → []wise.Transfer (auto-paginated, 100 per page)

Unlike balance statements, GET /v1/transfers is not SCA-protected and is available to personal API tokens in all regions — it is the reliable source for outgoing transfer history (amount, fees via rate, status, recipient, reference, timestamps). It does not include deposits, card payments, conversions, or interest; those remain statement-only.

TransferStatus is an open string enum: documented lifecycle values are provided as constants (TransferStatusDelivered, TransferStatusCancelled, …), and unknown values from Wise pass through unchanged.

Transfer.Created is parsed tolerantly (RFC3339 or Wise's space-separated format; zoneless values are UTC).

Funding a transfer from the profile's balance:

funding, err := client.FundTransfer(ctx, profileID, transferID)
// funding.Status → wise.FundingStatusCompleted / FundingStatusCreated / FundingStatusRejected
// funding.BalanceTransactionID → the debit applied to the balance (BALANCE funding)

A rejected funding (e.g. FundingErrorCodeBalanceInsufficientFunds) is a successful API call that declined — top up the balance and call FundTransfer again. ErrorCode is an open enum: known codes are constants, unknown codes pass through. The endpoint is SCA-protected for UK/EEA profiles.

Moving money on behalf of a third-party originator — your own quote funds the transfer, but the compliance data names the real originator. Reuse the same Originator.Reference for every transfer of one originator (Wise keys compliance on it); OriginalTransferID is your idempotency key:

transfer, err := client.CreateThirdPartyTransfer(ctx, wise.CreateThirdPartyTransferRequest{
    ProfileID:          profileID,
    OriginalTransferID: "our-originator-transfer-correlation-id",
    TargetAccount:      recipientID,
    QuoteID:            quoteID,
    Reference:          "INV-2026-014",
    Originator: wise.Originator{
        LegalEntityType: wise.OriginatorLegalEntityTypePrivate,
        Reference:       "originator-ref-42",
        Name:            wise.OriginatorName{GivenName: "Ana", FamilyName: "Martins"},
        DateOfBirth:     time.Date(1988, 4, 12, 0, 0, 0, 0, time.UTC),
        Nationality:     "PT",
        Address: wise.OriginatorAddress{
            FirstLine: "Rua das Flores 12", City: "Lisboa", CountryCode: "PT", PostCode: "1200-192",
        },
    },
})
// fetch it back with client.GetThirdPartyTransfer(ctx, profileID, transferID)
Core transfer flow: quote → recipient → transfer

The 1% Pareto core. A consumer with GetProfile, CreateQuote, CreateRecipient, and CreateTransfer can move money end-to-end:

ctx := context.Background()

// 1. Quote — locks the rate for 30 minutes.
//    PreferredPayIn=BALANCE keeps quote fees consistent with transfer fees when
//    funding from a multi-currency balance.
quote, err := client.CreateQuote(ctx, profileID, wise.CreateQuoteRequest{
    SourceCurrency: wise.Currency("EUR"),
    TargetCurrency: wise.Currency("USD"),
    SourceAmount:   &wise.Money{Cents: 100_000, Currency: wise.Currency("EUR")},
    PreferredPayIn: wise.PayInBalance,
    PayOut:         wise.PayOutBankTransfer,
})
if err != nil {
    log.Fatal(err)
}

// A BLOCKED notice means this quote must not back a transfer.
for _, n := range quote.Notices {
    if n.Type == wise.QuoteNoticeTypeBlocked {
        log.Fatalf("quote blocked: %s", n.Text)
    }
}

// 2. Recipient — a bank account to send to. Required details vary by currency
//    and route; the account-requirements endpoint discovers them per corridor.
recipient, err := client.CreateRecipient(ctx, wise.CreateRecipientRequest{
    ProfileID:         profileID,
    Currency:          wise.Currency("GBP"),
    Type:              "sort_code",
    AccountHolderName: "Jane Doe",
    Details: map[string]string{
        "sortCode":      "040075",
        "accountNumber": "37778842",
    },
})
if err != nil {
    log.Fatal(err)
}

// 2b. Optional: discover required details before creating the transfer.
//     Fields flagged RefreshRequirementsOnChange mean re-calling this once the
//     field is populated reveals lower-level required fields.
requirements, err := client.ValidateTransferRequirements(ctx, wise.ValidateTransferRequirementsRequest{
    TargetAccount: recipient.ID,
    QuoteID:       quote.ID,
})
if err != nil {
    log.Fatal(err)
}

// Cross-reference the response against your prepared request to learn which
// required fields are still unsatisfied (select choices are checked against
// their allowed values):
transferReq := wise.CreateTransferRequest{
    QuoteID:               quote.ID,
    TargetAccount:         recipient.ID,
    CustomerTransactionID: wise.NewCustomerTransactionID("22244c35-9fe8-4c32-b7fd-d05c2a7734bf"),
}
if missing := wise.MissingTransferDetails(requirements, transferReq); len(missing) > 0 {
    log.Fatalf("transfer details still missing: %v", missing)
}

// 3. Transfer — customerTransactionId is your idempotency key (a UUID).
//    Reusing it with the same quote + targetAccount returns the existing
//    transfer instead of creating a duplicate.
transfer, err := client.CreateTransfer(ctx, wise.CreateTransferRequest{
    QuoteID:               quote.ID,
    TargetAccount:         recipient.ID,
    CustomerTransactionID: wise.NewCustomerTransactionID("22244c35-9fe8-4c32-b7fd-d05c2a7734bf"),
})
if err != nil {
    log.Fatal(err)
}

// 4. Fund — debit the balance to trigger processing of the payout. This is the
//    final money-movement step; until it succeeds the transfer stays
//    waiting_for_funds. An underfunded balance is not an error return but a
//    rejected result — top up and call FundTransfer again.
funding, err := client.FundTransfer(ctx, profileID, transfer.ID)
if err != nil {
    log.Fatal(err)
}
if funding.Status == wise.FundingStatusRejected {
    log.Fatalf("funding rejected (%s): %s", funding.ErrorCode, funding.ErrorMessage)
}

// 5. Track — the delivery estimate for the now-funded transfer.
estimate, err := client.GetDeliveryEstimate(ctx, transfer.ID, "Europe/Berlin")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("expected arrival: %s\n", estimate.EstimatedDeliveryDate)

// 6. Cancel — only possible before the transfer is processed.
cancelled, err := client.CancelTransfer(ctx, transfer.ID)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("cancelled: %s\n", cancelled.Status)

Quote.PaymentOptions lists every pay-in/pay-out combination with its fee breakdown (Fee.Total is the value to display) and estimated delivery; a QuoteNotice of type BLOCKED means the quote must not be used to create a transfer.

Multi-Currency Account & bank details
// The profile's account container: holder of the currency balances
account, err := client.GetMultiCurrencyAccount(ctx, profileID)
// account.RecipientID → the account's own recipient entry

// One set of receiving bank details by its own ID (the 2027Q1 surface;
// the old profile-wide list endpoint was removed by Wise)
detail, err := client.GetBankAccountDetails(ctx, detailsID)
// AccountDetails{State: AccountDetailsStateActive, Country: "GB", Identification: ...}

Two patterns worth knowing:

  • Top up via transfer — MultiCurrencyAccount.RecipientID is a real recipient. Create a transfer to it (from an external-funded quote) and the matching currency balance gets credited: the standard way to move money into the Multi-Currency Account.
  • Identification is a typed oneOf — detail.Identification carries exactly one of BE (IBAN), GB (sort code + account number), or US (routing + account number); anything else from the wire is surfaced as a corruption error. Ordering new details still goes through Wise's account-details-orders endpoint (not in the SDK yet).
Currencies
// Public reference data — no authentication required
currencies, err := client.ListCurrencies(ctx)
// []CurrencyInfo{
//   {Code: "EUR", Symbol: "€", Name: "Euro", CountryKeywords: [...], SupportsDecimals: true},
// }

Populate currency pickers and validate corridor choices against Wise's list (code, symbol, name, country keywords, decimal support).

Mocking the Client

The SDK returns concrete types (*wise.Client, []wise.Profile, etc.), not interfaces. This follows Go's "accept interfaces, return structs" proverb: consumers define narrow interfaces for the subset of methods they actually use, keeping mocks minimal.

// Define a narrow interface in your package.
type ProfileLister interface {
    ListProfiles(ctx context.Context) ([]wise.Profile, error)
}

// Your service depends on the interface, not *wise.Client.
type Service struct {
    profiles ProfileLister
}

// In tests, implement the interface with a stub.
type mockProfileLister struct {
    profiles []wise.Profile
    err      error
}

func (m *mockProfileLister) ListProfiles(ctx context.Context) ([]wise.Profile, error) {
    return m.profiles, m.err
}

Request Middleware

WithHTTPClient accepts any type implementing the Doer interface (Do(req *http.Request) (*http.Response, error)). *http.Client satisfies this implicitly. Inject a custom client to add tracing, logging, or mTLS at the transport layer:

type loggingTransport struct {
    next http.RoundTripper
}

func (t *loggingTransport) RoundTrip(req *http.Request) (*http.Response, error) {
    start := time.Now()
    resp, err := t.next.RoundTrip(req)
    log.Printf("%s %s -> %d (%s)", req.Method, req.URL, resp.StatusCode, time.Since(start))
    return resp, err
}

Then inject it via WithHTTPClient:

client := wise.New("key", wise.WithHTTPClient(&http.Client{
    Transport: &loggingTransport{next: http.DefaultTransport},
}))

Dependency Injection & Health Checks

wise-go is a plain-Go library: it imports no DI framework and owns no resources (no goroutines, no Shutdown). That makes it a drop-in for any composition root. Below is the compile-verified recipe for samber/do v2, including the two-line adapter that plugs the readiness probe into do's health-check interface:

package main

import (
    "context"
    "log/slog"
    "os"

    "github.com/larsartmann/wise-go"
    "github.com/samber/do/v2"
)

// healthAdapter adapts the SDK's Health method to samber/do's health-check
// interface. The adapter is needed because the SDK method is named Health,
// not HealthCheck (wise-go deliberately imports no DI framework).
type healthAdapter struct{ client *wise.Client }

func (h healthAdapter) HealthCheck(ctx context.Context) error {
    return h.client.Health(ctx)
}

func main() {
    injector := do.New()

    do.Provide(injector, func(i do.Injector) (*wise.Client, error) {
        return wise.New(os.Getenv("WISE_API_KEY"), wise.WithSandbox()), nil
    })

    do.ProvideNamed(injector, "wise.health", func(i do.Injector) (do.HealthcheckerWithContext, error) {
        return healthAdapter{client: do.MustInvoke[*wise.Client](i)}, nil
    })

    client, err := do.Invoke[*wise.Client](injector)
    if err != nil {
        slog.Error("wise client unavailable", "err", err)
        os.Exit(1)
    }

    checker := healthAdapter{client: client}
    if err := checker.HealthCheck(context.Background()); err != nil {
        slog.Warn("wise API not ready", "err", err)
    }
}

Health is a readiness probe, not a cheap liveness check: it runs an authenticated ListProfiles through the retry executor, so a *RateLimitError means the API answered under throttling, an *AuthError means bad credentials, and the worst case spends the full retry budget (4 attempts x 30s plus honored Retry-After waits — 2 min 15 s). Bound it with a deadline if your orchestrator expects sub-second probes:

// Bound the probe: without a deadline, Health may spend the full retry
// budget under sustained throttling; the deadline aborts mid-backoff
// because the retry delay is context-aware.
probeCtx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()

if err := client.Health(probeCtx); err != nil {
    slog.Warn("wise API not ready", "err", err)
}

Which probe when: VerifyCredentials(ctx) for one-shot startup validation (single round-trip, retry ladder disabled, same typed errors), Health (ctx-bounded) for readiness polling that should ride the retry budget. The HealthCheck alias stayed unshipped — the two-line adapter above is the whole cost of bridging to do.HealthcheckerWithContext.

Error Handling

The SDK returns typed errors you can match with errors.AsType (Go 1.26+):

import "errors"

balances, err := client.ListBalances(ctx, profileID)
if err != nil {
    if rl, ok := errors.AsType[*wise.RateLimitError](err); ok {
        fmt.Printf("rate limited (scope: %s), retry after %s\n", rl.RateLimitedBy, rl.RetryAfter)
    } else if sca, ok := errors.AsType[*wise.SCAChallengeError](err); ok {
        fmt.Printf("SCA approval required (token issued: %t)\n", sca.TwoFAApprovalToken() != "")
    } else if auth, ok := errors.AsType[*wise.AuthError](err); ok {
        fmt.Printf("auth failed: %s\n", auth.Message)
    } else if nf, ok := errors.AsType[*wise.NotFoundError](err); ok {
        fmt.Printf("not found: %s\n", nf.Message)
    } else if br, ok := errors.AsType[*wise.BadRequestError](err); ok {
        fmt.Printf("rejected (%d): %s\n", br.StatusCode, br.Message)
    } else if srv, ok := errors.AsType[*wise.ServerError](err); ok {
        fmt.Printf("server error (%d): %s\n", srv.StatusCode, srv.Message)
    } else if apiErr, ok := errors.AsType[*wise.APIError](err); ok {
        fmt.Printf("API error (%d): %s\n", apiErr.StatusCode, apiErr.Message)
    }
}
HTTP Status Error Type Retried?
400 BadRequestError No
401, 403 AuthError No
403 + Wise 2FA headers SCAChallengeError No
404 NotFoundError No
429 RateLimitError Yes
5xx ServerError Yes
Network error Wrapped error Yes

Mapper failures (unparseable timestamps, invalid currency codes in a response) carry Corruption classification — permanent, not retryable — so a blanket "retry on transient" wrapper fails fast instead of looping.

Where an error happened

The SDK adds context with samber/oops. Each contextual wrap it adds ("list balances for profile 123: ...") is an oops.OopsError layer that carries a stack trace. Error() and %v print the same message they always did; %+v adds the stack, and oops.AsOops exposes the layers when you want to read them:

if oopsErr, ok := oops.AsOops(err); ok {
    fmt.Println(oopsErr.Stacktrace())
}

Matching is unaffected: errors.Is, errors.AsType and APIError.HasCode see through the wrap layers exactly as before.

How to match an error

Three matchers, one decision tree:

  1. Need the error's fields? (status code, RetryAfter, rate-limit scope, the SCA token) — extract the type with errors.AsType.
  2. Branching on a Wise granular code with a curated sentinel? (not.valid, resource_not_found, rate_limit_exceeded, ...) — match by value with errors.Is. This works through any wrap chain — yours (fmt.Errorf with %w) and the SDK's own context wraps ("create transfer for quote ...: ...") — and never breaks the match.
  3. Any other granular code? (the open enum — Wise adds codes over time) — branch with the package-level wise.HasCode(err, code) or read the first code with wise.Code(err). Both see through every wrap chain and every typed error, so no type extraction comes first.
transfers, err := client.ListTransfers(ctx, wise.ListTransfersRequest{
    ProfileID: wise.NewProfileID(12345), // optional, defaults to personal profile
})
if err != nil {
    // Curated Wise codes match by value through any wrap chain:
    if errors.Is(err, wise.ErrRateLimitExceeded) {
        fmt.Println("wise throttled us; back off and retry")
    } else if errors.Is(err, wise.ErrResourceNotFound) {
        fmt.Println("resource gone; refresh before retrying")
    }

    // Any code (curated or not) branches on the structured details. The
    // status drives the type — here a 400 is *BadRequestError — and
    // HasCode/Details are promoted onto every typed error:
    if br, ok := errors.AsType[*wise.BadRequestError](err); ok {
        for _, detail := range br.Details {
            fmt.Printf("wise says %q: %s\n", detail.Code, detail.Message)
        }

        if br.HasCode(wise.WiseErrorCodeNotValid) {
            fmt.Println("wise rejected a value as not valid; do not retry")
        }
    }
}

errors.AsType and errors.Is are complementary, not competing: types carry the fields, sentinels carry the codes. A 429 whose body says rate_limit_exceeded satisfies both; a 5xx whose body says system_error is still a retryable *ServerError — the status drives the type, the body code drives the match.

Shortcuts for the common questions

Five package-level matchers answer the questions a caller actually asks, through every wrap layer and without extracting a type first:

Question Matcher
Did Wise say this code? (any code) wise.HasCode(err, wise.WiseErrorCodeInvalidFileExtension)
What was Wise's first granular code? code, ok := wise.Code(err)
Is the resource gone? (404, any body) wise.IsNotFound(err)
Is it worth sending again? wise.IsRetryable(err)
How long did Wise ask us to wait? delay, ok := wise.RetryAfter(err)
if wise.IsNotFound(err) {
    fmt.Println("gone; ErrResourceNotFound alone would miss a 404 with an empty body")
}

if code, ok := wise.Code(err); ok {
    fmt.Printf("wise said %q\n", code)
}

if delay, ok := wise.RetryAfter(err); ok {
    fmt.Printf("throttled; wait at least %s\n", delay)
}

They rest on one property: every typed error unwraps to its APIError, so errors.AsType[*wise.APIError] reaches the status, headers and Details of every status class. The subtype is still the richer match (only *RateLimitError carries RetryAfter, only *SCAChallengeError carries the token), so in an if/else chain test *APIError last, as above. wise.IsRetryable is the SDK's own retry decision: a loop that re-dispatches on it behaves exactly like the client's built-in retry.

Every error the SDK emits is named in one central catalog (errors.go): the typed errors above with their ErrorCode() values, the WiseErrorCode constants for Wise's granular wire codes, the SDK failure catalog (one named entry per failure mode the SDK itself produces), and exported sentinel errors. Three families exist:

  • SDK failure catalog (59 entries of type CatalogEntry): everything the SDK itself does to a call, as opposed to what Wise answers. A Rejection entry (ErrBalanceInvalidRequest, ErrCurrencyInvalidLength, ...) means the SDK refused the request before it reached Wise; a Corruption entry (ErrBalanceParseCurrency, ErrResponseDecode, ...) means Wise's response could not be interpreted. Runtime errors are derived from an entry, so they match it by name through any wrap chain, and errorfamily.Classify gives the family:

    if errors.Is(err, wise.ErrCurrencyInvalidLength) {
        fmt.Println("fix the currency code; this never reached Wise")
    }
    
    if errorfamily.Classify(err) == errorfamily.Corruption {
        fmt.Println("wise sent something the SDK could not read")
    }
    
  • Wise code sentinels (wave 1): ErrNotValid, ErrInvalidValue, ErrParameterMissing, ErrParameterInvalid, ErrInvalidRequest, ErrUnauthorized, ErrForbidden, ErrResourceNotFound, ErrOperationNotSupported, ErrRateLimitExceeded, ErrSystemError. An APIError matches one when any structured detail carries the wire code the sentinel stands for:

    if errors.Is(err, wise.ErrNotValid) {
        fmt.Println("wise rejected a value as not valid")
    }
    
  • Response-shape sentinels: ErrEmptyRateList (rates payload with zero entries), ErrAccountIdentificationCardinality (account details accountIdentification not exactly one member), ErrOTTAlternativesShape (SCA challenge alternatives neither object nor string form), and ErrTransferRefundAmountMissing (transfers#refund webhook payload without amount/currency). The SDK returns these wrapped but always matchable:

    if errors.Is(err, wise.ErrEmptyRateList) {
        fmt.Println("the rates response decoded to zero entries")
    }
    

Every error also exposes ErrorContext() for log pipelines; APIError-family errors include status_code and, when Wise sent its structured envelope, the first granular code as wise_code. The full reference of granular codes lives in docs/error-codes.md.

One error type carries its verdict in headers instead of the body: SCAChallengeError (403 + Wise's two-factor headers) never contains granular codes. Approve the challenge in the Wise app (view a statement) — for balance-statement challenges the one-time-token endpoints answer ott_not_found even for a fresh token (live-verified 2026-11-10); retry with the token from TwoFAApprovalToken() where a token was issued. The full flow is in Strong Customer Authentication.

Consumer recipe: transfer with funding fallback

The pattern bank-sync runs in production: branch on the typed error for transport decisions, on the granular codes for Wise's reasons, and on the funding result's own FundingErrorCode for pay-in problems.

transfer, err := client.CreateTransfer(ctx, createReq)
if err != nil {
    switch {
    case errors.Is(err, wise.ErrNotValid):
        // Wise rejected a value; retrying identical input will fail again.
        return fmt.Errorf("fix the transfer request, do not retry: %w", err)
    case errors.Is(err, wise.ErrResourceNotFound):
        // The quote or recipient vanished; refresh, then build a new request.
        return fmt.Errorf("refresh the referenced resource: %w", err)
    case errors.Is(err, wise.ErrRateLimitExceeded):
        // Transient; the SDK's retry path honors Retry-After automatically.
        return fmt.Errorf("throttled, retry later: %w", err)
    default:
        return fmt.Errorf("create transfer: %w", err)
    }
}

funded, err := client.FundTransfer(ctx, profileID, transfer.ID)
if err != nil {
    return fmt.Errorf("fund transfer: %w", err)
}

if funded.Status == wise.FundingStatusRejected {
    if funded.ErrorCode == wise.FundingErrorCodeBalanceInsufficientFunds {
        // Top up the balance, then fund the same transfer again; the
        // transfer itself was created fine.
        return ErrTopUpRequired
    }
}

Strong Customer Authentication (SCA)

Some Wise endpoints (balance statements for UK/EEA profiles among them) are SCA-protected: the API answers HTTP 403 with an empty body. The verdict and the one-time token live in the x-2fa-approval-result / x-2fa-approval response headers. The SDK detects this and returns *SCAChallengeError instead of a bare AuthError.

Which reads need SCA?

Endpoint family Personal token (UK/EEA profile) Personal token (other regions) Basis
Balance statements (GetStatement, ListTransactions) SCA no live-verified 2026-08
FundTransfer SCA no godoc + live behavior
GetTransfer, ListTransfers no no live-verified 2026-10-16
Transfer receipts (GetTransferReceipt, GetUSCombinedReceipt) no no not SCA-protected per docs
GetTransferPayoutInfo, ListTransferPayments no no same family as receipts
Profiles, balances, quotes, recipients, rates, currencies, webhooks no no standard token reads

SCA protection keys off the profile's registration region, not the token type: a business profile registered outside the UK/EEA reads statements with a bare API key. When a challenge hits, the OTT flow clears it programmatically:

// One correlation ID for the whole logical operation — the challenge and the
// replay both carry it in X-External-Correlation-Id.
ctx = wise.WithRequestCorrelationID(ctx, "bank-sync-2026-08-21-001")

resp, err := client.ListTransactions(ctx, req)
if err != nil {
    if sca, ok := errors.AsType[*wise.SCAChallengeError](err); ok {
        // 1. The one-time token (OTT) — fetch it explicitly; it never
        //    appears in error messages.
        ott := sca.TwoFAApprovalToken()

        // 2. Clear the challenge over a phone channel: trigger the SMS,
        //    prompt the user for the code it delivered, verify, repeat
        //    until every required challenge is passed.
        status, clearErr := client.ClearSCAChallenge(ctx, ott, wise.OTTChannelSMS,
            func(ctx context.Context, challenge wise.OTTChallenge, channel wise.OTTChannel, phoneHint string) (string, error) {
                fmt.Printf("code sent to %s — enter OTP: ", phoneHint)
                var code string
                if _, err := fmt.Scanln(&code); err != nil {
                    return "", err
                }
                return code, nil
            })
        if clearErr != nil {
            log.Fatal(clearErr)
        }
        fmt.Println("cleared:", status.Cleared())

        // 3. Replay the request — with the same ctx so Wise support can
        //    correlate both attempts:
        scaClient := wise.New("api-key", wise.WithSCAApprovalToken(ott))
        resp, err = scaClient.ListTransactions(ctx, req)
    }
}

The one-time-token endpoints (GetOTTStatus, TriggerOTT, VerifyOTT, ClearSCAChallenge) live on the quarterly versioned surface (/2027Q1/one-time-token/...). Availability caveat, wire-proven 2026-11-25: the OpenAPI spec scopes these endpoints to OAuth user tokens only (security: [{"UserToken": []}]), and Wise's "Personal API tokens" guide does not support statement retrieval for accounts outside the US, Canada, Australia, New Zealand, Singapore and Malaysia — so a personal API token gets ott_not_found for any statement-challenge token, however fresh. Treat not-found as "clear via Wise app approval", never as a retryable race. The OTT is a distinct type, wise.OneTimeToken (construct with wise.NewOneTimeToken), so it can never be passed where an OTP code or any other string is expected. Challenges that no phone channel can clear (e.g. a PIN-only challenge) surface as a Rejection naming the available types — clear those by viewing a statement on wise.com instead. A 403 with the verdict header but no x-2fa-approval (live-verified 2026-11-10: usually the response to a stale token presented in x-2fa-approval, not a Wise flavor — presenting no token mints a fresh OTT every time) leaves TwoFAApprovalToken() zero: still blocked, with nothing to clear programmatically — audit the caller's token source.

GET /v1/transfers (and the other transfer endpoints) are not SCA-protected, which is why ListTransfers is the reliable source for outgoing transfer history with personal API tokens.

Webhooks

Wise signs every webhook delivery with X-Signature-SHA256: a Base64-encoded RSA-SHA256 signature of the raw request body, verifiable with the per-subscription public key Wise shows in the dashboard. Verify every delivery before trusting it:

// Parse the key once when the handler is constructed; a bad key should fail
// loudly there, not on the first delivery. Register the handler once:
//
//	http.HandleFunc("/webhooks/wise", newWebhookHandler(subscriptionPublicKeyPEM))
func newWebhookHandler(subscriptionPublicKeyPEM string) http.HandlerFunc {
    webhookKey, err := wise.ParseWebhookPublicKey([]byte(subscriptionPublicKeyPEM))
    if err != nil {
        log.Fatal(err)
    }

    return func(w http.ResponseWriter, r *http.Request) {
        body, err := io.ReadAll(r.Body)
        if err != nil {
            http.Error(w, "read body", http.StatusBadRequest)

            return
        }

        // Verify the raw bytes exactly as received — before any re-marshalling,
        // which would change the signed input.
        if !wise.VerifyWebhookSignature(body, r.Header.Get(wise.HeaderWebhookSignature), webhookKey) {
            http.Error(w, "invalid signature", http.StatusUnauthorized)

            return
        }

        // Trustworthy delivery: parse the envelope and its typed payload —
        // see [Typed event decoding](#typed-event-decoding) below.
    }
}

Reject deliveries with HTTP 401/403 when verification fails. Wise redelivers until you acknowledge, so process idempotently: X-Delivery-Id (unique per delivery attempt — exposed as wise.HeaderDeliveryID) is the deduplication key — record it and skip already-seen deliveries. Signature verification alone is not enough: a verified delivery can still be a redelivery of an event you already processed.

Webhook subscriptions

Subscriptions are the standing instruction for Wise to deliver events to your HTTPS endpoint. The SDK covers the profile-level CRUD (user API token); application-level subscriptions need a client-credentials token and are deliberately out of scope (see ROADMAP):

profileID := wise.NewProfileID(12345)

sub, err := client.CreateProfileWebhookSubscription(ctx, profileID,
    wise.CreateWebhookSubscriptionRequest{
        Name:      "Payout watcher",
        TriggerOn: wise.WebhookEventTransfersStateChange, // open enum; any event type string works
        Delivery:  wise.WebhookDelivery{Version: "4.0.0", URL: "https://example.com/hooks/wise"},
    })

subs, err := client.ListProfileWebhookSubscriptions(ctx, profileID)
sub, err := client.GetProfileWebhookSubscription(ctx, profileID, sub.ID)
err := client.DeleteProfileWebhookSubscription(ctx, profileID, sub.ID)

Wise's subscription endpoints live on the quarterly versioned API surface (/2027Q1/profiles/{profileId}/subscriptions) — the SDK sends that path automatically. There is no update operation: subscriptions are created and deleted, never edited.

Typed event decoding

ParseWebhookEvent decodes the envelope Wise POSTs (schema version, subscription ID, event type, sent-at) and keeps the payload raw. Typed accessors decode the payload per event type; unknown event types never fail — new Wise events parse with the data left raw for hand decoding:

event, err := wise.ParseWebhookEvent(body) // body = the verified raw bytes
if err != nil {
    // Undecodable or malformed envelope: reject the delivery.
    http.Error(w, "malformed event", http.StatusBadRequest)

    return
}

switch event.EventType {
case wise.WebhookEventTransfersStateChange:
    state, err := event.TransferStateChange() // *TransferStateChangeData
    // state.CurrentState / state.PreviousState are TransferStatus values.
case wise.WebhookEventTransfersPayoutFailure:
    failure, err := event.TransferPayoutFailure() // *TransferPayoutFailureData
case wise.WebhookEventBalancesCredit:
    credit, err := event.BalanceCredit() // *BalanceCreditData with Money amounts
default:
    // Unknown event type: log and acknowledge — Wise redelivers otherwise.
}

Available typed payloads today: transfers#state-change, transfers#payout-failure, and balances#credit. Malformed envelopes and payloads are corruption-classified errors (wise.webhook.decode), so a broken sender is distinguishable from a routing mistake.

Design Decisions

Decision Rationale
Monetary amounts as int64 cents float64 causes precision loss (e.g., 0.1 + 0.2 ≠ 0.3). Cents are safe for arithmetic and storage.
Two-layer type system Raw wire types in internal/raw mirror JSON exactly. Result types expose clean Go with Money value objects. Mapping functions convert between them.
go-retry for retries In-house, zero-dependency retry with backoff and jitter; the only executor that expresses Wise's Retry-After as first-class policy (ADR 003).
samber/oops for error context Context wraps carry a stack trace any consumer can read; message text and errors.Is/errors.AsType matching are unchanged. Sentinels stay plain comparable values (ADR 004).
Flat package structure Single package wise; wire types hidden in internal/raw. The import path is the API.
BDD tests with Ginkgo httptest.Server mock API responses. Tests verify both happy paths and error classification.

Testing

GOEXPERIMENT=jsonv2 go test ./...

Tests use net/http/httptest to mock the Wise API — no network access required. The GOEXPERIMENT=jsonv2 prefix is mandatory (see Installation).

Spec conformance

Every mock exchange is also validated against Wise's machine-readable OpenAPI contract, vendored at docs/reviews/wise-api-openapi.json: the suite fails when a request path, required parameter, or response payload no longer matches what Wise documents. Deliberate divergences (Wise's loose live timestamp shapes, legacy wire surfaces the spec bundle does not describe) are exempted explicitly in spec_conformance_test.go with the reasoning inline. Refresh the snapshot from https://docs.wise.com/_bundle/api-reference/@preview/index.yaml?download to pick up contract changes.

Sandbox verification

A small live-test suite (sandbox_live_test.go) exercises the real sandbox at api.wise-sandbox.com. It is key-gated: every test skips unless WISE_SANDBOX_API_KEY is set, so the default suite stays offline and CI never fails on a missing secret.

Locally:

WISE_SANDBOX_API_KEY=<your-sandbox-key> GOEXPERIMENT=jsonv2 \
  go test -run TestSandboxLive -v -count=1 ./...

In CI: the Sandbox Live Tests workflow runs the same suite on manual dispatch (workflow_dispatch). Add the WISE_SANDBOX_API_KEY secret to the repository first; dispatching without it is a green no-op (all tests skip, visible as SKIP lines in the log). Current coverage: a GetMe smoke test, a ListTransfers read (must succeed — the endpoint is not SCA-protected), a GetTransfer by-ID test that stays silent unless WISE_TEST_TRANSFER_ID names a transfer the key owns, plus five contract tests pinning the 2026-10-17 sandbox lane — exchange-rate shape (current + historical), the typed funding-404, the SCA challenge wire contract (403 + one-time-token headers, no token leak), the OTT status lifecycle on the quarterly surface, and CreateBalance idempotency (replaying the same idempotency key returns the already-created balance). Credentialed run green 2026-10-17.

Project Status

Doc What it holds
FEATURES.md Honest feature inventory by status, including the per-endpoint coverage matrix
ROADMAP.md Long-term direction and raw ideas
CONTRIBUTING.md Development setup, quality gates, release process
CHANGELOG.md What changed in each version
docs/adr/ Architecture decision records (Money, package boundary, retry executor)
docs/error-codes.md Every granular Wise error code: sentinel, typical status, retry guidance

Contributing

Contributions are welcome — see CONTRIBUTING.md for guidelines on development setup, code style, and submitting pull requests.

License

Apache-2.0 — see LICENSE.

Trademarks

"Wise" and "TransferWise" are registered trademarks of Wise Payments Limited. This project is not affiliated with, endorsed by, or sponsored by Wise Payments Limited. All trademarks are the property of their respective owners.

Documentation

Overview

Package wise provides a Go client for the Wise (TransferWise) API.

The client handles authentication, rate limiting, retries with exponential backoff, and returns strongly-typed Go structs for all API responses.

Basic usage:

client := wise.New("your-api-key")
profiles, err := client.ListProfiles(ctx)
Example (ErrorHandling)

Handle an error from any SDK call: extract the typed error for its fields, match curated Wise granular codes by value through any wrap chain, and read the structured details for codes without a sentinel.

package main

import (
	"context"
	"errors"
	"fmt"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	_, err := client.ListBalances(context.Background(), wise.NewProfileID(12345))
	if err == nil {
		return
	}

	// Types carry the fields:
	if rl, ok := errors.AsType[*wise.RateLimitError](err); ok {
		fmt.Printf("rate limited; retry after %s\n", rl.RetryAfter)

		return
	}

	// Curated Wise wire codes match by value:
	if errors.Is(err, wise.ErrResourceNotFound) {
		fmt.Println("profile does not exist")

		return
	}

	// Any other granular code branches on the structured details:
	if apiErr, ok := errors.AsType[*wise.APIError](err); ok {
		for _, detail := range apiErr.Details {
			fmt.Printf("%s: %s\n", detail.Code, detail.Message)
		}

		if apiErr.HasCode(wise.WiseErrorCodeNotValid) {
			fmt.Println("wise rejected a value; fix the request instead of retrying")
		}
	}
}
Example (ErrorMatchingSentinels)

Match a granular Wise wire code by value with the curated sentinels. The match survives arbitrary fmt.Errorf("%w") wrap chains.

package main

import (
	"context"
	"errors"
	"fmt"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	_, err := client.GetTransfer(context.Background(), wise.NewTransferID(16521634))
	if err != nil {
		if errors.Is(err, wise.ErrResourceNotFound) {
			fmt.Println("transfer does not exist; refresh before retrying")
		}
	}
}

Index

Examples

Constants

View Source
const (
	HeaderTwoFAApproval       = "X-2fa-Approval"
	HeaderTwoFAApprovalResult = "X-2fa-Approval-Result"
)

Wise's Strong Customer Authentication (SCA) response headers. Wise answers SCA-protected endpoints (balance statements for UK/EEA profiles among them) with HTTP 403 and an EMPTY body: the verdict lives in x-2fa-approval-result and the one-time token (OTT) to clear the challenge in x-2fa-approval. Retrying the same request with that token in the x-2fa-approval header completes the flow once the user approved the challenge (e.g. in the Wise app). Values are in canonical MIME form (what net/http's Header.Get/Set use as map keys; on the wire HTTP header names are case-insensitive).

View Source
const (
	ProductionURL = "https://api.wise.com"
	SandboxURL    = "https://api.wise-sandbox.com"
)

API Base URLs.

Sandbox URLs were migrated in November 2025 from the V1 environment (api.sandbox.transferwise.tech) to the V2 environment (api.wise-sandbox.com). V1 was fully deprecated on June 30, 2026.

View Source
const HeaderDeliveryID = "X-Delivery-Id"

HeaderDeliveryID is the header Wise stamps every webhook delivery with: an identifier that is unique per delivery attempt. Use it as the deduplication key when processing idempotently — Wise redelivers until acknowledged, and a verified signature does not make a delivery new.

View Source
const HeaderOneTimeToken = "One-Time-Token"

HeaderOneTimeToken is the header Wise's one-time-token (OTT) endpoints require: the text value of the OTT whose challenges are being inspected, triggered, or verified. Values are in canonical MIME form (what net/http's Header.Get/Set use as map keys; on the wire HTTP header names are case-insensitive).

View Source
const HeaderWebhookSignature = "X-Signature-SHA256"

HeaderWebhookSignature is the header Wise signs every webhook delivery with: a Base64-encoded RSA-SHA256 signature of the raw request body.

View Source
const Version = "0.15.0"

Version is the released version of this SDK, mirrored from the latest tag. Useful in User-Agent strings (see WithUserAgent) and support diagnostics so Wise can correlate behavior with a specific client release.

Variables

View Source
var (
	// ErrEmptyRateList reports a rates payload that decoded to zero entries.
	ErrEmptyRateList error = newSentinel("empty rate list")

	// ErrAccountIdentificationCardinality marks a wire accountIdentification
	// that carries zero or several oneOf members; the wrap's detail message
	// holds the count.
	ErrAccountIdentificationCardinality error = newSentinel(
		"accountIdentification member count is not exactly one",
	)

	// ErrOTTAlternativesShape is the sentinel for alternatives payloads that
	// are neither the documented object form nor a bare string array.
	ErrOTTAlternativesShape error = newSentinel("alternatives are neither objects nor strings")

	// ErrTransferRefundAmountMissing marks a transfers#refund payload whose
	// resource block lacks the refund amount/currency pair.
	ErrTransferRefundAmountMissing error = newSentinel(
		"refund amount or currency missing from resource block",
	)
)

Sentinel errors name distinct response-shape failures so consumers can match them with errors.Is. The SDK returns them only wrapped (with a Corruption classification and a code from the catalog above), never bare, and they are declared with the error interface type on purpose: they are matched by value, never by type.

View Source
var (
	// ErrNotValid reports Wise rejecting a value as not valid (wire code
	// "not.valid"), typically a malformed amount or field value.
	ErrNotValid error = newSentinel("wise: not valid")

	// ErrInvalidValue reports Wise rejecting a field value (wire code
	// "invalid_value").
	ErrInvalidValue error = newSentinel("wise: invalid value")

	// ErrParameterMissing reports a required request parameter Wise did not
	// receive (wire code "parameter_missing").
	ErrParameterMissing error = newSentinel("wise: parameter missing")

	// ErrParameterInvalid reports a request parameter whose value Wise
	// rejected (wire code "parameter_invalid").
	ErrParameterInvalid error = newSentinel("wise: parameter invalid")

	// ErrInvalidRequest reports a generic malformed request (wire code
	// "invalid_request").
	ErrInvalidRequest error = newSentinel("wise: invalid request")

	// ErrUnauthorized reports missing or invalid credentials (wire code
	// "unauthorized").
	ErrUnauthorized error = newSentinel("wise: unauthorized")

	// ErrForbidden reports credentials without permission for the operation
	// (wire code "forbidden").
	ErrForbidden error = newSentinel("wise: forbidden")

	// ErrResourceNotFound reports that the addressed resource does not exist
	// (wire code "resource_not_found").
	ErrResourceNotFound error = newSentinel("wise: resource not found")

	// ErrOperationNotSupported reports that the API surface does not support
	// the requested operation (wire code "operation_not_supported").
	ErrOperationNotSupported error = newSentinel("wise: operation not supported")

	// ErrRateLimitExceeded reports that Wise throttled the request (wire
	// code "rate_limit_exceeded"); back off and retry.
	ErrRateLimitExceeded error = newSentinel("wise: rate limit exceeded")

	// ErrSystemError reports a Wise-side system failure (wire code
	// "system_error"), typically transient.
	ErrSystemError error = newSentinel("wise: system error")
)

Curated wave-1 code sentinels: the Wise wire codes with a consumer branching story, matchable through any wrap chain via errors.Is on an *APIError (APIError.Is compares the structured Details codes, never message text). Declared with the error interface type like every sentinel in this file: they are matched by value, never by type. Codes without a sentinel (open-enum passthrough) stay reachable via APIError.HasCode.

Functions

func HasCode added in v0.19.0

func HasCode(err error, code WiseErrorCode) bool

HasCode reports whether err is a Wise API error whose structured envelope carries the given granular code. It is the chain-aware form of APIError.HasCode: no type extraction first, and it works for every status class (curated codes additionally match errors.Is against their Err* sentinel).

func IsNotFound added in v0.19.0

func IsNotFound(err error) bool

IsNotFound reports whether Wise answered that the addressed resource does not exist (HTTP 404, any body). It is the status-driven form of the curated ErrResourceNotFound sentinel, which needs the structured code in the body and therefore misses the 404s Wise answers with an empty or plain-text body.

func IsRetryable added in v0.19.0

func IsRetryable(err error) bool

IsRetryable reports whether a failed request is worth sending again: rate limits and server errors are, every other Wise verdict is not, and an error that is not a Wise verdict at all (network failure, request construction) is treated as transient. This is the SDK's own retry decision, so a caller that re-dispatches on it behaves like the client's built-in retry loop.

func MissingTransferDetails added in v0.9.0

func MissingTransferDetails(
	requirements []TransferRequirement,
	req CreateTransferRequest,
) []string

MissingTransferDetails cross-references a transfer-requirements response against a prepared CreateTransferRequest and returns the human-readable names of fields Wise marked required that the request does not satisfy. An empty result means the request carries every detail required for the corridor; call it after ValidateTransferRequirements and before CreateTransfer to fail before spending a customerTransactionId.

Select fields (ValuesAllowed non-empty) are only satisfied by a value from their allowed list. Keys the SDK does not model as typed fields (rare, corridor-specific) are always reported — the corridor then needs a field beyond CreateTransferRequest's surface, and the response's dynamic form describes what Wise expects.

Fields flagged RefreshRequirementsOnChange reveal lower-level requirements only after they are populated: re-run ValidateTransferRequirements with the populated value and call MissingTransferDetails on the fresh response.

func ParseWebhookPublicKey added in v0.9.0

func ParseWebhookPublicKey(pemBytes []byte) (*rsa.PublicKey, error)

ParseWebhookPublicKey parses the PEM-encoded RSA public key Wise shows per webhook subscription. Parse it once at startup so a misconfigured key fails loudly there, not silently per delivery.

func RetryAfter added in v0.19.0

func RetryAfter(err error) (time.Duration, bool)

RetryAfter returns the wait Wise advised on a rate-limit verdict (the Retry-After header, falling back to one second when absent) and whether err carries one. A consumer retry loop should sleep at least that long before re-dispatching.

func VerifyWebhookSignature added in v0.9.0

func VerifyWebhookSignature(payload []byte, signatureB64 string, key *rsa.PublicKey) bool

VerifyWebhookSignature reports whether the X-Signature-SHA256 header value of a webhook delivery is an authentic RSA-SHA256 signature of the raw request body. Verify the raw bytes exactly as received — read the body before any re-marshalling, which would change the signed input.

Reject the delivery (HTTP 401/403) when this returns false.

Example

Verify a webhook delivery before trusting its payload. Parse the subscription's public key once at startup; verify the raw body exactly as received against the X-Signature-SHA256 header on every delivery.

package main

import (
	"io"
	"log"
	"net/http"

	"github.com/larsartmann/wise-go"
)

func main() {
	webhookKey, err := wise.ParseWebhookPublicKey([]byte(`-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA... (from the dashboard)
-----END PUBLIC KEY-----`))
	if err != nil {
		log.Fatal(err)
	}

	http.HandleFunc("/webhooks/wise", func(w http.ResponseWriter, r *http.Request) {
		body, readErr := io.ReadAll(r.Body)
		if readErr != nil {
			http.Error(w, "read body", http.StatusBadRequest)

			return
		}

		if !wise.VerifyWebhookSignature(body, r.Header.Get(wise.HeaderWebhookSignature), webhookKey) {
			http.Error(w, "invalid signature", http.StatusUnauthorized)

			return
		}

		// Verified delivery: decode and process. Deduplicate on X-Delivery-Id —
		// Wise redelivers until acknowledged.
		w.WriteHeader(http.StatusOK)
	})
}

func WithRequestCorrelationID added in v0.9.0

func WithRequestCorrelationID(ctx context.Context, id string) context.Context

WithRequestCorrelationID returns a context whose requests carry the given correlation ID in the X-External-Correlation-Id header, overriding the client-wide WithCorrelationID value for requests made with this context. Use one unique ID per logical operation to trace it across Wise's systems.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Body       string
	// Headers carries the response headers when available. Wise puts
	// diagnostics that never appear in the body here (SCA challenge tokens,
	// rate-limit owner), so dropping them hides the actual verdict.
	Headers http.Header
	// Details carries Wise's structured error envelope (errors[].code /
	// errors[].message) or the flat envelope's top-level code as one entry,
	// so consumers can branch on Wise's granular codes without parsing
	// Message. Empty when the body was neither (empty body, plain text, non-JSON).
	// Message stays the flattened join of the same entries for backward
	// compatibility; prefer Details for matching.
	Details []WiseErrorDetail
}

APIError is the base error returned for non-2xx Wise API responses.

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) ErrorCode

func (e *APIError) ErrorCode() string

func (*APIError) ErrorContext

func (e *APIError) ErrorContext() map[string]string

func (*APIError) ErrorFamily

func (e *APIError) ErrorFamily() errorfamily.Family

func (*APIError) HasCode added in v0.15.0

func (e *APIError) HasCode(code WiseErrorCode) bool

HasCode reports whether any structured error detail carries the given Wise wire code. This is the matcher for codes without a curated sentinel (and a convenience for the curated ones); unknown codes work because WiseErrorCode is an open enum.

Example

Branch on any granular Wise wire code, including ones without a curated sentinel (here unexpected.error, on a 5xx): WiseErrorCode is an open enum, HasCode is promoted onto every typed error, and the status drives which type to extract.

package main

import (
	"context"
	"errors"
	"fmt"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	_, err := client.GetBalance(
		context.Background(),
		wise.NewProfileID(12345),
		wise.NewBalanceID(67890),
	)
	if err == nil {
		return
	}

	srv, ok := errors.AsType[*wise.ServerError](err)
	if !ok {
		return
	}

	if srv.HasCode(wise.WiseErrorCodeUnexpectedError) {
		fmt.Println("wise-side failure; retry only while the error stays retryable")
	}
}

func (*APIError) Is added in v0.15.0

func (e *APIError) Is(target error) bool

Is reports whether the error carries the Wise wire code represented by a curated code sentinel (see codeSentinels), so errors.Is matches through arbitrary fmt.Errorf("%w") wrap chains and through every typed subtype that embeds APIError. It compares structured Details codes only (never message text) and deliberately returns false for everything else: type extraction stays the job of errors.AsType.

type AccountBrand added in v0.9.0

type AccountBrand struct{}

AccountBrand is a phantom type for AccountID.

func (AccountBrand) Name added in v0.12.0

func (AccountBrand) Name() string

type AccountDetails added in v0.14.0

type AccountDetails struct {
	ID                AccountDetailsID
	ProfileID         ProfileID
	State             AccountDetailsState
	AccountHolderName string
	Country           string // ISO 3166-1 alpha-2
	Identification    AccountIdentification
}

AccountDetails is one set of receiving bank details (an IBAN, a UK sort code/account pair, or a US routing/account pair) on the profile's Multi-Currency Account. Wise relocated the surface in the 2027Q1 roll: it is keyed by the details' own ID now, not by profile.

type AccountDetailsBrand added in v0.14.0

type AccountDetailsBrand struct{}

AccountDetailsBrand is a phantom type for AccountDetailsID.

func (AccountDetailsBrand) Name added in v0.14.0

func (AccountDetailsBrand) Name() string

type AccountDetailsID added in v0.14.0

type AccountDetailsID = id.ID[AccountDetailsBrand, int64]

AccountDetailsID is a strongly-typed identifier for one set of receiving bank details (wire "id" of the /balances/account-details surface, added in the 2027Q1 roll). It is a distinct int64 ID space from profiles, balances, and accounts.

func NewAccountDetailsID added in v0.14.0

func NewAccountDetailsID(v int64) AccountDetailsID

NewAccountDetailsID creates a new AccountDetailsID from an int64 value.

type AccountDetailsState added in v0.14.0

type AccountDetailsState string

AccountDetailsState reports whether a set of receiving bank details is usable. The 2027Q1 surface replaced the old AVAILABLE/ACTIVE statuses with this two-value state (an INACTIVE set exists but must not receive money).

const (
	// AccountDetailsStateActive means the details are ready to receive money.
	AccountDetailsStateActive AccountDetailsState = "ACTIVE"
	// AccountDetailsStateInactive means the details exist but are switched off.
	AccountDetailsStateInactive AccountDetailsState = "INACTIVE"
)

Documented account-details states.

type AccountID added in v0.9.0

type AccountID = id.ID[AccountBrand, int64]

AccountID is a strongly-typed identifier for Wise multi-currency accounts — a distinct ID space from RecipientID even though both are int64 on the wire.

func NewAccountID added in v0.9.0

func NewAccountID(v int64) AccountID

NewAccountID creates a new AccountID from an int64 value.

type AccountIdentification added in v0.14.0

type AccountIdentification struct {
	BE *BEAccountIdentification
	GB *GBAccountIdentification
	US *USAccountIdentification
}

AccountIdentification is the country/scheme-specific account number block. Exactly one member is present; anything else is a corrupt response.

art-dupl:accept parsed domain types intentionally mirror the tagged wire types in internal/raw; the tag-free domain layer decouples callers from the JSON shapes

type AccountRequirement added in v0.9.0

type AccountRequirement struct {
	Type      string
	Title     string
	UsageInfo string
	Fields    []TransferRequirementForm
}

AccountRequirement is the parsed form of one payout route's recipient requirements from GetQuoteAccountRequirements. Type identifies the route (e.g. "swift_code", "sort_code") and becomes CreateRecipientRequest.Type; Title and UsageInfo are Wise's display strings for the route; Fields reuses the dynamic-form shape shared with transfer requirements.

type Activity added in v0.18.0

type Activity struct {
	// ID is Wise's opaque activity id (stable for one activity).
	ID   string
	Type ActivityType
	// ResourceType and ResourceID identify the underlying entity (for
	// example CARD_TRANSACTION 343049).
	ResourceType ActivityResourceType
	ResourceID   string
	// Title may carry Wise's display markup (<strong>, <positive>).
	Title       string
	Description string
	// PrimaryAmount and SecondaryAmount are the activity's two money legs.
	// Wise puts the main amount first and a second leg (the converted
	// amount, or the source amount of a conversion) second; SecondaryAmount
	// is absent for single-leg activities.
	PrimaryAmount   ActivityAmount
	SecondaryAmount ActivityAmount
	Status          ActivityStatus
	CreatedOn       time.Time
	UpdatedOn       time.Time
}

Activity is one entry of a profile's activity feed: a snapshot of a performed action (a transfer, a card payment, a deposit, a conversion) with display-oriented amounts.

The feed is NOT the statement ledger: it is profile-scoped rather than balance-scoped, its amounts are formatted text, and it does not itemize fees. Where the two overlap they can differ (live comparison 2026-11-26 on one profile: about half of the statement's debit rows had no activity of the same amount, mostly transfers whose statement amount includes a fee). Read it as real-time visibility, never as the book of record.

type ActivityAmount added in v0.18.0

type ActivityAmount struct {
	// Text is Wise's display text exactly as sent ("" when none was sent).
	Text string
	// Present reports that Text carried one plain amount; Amount is
	// meaningful only then. A currency pair such as "USD, EUR" or a locale
	// format other than the canonical one leaves Present false.
	Present bool
	// Credit reports that Wise marked the leg as money IN (a leading "+" or
	// the <positive> markup). A present leg without Credit is money OUT or,
	// for a two-legged conversion, the source side.
	Credit bool
	// Amount is the leg's absolute value.
	Amount Money
}

ActivityAmount is one money leg of an activity. Wise formats the feed for display, so the wire value is text with units, an optional sign, and optional <positive> markup. The SDK parses one plain amount into Money and keeps the raw text for everything else.

type ActivityPage added in v0.18.0

type ActivityPage struct {
	// Activities are ordered newest first (Wise API order).
	Activities []Activity
	// NextCursor is the cursor of the following page; empty on the last page.
	NextCursor string
}

ActivityPage is one page of a profile's activity feed.

type ActivityResourceType added in v0.18.0

type ActivityResourceType string

ActivityResourceType names the family of the underlying entity an activity snapshots. It is also the endpoint's monetaryResourceType filter.

const (
	ActivityResourceTypeAccrualCharge          ActivityResourceType = "ACCRUAL_CHARGE"
	ActivityResourceTypeAcquiringPayment       ActivityResourceType = "ACQUIRING_PAYMENT"
	ActivityResourceTypeAssetsWithdrawal       ActivityResourceType = "ASSETS_WITHDRAWAL"
	ActivityResourceTypeBalanceCashback        ActivityResourceType = "BALANCE_CASHBACK"
	ActivityResourceTypeBalanceInterest        ActivityResourceType = "BALANCE_INTEREST"
	ActivityResourceTypeBalanceTransaction     ActivityResourceType = "BALANCE_TRANSACTION"
	ActivityResourceTypeBankDetailsOrder       ActivityResourceType = "BANK_DETAILS_ORDER"
	ActivityResourceTypeBatchTransfer          ActivityResourceType = "BATCH_TRANSFER"
	ActivityResourceTypeCardCashback           ActivityResourceType = "CARD_CASHBACK"
	ActivityResourceTypeCardOrder              ActivityResourceType = "CARD_ORDER"
	ActivityResourceTypeCardTransaction        ActivityResourceType = "CARD_TRANSACTION"
	ActivityResourceTypeDirectDebitInstruction ActivityResourceType = "DIRECT_DEBIT_INSTRUCTION"
	ActivityResourceTypeDirectDebitTransaction ActivityResourceType = "DIRECT_DEBIT_TRANSACTION"
	ActivityResourceTypeFeeRefund              ActivityResourceType = "FEE_REFUND"
	ActivityResourceTypeIncidentRefund         ActivityResourceType = "INCIDENT_REFUND"
	ActivityResourceTypeIncorporationOrder     ActivityResourceType = "INCORPORATION_ORDER"
	ActivityResourceTypeOperationalTransaction ActivityResourceType = "OPERATIONAL_TRANSACTION"
	ActivityResourceTypePaymentRequest         ActivityResourceType = "PAYMENT_REQUEST"
	ActivityResourceTypeReward                 ActivityResourceType = "REWARD"
	ActivityResourceTypeRewardsRedemption      ActivityResourceType = "REWARDS_REDEMPTION"
	ActivityResourceTypeSendOrder              ActivityResourceType = "SEND_ORDER"
	ActivityResourceTypeSendOrderExecution     ActivityResourceType = "SEND_ORDER_EXECUTION"
	ActivityResourceTypeTransfer               ActivityResourceType = "TRANSFER"
)

Documented resource types (Wise OpenAPI 2027Q1, ActivityResourceType).

type ActivityStatus added in v0.18.0

type ActivityStatus string

ActivityStatus is the lifecycle state of an activity. Wise may add values; unrecognised ones are preserved.

const (
	ActivityStatusRequiresAttention ActivityStatus = "REQUIRES_ATTENTION"
	ActivityStatusInProgress        ActivityStatus = "IN_PROGRESS"
	ActivityStatusUpcoming          ActivityStatus = "UPCOMING"
	ActivityStatusCompleted         ActivityStatus = "COMPLETED"
	ActivityStatusCancelled         ActivityStatus = "CANCELLED"
)

Documented activity statuses (Wise OpenAPI 2027Q1, ActivityStatus).

type ActivityType added in v0.18.0

type ActivityType string

ActivityType is Wise's kind of activity. The documented values are listed as constants; Wise may add more, and unrecognised values are preserved.

const (
	ActivityTypeAcquiringPayment       ActivityType = "ACQUIRING_PAYMENT"
	ActivityTypeAutoConversion         ActivityType = "AUTO_CONVERSION"
	ActivityTypeBalanceAdjustment      ActivityType = "BALANCE_ADJUSTMENT"
	ActivityTypeBalanceAssetFee        ActivityType = "BALANCE_ASSET_FEE"
	ActivityTypeBalanceCashback        ActivityType = "BALANCE_CASHBACK"
	ActivityTypeBalanceDeposit         ActivityType = "BALANCE_DEPOSIT"
	ActivityTypeBalanceHoldFee         ActivityType = "BALANCE_HOLD_FEE"
	ActivityTypeBalanceInterest        ActivityType = "BALANCE_INTEREST"
	ActivityTypeBankDetailsOrder       ActivityType = "BANK_DETAILS_ORDER"
	ActivityTypeBatchTransfer          ActivityType = "BATCH_TRANSFER"
	ActivityTypeCardCashback           ActivityType = "CARD_CASHBACK"
	ActivityTypeCardCheck              ActivityType = "CARD_CHECK"
	ActivityTypeCardOrder              ActivityType = "CARD_ORDER"
	ActivityTypeCardPayment            ActivityType = "CARD_PAYMENT"
	ActivityTypeCashWithdrawal         ActivityType = "CASH_WITHDRAWAL"
	ActivityTypeClaimableSendOrder     ActivityType = "CLAIMABLE_SEND_ORDER"
	ActivityTypeDirectDebitTransaction ActivityType = "DIRECT_DEBIT_TRANSACTION"
	ActivityTypeExcessRefund           ActivityType = "EXCESS_REFUND"
	ActivityTypeFeeRefund              ActivityType = "FEE_REFUND"
	ActivityTypeIncorporationOrder     ActivityType = "INCORPORATION_ORDER"
	ActivityTypeInterbalance           ActivityType = "INTERBALANCE"
	ActivityTypePaymentRequest         ActivityType = "PAYMENT_REQUEST"
	ActivityTypePrefundingTransfer     ActivityType = "PREFUNDING_TRANSFER"
	ActivityTypeReward                 ActivityType = "REWARD"
	ActivityTypeScheduledSendOrder     ActivityType = "SCHEDULED_SEND_ORDER"
	ActivityTypeTransfer               ActivityType = "TRANSFER"
)

Documented activity kinds (Wise OpenAPI 2027Q1, ActivityType).

type AuthError

type AuthError struct {
	APIError
}

AuthError is returned when the Wise API returns HTTP 401 or 403.

func (*AuthError) ErrorCode

func (e *AuthError) ErrorCode() string

func (*AuthError) Unwrap added in v0.19.0

func (e *AuthError) Unwrap() error

type BEAccountIdentification added in v0.14.0

type BEAccountIdentification struct {
	BIC                string
	IBAN               string
	InstitutionName    string
	InstitutionAddress *ISO20022Address
}

BEAccountIdentification is the Belgian (SEPA) details format.

type BadRequestError added in v0.15.0

type BadRequestError struct {
	APIError
}

BadRequestError is returned when the Wise API returns HTTP 400: the request was malformed or failed Wise-side validation. Wise's granular reason codes (parameter_missing, not.valid, and friends) arrive in the structured details; match them with errors.Is on the curated code sentinels or with APIError.HasCode.

func (*BadRequestError) ErrorCode added in v0.15.0

func (e *BadRequestError) ErrorCode() string

func (*BadRequestError) Unwrap added in v0.19.0

func (e *BadRequestError) Unwrap() error

type Balance

type Balance struct {
	ID        BalanceID
	Currency  Currency
	Type      BalanceType
	Name      string
	Amount    Money
	Reserved  Money
	Visible   bool
	CreatedAt time.Time
}

Balance is the parsed representation of a Wise balance.

type BalanceBrand

type BalanceBrand struct{}

BalanceBrand is a phantom type for BalanceID.

func (BalanceBrand) Name added in v0.12.0

func (BalanceBrand) Name() string

type BalanceCreditData added in v0.11.0

type BalanceCreditData struct {
	Resource               WebhookResource
	Amount                 Money
	PostTransactionBalance Money
	OccurredAt             time.Time
}

BalanceCreditData is the typed payload of balances#credit events: the credited amount and the resulting balance, as Money.

type BalanceID

type BalanceID = id.ID[BalanceBrand, int64]

BalanceID is a strongly-typed identifier for Wise balances.

func NewBalanceID

func NewBalanceID(v int64) BalanceID

NewBalanceID creates a new BalanceID from an int64 value.

type BalanceTransactionBrand added in v0.9.0

type BalanceTransactionBrand struct{}

BalanceTransactionBrand is a phantom type for BalanceTransactionID.

func (BalanceTransactionBrand) Name added in v0.12.0

type BalanceTransactionID added in v0.9.0

type BalanceTransactionID = id.ID[BalanceTransactionBrand, int64]

BalanceTransactionID is a strongly-typed identifier for Wise balance transactions (the numeric ID of a debit or credit applied to a balance, e.g. the funding transaction created by FundTransfer). It is a distinct ID space from the composite string TransactionID of statement transactions.

func NewBalanceTransactionID added in v0.9.0

func NewBalanceTransactionID(v int64) BalanceTransactionID

NewBalanceTransactionID creates a new BalanceTransactionID from an int64 value.

type BalanceType

type BalanceType string

BalanceType identifies the kind of Wise balance.

const (
	BalanceTypeStandard BalanceType = "standard"
	BalanceTypeSavings  BalanceType = "savings"
)

type CatalogEntry added in v0.19.0

type CatalogEntry interface {
	error
	errorfamily.Coded
	errorfamily.Classified
}

CatalogEntry is the type of every SDK failure catalog entry below: a named, coded, classified error. [newCoded] and [wrapCoded] accept only it, so a coded SDK error can be derived from a catalog entry and from nothing else.

var (
	// ErrAccountInvalidRequest is the catalog entry for "wise.account.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrAccountInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.account.invalid_request",
		"account request is invalid",
	)
	// ErrAccountParseCreationTime is the catalog entry for "wise.account.parse_creation_time";
	// family Corruption (the response could not be interpreted).
	ErrAccountParseCreationTime CatalogEntry = errorfamily.NewCorruption(
		"wise.account.parse_creation_time",
		"account creation time could not be parsed",
	)
	// ErrAccountParseModificationTime is the catalog entry for "wise.account.parse_modification_time";
	// family Corruption (the response could not be interpreted).
	ErrAccountParseModificationTime CatalogEntry = errorfamily.NewCorruption(
		"wise.account.parse_modification_time",
		"account modification time could not be parsed",
	)
	// ErrAccountDetailsInvalidRequest is the catalog entry for "wise.account_details.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrAccountDetailsInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.account_details.invalid_request",
		"account details request is invalid",
	)
	// ErrAccountDetailsParseIdentification is the catalog entry for "wise.account_details.parse_identification";
	// family Corruption (the response could not be interpreted).
	ErrAccountDetailsParseIdentification CatalogEntry = errorfamily.NewCorruption(
		"wise.account_details.parse_identification",
		"account details identification could not be parsed",
	)
	// ErrActivityInvalidRequest is the catalog entry for "wise.activity.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrActivityInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.activity.invalid_request",
		"activity request is invalid",
	)
	// ErrActivityMap is the catalog entry for "wise.activity.map";
	// family Corruption (the response could not be interpreted).
	ErrActivityMap CatalogEntry = errorfamily.NewCorruption("wise.activity.map", "activity could not be mapped")
	// ErrBalanceInvalidRequest is the catalog entry for "wise.balance.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrBalanceInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.balance.invalid_request",
		"balance request is invalid",
	)
	// ErrBalanceParseCreationTime is the catalog entry for "wise.balance.parse_creation_time";
	// family Corruption (the response could not be interpreted).
	ErrBalanceParseCreationTime CatalogEntry = errorfamily.NewCorruption(
		"wise.balance.parse_creation_time",
		"balance creation time could not be parsed",
	)
	// ErrBalanceParseCurrency is the catalog entry for "wise.balance.parse_currency";
	// family Corruption (the response could not be interpreted).
	ErrBalanceParseCurrency CatalogEntry = errorfamily.NewCorruption(
		"wise.balance.parse_currency",
		"balance currency could not be parsed",
	)
	// ErrBalanceParseType is the catalog entry for "wise.balance.parse_type";
	// family Corruption (the response could not be interpreted).
	ErrBalanceParseType CatalogEntry = errorfamily.NewCorruption(
		"wise.balance.parse_type",
		"balance type could not be parsed",
	)
	// ErrDeliveryEstimateParseDate is the catalog entry for "wise.delivery_estimate.parse_date";
	// family Corruption (the response could not be interpreted).
	ErrDeliveryEstimateParseDate CatalogEntry = errorfamily.NewCorruption(
		"wise.delivery_estimate.parse_date",
		"delivery estimate date could not be parsed",
	)
	// ErrFundingParseStatus is the catalog entry for "wise.funding.parse_status";
	// family Corruption (the response could not be interpreted).
	ErrFundingParseStatus CatalogEntry = errorfamily.NewCorruption(
		"wise.funding.parse_status",
		"funding status could not be parsed",
	)
	// ErrFundingParseType is the catalog entry for "wise.funding.parse_type";
	// family Corruption (the response could not be interpreted).
	ErrFundingParseType CatalogEntry = errorfamily.NewCorruption(
		"wise.funding.parse_type",
		"funding type could not be parsed",
	)
	// ErrMoneyParse is the catalog entry for "wise.money.parse";
	// family Corruption (the response could not be interpreted).
	ErrMoneyParse CatalogEntry = errorfamily.NewCorruption("wise.money.parse", "money parse")
	// ErrOTTChannelUnsupported is the catalog entry for "wise.ott.channel_unsupported";
	// family Rejection (the request cannot be sent).
	ErrOTTChannelUnsupported CatalogEntry = errorfamily.NewRejection(
		"wise.ott.channel_unsupported",
		"OTT channel is not supported",
	)
	// ErrOTTDecode is the catalog entry for "wise.ott.decode";
	// family Corruption (the response could not be interpreted).
	ErrOTTDecode CatalogEntry = errorfamily.NewCorruption("wise.ott.decode", "OTT could not be decoded")
	// ErrOTTInvalidRequest is the catalog entry for "wise.ott.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrOTTInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.ott.invalid_request",
		"ott request is invalid",
	)
	// ErrOTTUncleared is the catalog entry for "wise.ott.uncleared";
	// family Rejection (the request cannot be sent).
	ErrOTTUncleared CatalogEntry = errorfamily.NewRejection(
		"wise.ott.uncleared",
		"OTT challenge was not cleared",
	)
	// ErrProfileInvalidRequest is the catalog entry for "wise.profile.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrProfileInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.profile.invalid_request",
		"profile request is invalid",
	)
	// ErrProfileParseCreatedAt is the catalog entry for "wise.profile.parse_created_at";
	// family Corruption (the response could not be interpreted).
	ErrProfileParseCreatedAt CatalogEntry = errorfamily.NewCorruption(
		"wise.profile.parse_created_at",
		"profile created at could not be parsed",
	)
	// ErrProfileParseType is the catalog entry for "wise.profile.parse_type";
	// family Corruption (the response could not be interpreted).
	ErrProfileParseType CatalogEntry = errorfamily.NewCorruption(
		"wise.profile.parse_type",
		"profile type could not be parsed",
	)
	// ErrQuoteInvalidRequest is the catalog entry for "wise.quote.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrQuoteInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.quote.invalid_request",
		"quote request is invalid",
	)
	// ErrQuoteParseCreated is the catalog entry for "wise.quote.parse_created";
	// family Corruption (the response could not be interpreted).
	ErrQuoteParseCreated CatalogEntry = errorfamily.NewCorruption(
		"wise.quote.parse_created",
		"quote created could not be parsed",
	)
	// ErrQuoteParseExpiration is the catalog entry for "wise.quote.parse_expiration";
	// family Corruption (the response could not be interpreted).
	ErrQuoteParseExpiration CatalogEntry = errorfamily.NewCorruption(
		"wise.quote.parse_expiration",
		"quote expiration could not be parsed",
	)
	// ErrQuoteParsePaymentOptionDelivery is the catalog entry for "wise.quote.parse_payment_option_delivery";
	// family Corruption (the response could not be interpreted).
	ErrQuoteParsePaymentOptionDelivery CatalogEntry = errorfamily.NewCorruption(
		"wise.quote.parse_payment_option_delivery",
		"quote payment option delivery could not be parsed",
	)
	// ErrQuoteParsePaymentOptionSource is the catalog entry for "wise.quote.parse_payment_option_source";
	// family Corruption (the response could not be interpreted).
	ErrQuoteParsePaymentOptionSource CatalogEntry = errorfamily.NewCorruption(
		"wise.quote.parse_payment_option_source",
		"quote payment option source could not be parsed",
	)
	// ErrQuoteParsePaymentOptionTarget is the catalog entry for "wise.quote.parse_payment_option_target";
	// family Corruption (the response could not be interpreted).
	ErrQuoteParsePaymentOptionTarget CatalogEntry = errorfamily.NewCorruption(
		"wise.quote.parse_payment_option_target",
		"quote payment option target could not be parsed",
	)
	// ErrQuoteParseRateExpiration is the catalog entry for "wise.quote.parse_rate_expiration";
	// family Corruption (the response could not be interpreted).
	ErrQuoteParseRateExpiration CatalogEntry = errorfamily.NewCorruption(
		"wise.quote.parse_rate_expiration",
		"quote rate expiration could not be parsed",
	)
	// ErrQuoteParseSourceCurrency is the catalog entry for "wise.quote.parse_source_currency";
	// family Corruption (the response could not be interpreted).
	ErrQuoteParseSourceCurrency CatalogEntry = errorfamily.NewCorruption(
		"wise.quote.parse_source_currency",
		"quote source currency could not be parsed",
	)
	// ErrQuoteParseTargetCurrency is the catalog entry for "wise.quote.parse_target_currency";
	// family Corruption (the response could not be interpreted).
	ErrQuoteParseTargetCurrency CatalogEntry = errorfamily.NewCorruption(
		"wise.quote.parse_target_currency",
		"quote target currency could not be parsed",
	)
	// ErrRatesEmptyResponse is the catalog entry for "wise.rates.empty_response";
	// family Corruption (the response could not be interpreted).
	ErrRatesEmptyResponse CatalogEntry = errorfamily.NewCorruption(
		"wise.rates.empty_response",
		"rates response is empty",
	)
	// ErrRatesInvalidRequest is the catalog entry for "wise.rates.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrRatesInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.rates.invalid_request",
		"rates request is invalid",
	)
	// ErrRatesParseSource is the catalog entry for "wise.rates.parse_source";
	// family Corruption (the response could not be interpreted).
	ErrRatesParseSource CatalogEntry = errorfamily.NewCorruption(
		"wise.rates.parse_source",
		"rates source could not be parsed",
	)
	// ErrRatesParseTarget is the catalog entry for "wise.rates.parse_target";
	// family Corruption (the response could not be interpreted).
	ErrRatesParseTarget CatalogEntry = errorfamily.NewCorruption(
		"wise.rates.parse_target",
		"rates target could not be parsed",
	)
	// ErrRatesParseTime is the catalog entry for "wise.rates.parse_time";
	// family Corruption (the response could not be interpreted).
	ErrRatesParseTime CatalogEntry = errorfamily.NewCorruption(
		"wise.rates.parse_time",
		"rates time could not be parsed",
	)
	// ErrRecipientInvalidRequest is the catalog entry for "wise.recipient.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrRecipientInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.recipient.invalid_request",
		"recipient request is invalid",
	)
	// ErrRecipientMap is the catalog entry for "wise.recipient.map";
	// family Corruption (the response could not be interpreted).
	ErrRecipientMap CatalogEntry = errorfamily.NewCorruption(
		"wise.recipient.map",
		"recipient could not be mapped",
	)
	// ErrRecipientParseCurrency is the catalog entry for "wise.recipient.parse_currency";
	// family Corruption (the response could not be interpreted).
	ErrRecipientParseCurrency CatalogEntry = errorfamily.NewCorruption(
		"wise.recipient.parse_currency",
		"recipient currency could not be parsed",
	)
	// ErrResponseDecode is the catalog entry for "wise.response.decode";
	// family Corruption (the response could not be interpreted).
	ErrResponseDecode CatalogEntry = errorfamily.NewCorruption(
		"wise.response.decode",
		"response could not be decoded",
	)
	// ErrTotalFundsInvalidRequest is the catalog entry for "wise.total_funds.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrTotalFundsInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.total_funds.invalid_request",
		"total funds request is invalid",
	)
	// ErrTransactionParseDate is the catalog entry for "wise.transaction.parse_date";
	// family Corruption (the response could not be interpreted).
	ErrTransactionParseDate CatalogEntry = errorfamily.NewCorruption(
		"wise.transaction.parse_date",
		"transaction date could not be parsed",
	)
	// ErrTransactionIDMissing is the catalog entry for "wise.transaction.id_missing";
	// family Corruption (the response could not be interpreted).
	ErrTransactionIDMissing CatalogEntry = errorfamily.NewCorruption(
		"wise.transaction.id_missing",
		"transaction has no ID",
	)
	// ErrTransactionsInvalidRequest is the catalog entry for "wise.transactions.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrTransactionsInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.transactions.invalid_request",
		"transactions request is invalid",
	)
	// ErrTransferInvalidRequest is the catalog entry for "wise.transfer.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrTransferInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.transfer.invalid_request",
		"transfer request is invalid",
	)
	// ErrTransferMap is the catalog entry for "wise.transfer.map";
	// family Corruption (the response could not be interpreted).
	ErrTransferMap CatalogEntry = errorfamily.NewCorruption("wise.transfer.map", "transfer could not be mapped")
	// ErrTransferParseCreated is the catalog entry for "wise.transfer.parse_created";
	// family Corruption (the response could not be interpreted).
	ErrTransferParseCreated CatalogEntry = errorfamily.NewCorruption(
		"wise.transfer.parse_created",
		"transfer created could not be parsed",
	)
	// ErrTransferParseCurrency is the catalog entry for "wise.transfer.parse_currency";
	// family Corruption (the response could not be interpreted).
	ErrTransferParseCurrency CatalogEntry = errorfamily.NewCorruption(
		"wise.transfer.parse_currency",
		"transfer currency could not be parsed",
	)
	// ErrTransferParsePaymentCreated is the catalog entry for "wise.transfer.parse_payment_created";
	// family Corruption (the response could not be interpreted).
	ErrTransferParsePaymentCreated CatalogEntry = errorfamily.NewCorruption(
		"wise.transfer.parse_payment_created",
		"transfer payment created could not be parsed",
	)
	// ErrTransferParsePaymentCurrency is the catalog entry for "wise.transfer.parse_payment_currency";
	// family Corruption (the response could not be interpreted).
	ErrTransferParsePaymentCurrency CatalogEntry = errorfamily.NewCorruption(
		"wise.transfer.parse_payment_currency",
		"transfer payment currency could not be parsed",
	)
	// ErrTransferParsePaymentUpdated is the catalog entry for "wise.transfer.parse_payment_updated";
	// family Corruption (the response could not be interpreted).
	ErrTransferParsePaymentUpdated CatalogEntry = errorfamily.NewCorruption(
		"wise.transfer.parse_payment_updated",
		"transfer payment updated could not be parsed",
	)
	// ErrUserInvalidRequest is the catalog entry for "wise.user.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrUserInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.user.invalid_request",
		"user request is invalid",
	)
	// ErrUserParseDateOfBirth is the catalog entry for "wise.user.parse_date_of_birth";
	// family Corruption (the response could not be interpreted).
	ErrUserParseDateOfBirth CatalogEntry = errorfamily.NewCorruption(
		"wise.user.parse_date_of_birth",
		"user date of birth could not be parsed",
	)
	// ErrWebhookDecode is the catalog entry for "wise.webhook.decode";
	// family Corruption (the response could not be interpreted).
	ErrWebhookDecode CatalogEntry = errorfamily.NewCorruption(
		"wise.webhook.decode",
		"webhook could not be decoded",
	)
	// ErrWebhookInvalidRequest is the catalog entry for "wise.webhook.invalid_request";
	// family Rejection (the request cannot be sent).
	ErrWebhookInvalidRequest CatalogEntry = errorfamily.NewRejection(
		"wise.webhook.invalid_request",
		"webhook request is invalid",
	)
	// ErrCurrencyInvalidLength is the catalog entry for "wise.currency.invalid_length";
	// family Rejection (the request cannot be sent).
	ErrCurrencyInvalidLength CatalogEntry = errorfamily.NewRejection(
		"wise.currency.invalid_length",
		"currency must be exactly 3 letters",
	)
	// ErrCurrencyInvalidCharacters is the catalog entry for "wise.currency.invalid_characters";
	// family Rejection (the request cannot be sent).
	ErrCurrencyInvalidCharacters CatalogEntry = errorfamily.NewRejection(
		"wise.currency.invalid_characters",
		"currency must be uppercase ASCII letters",
	)
	// ErrWebhookKeyNoPEMBlock is the catalog entry for "wise.webhook_key.no_pem_block";
	// family Rejection (the request cannot be sent).
	ErrWebhookKeyNoPEMBlock CatalogEntry = errorfamily.NewRejection(
		"wise.webhook_key.no_pem_block",
		"webhook public key has no PEM block",
	)
	// ErrWebhookKeyNotRSA is the catalog entry for "wise.webhook_key.not_rsa";
	// family Rejection (the request cannot be sent).
	ErrWebhookKeyNotRSA CatalogEntry = errorfamily.NewRejection(
		"wise.webhook_key.not_rsa",
		"webhook public key is not RSA",
	)
)

SDK failure catalog: one named entry per failure mode the SDK itself produces, as opposed to the Wise verdicts above. Every entry is a go-error-family value, so it classifies (Rejection: the caller's request cannot be sent; Corruption: Wise's response could not be interpreted) and carries a stable machine code. Runtime errors are DERIVED from an entry through [newCoded] or [wrapCoded]: they keep the entry's code and family and add the detail message, so errors.Is(err, ErrBalanceInvalidRequest) matches through any wrap chain whatever the detail says. The two tiers of matching are errorfamily.Classify(err) (which family) and errors.Is (which entry). An entry is the only way to mint a coded SDK error; there is no string code to typo.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the Wise API client.

func New

func New(apiKey string, opts ...Option) *Client

New creates a new Wise API client with the given API key and options.

An empty apiKey is passed through: requests are sent without the Authorization header (Wise's unauthenticated endpoints, such as the public quote preview, still work). Validate credentials explicitly with Authenticate.

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context) error

Authenticate validates the API key by calling ListProfiles.

func (*Client) CancelTransfer added in v0.8.0

func (c *Client) CancelTransfer(ctx context.Context, transferID TransferID) (*Transfer, error)

CancelTransfer cancels a transfer by ID. A transfer can only be cancelled if it has not been processed (not in funds_converted or later state) and has no processing problems. Cancellation is final.

Example

Cancel a transfer that has not been processed yet. Cancellation is final.

package main

import (
	"context"
	"errors"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	transfer, err := client.CancelTransfer(context.Background(), wise.NewTransferID(16521634))
	if err != nil {
		if _, ok := errors.AsType[*wise.NotFoundError](err); ok {
			log.Fatal("transfer does not exist")
		}

		log.Fatal(err)
	}

	fmt.Println(transfer.Status)
}

func (*Client) ClearSCAChallenge added in v0.11.0

func (c *Client) ClearSCAChallenge(
	ctx context.Context,
	ott OneTimeToken,
	channel OTTChannel,
	code OTTCodeProvider,
) (*OTTStatus, error)

ClearSCAChallenge clears every required challenge of an OTT over one phone channel: it inspects the status, and per pending required challenge triggers the OTP, asks code for it, and verifies it, until the status reports cleared or an endpoint fails. Challenges that cannot be satisfied over the channel (e.g. a PIN-only challenge) surface as a Rejection naming the available types — clear those in the Wise web app by viewing a statement instead.

Example

Clear a pending SCA challenge from the terminal: trigger the SMS, prompt the user for the code it delivered, verify, and confirm nothing is left.

package main

import (
	"context"
	"errors"
	"fmt"
	"log"
	"time"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("api-key")

	_, err := client.GetStatement(context.Background(), wise.GetStatementRequest{
		ProfileID: wise.NewProfileID(12345),
		BalanceID: wise.NewBalanceID(100),
		Currency:  wise.Currency("EUR"),
		From:      time.Date(2026, 9, 1, 0, 0, 0, 0, time.UTC),
		To:        time.Date(2026, 9, 14, 0, 0, 0, 0, time.UTC),
		Format:    wise.StatementFormatPDF,
	})
	if err != nil {
		if sca, ok := errors.AsType[*wise.SCAChallengeError](err); ok {
			status, clearErr := client.ClearSCAChallenge(
				context.Background(),
				sca.TwoFAApprovalToken(),
				wise.OTTChannelSMS,
				func(_ context.Context, _ wise.OTTChallenge, _ wise.OTTChannel, phoneHint string) (string, error) {
					fmt.Printf("code sent to %s — enter OTP: ", phoneHint)

					var code string
					if _, scanErr := fmt.Scanln(&code); scanErr != nil {
						return "", scanErr
					}

					return code, nil
				},
			)
			if clearErr != nil {
				log.Fatal(clearErr)
			}

			fmt.Println("cleared:", status.Cleared())
		}
	}
}

func (*Client) CreateBalance added in v0.9.0

func (c *Client) CreateBalance(ctx context.Context, req CreateBalanceRequest) (*Balance, error)

CreateBalance opens a new balance for a profile (POST /v4/profiles/{profileId}/balances) and returns it. Wise requires the X-idempotence-uuid header on this endpoint.

Example

Open a savings balance in USD. Savings balances require a name.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	balance, err := client.CreateBalance(context.Background(), wise.CreateBalanceRequest{
		ProfileID: wise.NewProfileID(12345),
		Currency:  wise.Currency("USD"),
		Type:      wise.BalanceTypeSavings,
		Name:      "Vacation",
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(balance.ID, balance.Name, balance.Amount)
}

func (*Client) CreateProfileWebhookSubscription added in v0.11.0

func (c *Client) CreateProfileWebhookSubscription(
	ctx context.Context,
	profileID ProfileID,
	req CreateWebhookSubscriptionRequest,
) (*WebhookSubscription, error)

CreateProfileWebhookSubscription registers a webhook subscription on a profile (POST /2027Q1/profiles/{profileId}/subscriptions): Wise will POST an event envelope to req.Delivery.URL whenever the req.TriggerOn event occurs for anything the profile owns.

Name, TriggerOn, and Delivery (version + URL) are validated client-side; the URL must be HTTPS. The profile's user token owns the subscription — application-scoped subscriptions need a client-credentials token and are not covered by this SDK yet.

Example

Register a webhook subscription so Wise POSTs an event envelope to your HTTPS endpoint whenever the chosen event occurs, then delete it when done.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")
	profileID := wise.NewProfileID(12345)

	sub, err := client.CreateProfileWebhookSubscription(context.Background(), profileID,
		wise.CreateWebhookSubscriptionRequest{
			Name:      "Payout watcher",
			TriggerOn: wise.WebhookEventTransfersStateChange,
			Delivery: wise.WebhookDelivery{
				Version: "4.0.0",
				URL:     "https://example.com/hooks/wise",
			},
		})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("registered", sub.ID.Get(), "for", sub.TriggerOn)

	// Later: stop the deliveries.
	err = client.DeleteProfileWebhookSubscription(context.Background(), profileID, sub.ID)
	if err != nil {
		log.Fatal(err)
	}
}

func (*Client) CreateQuote added in v0.8.0

func (c *Client) CreateQuote(
	ctx context.Context,
	profileID ProfileID,
	req CreateQuoteRequest,
) (*Quote, error)

CreateQuote creates an authenticated quote for a profile. The quote locks the mid-market rate for 30 minutes and can be used to create a transfer.

Example

Create an authenticated quote, guard against BLOCKED notices, and inspect the payment options before creating a transfer.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	quote, err := client.CreateQuote(context.Background(), wise.NewProfileID(12345),
		wise.CreateQuoteRequest{
			SourceCurrency: wise.Currency("EUR"),
			TargetCurrency: wise.Currency("USD"),
			SourceAmount:   &wise.Money{Cents: 100_000, Currency: wise.Currency("EUR")},
			PreferredPayIn: wise.PayInBalance,
			PayOut:         wise.PayOutBankTransfer,
		})
	if err != nil {
		log.Fatal(err)
	}

	for _, notice := range quote.Notices {
		if notice.Type == wise.QuoteNoticeTypeBlocked {
			log.Fatalf("quote blocked: %s", notice.Text)
		}
	}

	for _, option := range quote.PaymentOptions {
		fmt.Printf("%s -> %s: fee %s, arrives %s\n",
			option.PayIn, option.PayOut, option.Source.Currency, option.FormattedEstimatedDelivery)
	}
}

func (*Client) CreateRecipient added in v0.8.0

func (c *Client) CreateRecipient(
	ctx context.Context,
	req CreateRecipientRequest,
) (*Recipient, error)

CreateRecipient creates a new recipient account for a profile.

func (*Client) CreateThirdPartyTransfer added in v0.14.0

func (c *Client) CreateThirdPartyTransfer(
	ctx context.Context,
	req CreateThirdPartyTransferRequest,
) (*ThirdPartyTransfer, error)

CreateThirdPartyTransfer creates an originator transfer (POST /v1/profiles/{profileId}/third-party-transfers). Requires the originator data block — a standard CreateTransfer cannot carry one.

Example

Move money on behalf of a third-party originator: your own quote funds the transfer, but compliance data names the real originator. Reuse the same Originator.Reference for every transfer of one originator — Wise keys compliance on it — and OriginalTransferID for idempotency.

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	transfer, err := client.CreateThirdPartyTransfer(context.Background(), wise.CreateThirdPartyTransferRequest{
		ProfileID:          wise.NewProfileID(12345),
		OriginalTransferID: "our-originator-transfer-correlation-id",
		TargetAccount:      wise.NewRecipientID(67890),
		QuoteID:            wise.NewQuoteID("6d3b3cf1-8f2a-4b7e-9c1d-2e5f6a7b8c9d"),
		Reference:          "INV-2026-014",
		Originator: wise.Originator{
			LegalEntityType: wise.OriginatorLegalEntityTypePrivate,
			Reference:       "originator-ref-42",
			Name: wise.OriginatorName{
				GivenName:  "Ana",
				FamilyName: "Martins",
			},
			DateOfBirth: time.Date(1988, 4, 12, 0, 0, 0, 0, time.UTC),
			Nationality: "PT",
			Address: wise.OriginatorAddress{
				FirstLine:   "Rua das Flores 12",
				City:        "Lisboa",
				CountryCode: "PT",
				PostCode:    "1200-192",
			},
		},
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(transfer.ID, transfer.Status, transfer.Source, transfer.Target)
}

func (*Client) CreateTransfer added in v0.8.0

func (c *Client) CreateTransfer(
	ctx context.Context,
	req CreateTransferRequest,
) (*Transfer, error)

CreateTransfer creates a new transfer from a quote to a recipient account.

customerTransactionId is required for idempotency and must be a UUID unique to this transfer attempt. Reusing the same value with the same targetAccount and quoteUuid will return the existing transfer instead of creating a duplicate.

func (*Client) CreateUnauthenticatedQuote added in v0.8.0

func (c *Client) CreateUnauthenticatedQuote(
	ctx context.Context,
	req CreateQuoteRequest,
) (*Quote, error)

CreateUnauthenticatedQuote creates a quote without an API token — a public rate preview. The returned quote has no ID and cannot be used to create a transfer; use CreateQuote for that.

func (*Client) DeleteProfileWebhookSubscription added in v0.11.0

func (c *Client) DeleteProfileWebhookSubscription(
	ctx context.Context,
	profileID ProfileID,
	subscriptionID WebhookSubscriptionID,
) error

DeleteProfileWebhookSubscription removes a webhook subscription (DELETE /2027Q1/profiles/{profileId}/subscriptions/{subscriptionId}). Wise acknowledges with 204 No Content; deleting an unknown subscription ID is a 404, classified as *NotFoundError. Deleting stops deliveries immediately.

func (*Client) FundTransfer added in v0.9.0

func (c *Client) FundTransfer(
	ctx context.Context,
	profileID ProfileID,
	transferID TransferID,
) (*FundTransferResult, error)

FundTransfer funds a created transfer from the profile's Wise balance (POST /v1/profiles/{profileId}/transfers/{transferId}/payments), triggering processing of the payout. This is the final step of the transfer flow: quote, create recipient, create transfer, fund.

Wise debits the transfer's source balance; the funding succeeds only if it holds the full amount. An underfunded balance is not an error return but a result with Status FundingStatusRejected and ErrorCode FundingErrorCodeBalanceInsufficientFunds — top up and call FundTransfer again.

The endpoint is SCA-protected for profiles registered in the UK/EEA: without approval it fails with *SCAChallengeError (see WithSCAApprovalToken).

Example

Fund a created transfer from the profile's Wise balance — the final step of the transfer flow. A rejected funding is a result, not an error.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	funding, err := client.FundTransfer(
		context.Background(), wise.NewProfileID(12345), wise.NewTransferID(16521634),
	)
	if err != nil {
		log.Fatal(err)
	}

	if funding.Status == wise.FundingStatusRejected {
		if funding.ErrorCode == wise.FundingErrorCodeBalanceInsufficientFunds {
			log.Println("balance too low — top up and call FundTransfer again")

			return
		}

		log.Fatalf("funding rejected (%s): %s", funding.ErrorCode, funding.ErrorMessage)
	}

	fmt.Println(funding.Status)
}

func (*Client) GetBalance

func (c *Client) GetBalance(
	ctx context.Context,
	profileID ProfileID,
	balanceID BalanceID,
) (*Balance, error)

GetBalance returns a specific balance by ID within a profile via the direct per-balance endpoint. Unlike ListBalances, it does not filter: hidden and invested balances are retrievable individually.

Example

Read one balance by ID. Unlike ListBalances, the direct endpoint also returns hidden and invested balances.

package main

import (
	"context"
	"errors"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	balance, err := client.GetBalance(
		context.Background(), wise.NewProfileID(12345), wise.NewBalanceID(100),
	)
	if err != nil {
		if _, ok := errors.AsType[*wise.NotFoundError](err); ok {
			log.Fatal("balance does not exist")
		}

		log.Fatal(err)
	}

	fmt.Println(balance.Currency, balance.Amount)
}

func (*Client) GetBankAccountDetails added in v0.9.0

func (c *Client) GetBankAccountDetails(
	ctx context.Context,
	id AccountDetailsID,
) (*AccountDetails, error)

GetBankAccountDetails returns one set of receiving bank details by its own ID (GET /{version}/balances/account-details/{id}; the 2027Q1 shape that replaced GET /v1/profiles/{profileId}/account-details).

Example

Read one set of receiving bank details by its own ID and pull the labeled key values (IBAN, sort code, routing number) out of the identification block.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	detail, err := client.GetBankAccountDetails(
		context.Background(), wise.NewAccountDetailsID(14000001),
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(detail.State, detail.AccountHolderName, detail.Country)

	switch {
	case detail.Identification.GB != nil:
		fmt.Println(detail.Identification.GB.SortCode, detail.Identification.GB.AccountNumber)
	case detail.Identification.BE != nil:
		fmt.Println(detail.Identification.BE.IBAN)
	case detail.Identification.US != nil:
		fmt.Println(detail.Identification.US.RoutingNumber, detail.Identification.US.AccountNumber)
	}
}

func (*Client) GetDeliveryEstimate added in v0.8.0

func (c *Client) GetDeliveryEstimate(
	ctx context.Context,
	transferID TransferID,
	timezone string,
) (*DeliveryEstimate, error)

GetDeliveryEstimate returns the live delivery estimate for a transfer — the time at which Wise currently expects the transfer to arrive in the beneficiary's bank account. The estimate is not a guarantee, but Wise keeps it as accurate as possible as the transfer progresses.

timezone optionally selects the IANA timezone used for the formatted estimate text; it defaults to UTC when empty.

Example

Fetch the expected delivery time for a transfer. The timezone parameter is optional; it only affects the pre-formatted text, not the timestamp.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	estimate, err := client.GetDeliveryEstimate(
		context.Background(), wise.NewTransferID(16521634), "Europe/Berlin",
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("expected arrival: %s (%s)\n",
		estimate.EstimatedDeliveryDate, estimate.FormattedEstimatedDeliveryDate)
}

func (*Client) GetExchangeRate added in v0.8.0

func (c *Client) GetExchangeRate(
	ctx context.Context,
	source, target Currency,
	atTime time.Time,
) (*ExchangeRate, error)

GetExchangeRate returns the current or historical exchange rate between two currencies. If at is the zero time, the current rate is returned; otherwise the rate at the requested time is returned (UTC is recommended).

func (*Client) GetMe added in v0.9.0

func (c *Client) GetMe(ctx context.Context) (*User, error)

GetMe returns the user account that owns the client's API token — the identity behind ListProfiles' userId values.

Example

Resolve the identity behind the API token — the user that owns the profiles ListProfiles returns.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	me, err := client.GetMe(context.Background())
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(me.ID, me.Email)
}

func (*Client) GetMultiCurrencyAccount added in v0.9.0

func (c *Client) GetMultiCurrencyAccount(
	ctx context.Context,
	profileID ProfileID,
) (*MultiCurrencyAccount, error)

GetMultiCurrencyAccount returns the profile's Multi-Currency Account (GET /v1/profiles/{profileId}/multi-currency-account).

Example

Read the Multi-Currency Account — the holder of the currency balances. Its RecipientID is a real recipient: transfer to it to top up the account.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	account, err := client.GetMultiCurrencyAccount(
		context.Background(), wise.NewProfileID(12345),
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("top up via recipient", account.RecipientID)
}

func (*Client) GetOTTStatus added in v0.11.0

func (c *Client) GetOTTStatus(ctx context.Context, ott OneTimeToken) (*OTTStatus, error)

GetOTTStatus retrieves the challenge state of a one-time token (GET /2027Q1/one-time-token/status): which challenges must be passed to clear it, their types and alternatives, the remaining validity, and the authorized action. The spec scopes the call to OAuth user tokens (security: [{"UserToken": []}]); the OTT is the one issued in the x-2fa-approval header of an SCAChallengeError. Wire-proven 2026-11-25: a personal API token gets ott_not_found for any statement-challenge token, however fresh — the guide "Personal API tokens" excludes statements for accounts outside US/CA/AU/NZ/SG/MY. Treat not-found as "clear via Wise app approval", never a retryable race.

Example

Inspect a Strong Customer Authentication challenge carried by a statement call: which challenges are pending, over which channels they can be cleared, and how long the one-time token stays valid.

package main

import (
	"context"
	"errors"
	"fmt"
	"log"
	"time"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("api-key")

	resp, err := client.ListTransactions(context.Background(), wise.ListTransactionsRequest{
		ProfileID: wise.NewProfileID(12345),
		BalanceID: wise.NewBalanceID(100),
		Currency:  wise.Currency("EUR"),
		From:      time.Date(2026, 9, 1, 0, 0, 0, 0, time.UTC),
		To:        time.Date(2026, 9, 14, 0, 0, 0, 0, time.UTC),
	})
	if err != nil {
		if sca, ok := errors.AsType[*wise.SCAChallengeError](err); ok {
			status, statusErr := client.GetOTTStatus(context.Background(), sca.TwoFAApprovalToken())
			if statusErr != nil {
				log.Fatal(statusErr)
			}

			fmt.Println(status.ActionType, status.Validity, status.Cleared())
		}

		return
	}

	fmt.Println(len(resp.Transactions))
}

func (*Client) GetProfile added in v0.8.0

func (c *Client) GetProfile(ctx context.Context, profileID ProfileID) (*Profile, error)

GetProfile returns a single profile by ID.

func (*Client) GetProfileWebhookSubscription added in v0.11.0

func (c *Client) GetProfileWebhookSubscription(
	ctx context.Context,
	profileID ProfileID,
	subscriptionID WebhookSubscriptionID,
) (*WebhookSubscription, error)

GetProfileWebhookSubscription returns a single webhook subscription by ID (GET /2027Q1/profiles/{profileId}/subscriptions/{subscriptionId}). An unknown subscription ID is a 404, classified as *NotFoundError.

func (*Client) GetQuote added in v0.8.0

func (c *Client) GetQuote(
	ctx context.Context,
	profileID ProfileID,
	quoteID QuoteID,
) (*Quote, error)

GetQuote returns an existing authenticated quote by ID.

func (*Client) GetQuoteAccountRequirements added in v0.9.0

func (c *Client) GetQuoteAccountRequirements(
	ctx context.Context,
	req QuoteAccountRequirementsRequest,
) ([]AccountRequirement, error)

GetQuoteAccountRequirements returns the recipient-account fields required for the currency corridor of an authenticated quote, one dynamic form per available payout route. It bridges quotes to recipients: Type identifies the route (CreateRecipientRequest.Type), and the Fields forms describe which Details keys that route needs, with allowed select values and validation metadata.

The SDK sends Accept-Minor-Version: 1, as Wise recommends for all new integrations, so recipient name and email fields are included.

func (*Client) GetRecipient added in v0.8.0

func (c *Client) GetRecipient(ctx context.Context, recipientID RecipientID) (*Recipient, error)

GetRecipient returns a single recipient account by ID.

func (*Client) GetStatement added in v0.9.0

func (c *Client) GetStatement(ctx context.Context, req GetStatementRequest) ([]byte, error)

GetStatement downloads a balance statement as a file in the requested format (CSV, PDF, XLSX, CAMT.053 XML, MT940, or QIF) and returns its raw bytes. Use ListTransactions for the typed JSON statement instead.

The endpoint is SCA-protected for UK/EEA profiles.

Example

Download a balance statement as a file — here a PDF for archival. The interval must not exceed 469 days; use ListTransactions for the typed JSON statement instead.

package main

import (
	"context"
	"log"
	"os"
	"time"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	pdf, err := client.GetStatement(context.Background(), wise.GetStatementRequest{
		ProfileID: wise.NewProfileID(12345),
		BalanceID: wise.NewBalanceID(100),
		Currency:  wise.Currency("EUR"),
		From:      time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC),
		To:        time.Date(2026, 3, 31, 23, 59, 59, 0, time.UTC),
		Format:    wise.StatementFormatPDF,
	})
	if err != nil {
		log.Fatal(err)
	}

	if err := os.WriteFile("statement-q1.pdf", pdf, 0o600); err != nil {
		log.Fatal(err)
	}
}

func (*Client) GetThirdPartyTransfer added in v0.14.0

func (c *Client) GetThirdPartyTransfer(
	ctx context.Context,
	profileID ProfileID,
	transferID TransferID,
) (*ThirdPartyTransfer, error)

GetThirdPartyTransfer returns an originator transfer by ID (GET /v1/profiles/{profileId}/third-party-transfers/{transferId}).

Example

Fetch a third-party (originator) transfer by profile and transfer ID.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	transfer, err := client.GetThirdPartyTransfer(
		context.Background(), wise.NewProfileID(12345), wise.NewTransferID(987654),
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(transfer.Status, transfer.OriginalTransferID, transfer.HasActiveIssues)
}

func (*Client) GetTotalFunds added in v0.9.0

func (c *Client) GetTotalFunds(
	ctx context.Context,
	profileID ProfileID,
	currency Currency,
) (*TotalFunds, error)

GetTotalFunds returns a profile-wide funds overview converted to the given currency (GET /v4/profiles/{profileId}/total-funds/{currency}).

Example

Overview of everything a profile owns, converted to one currency: Worth is cash plus invested portfolio valuation, Available is cash plus overdraft.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	funds, err := client.GetTotalFunds(
		context.Background(), wise.NewProfileID(12345), wise.Currency("EUR"),
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("worth: %s, available: %s\n", funds.Worth, funds.Available)
}

func (*Client) GetTransfer added in v0.8.0

func (c *Client) GetTransfer(ctx context.Context, transferID TransferID) (*Transfer, error)

GetTransfer returns a single transfer by ID.

Example

Fetch one transfer by ID and report how much moved where. Transfer.Source and Transfer.Target carry the amounts (Money pairs cents with currency); there are no SourceValue/TargetValue fields on the Transfer type.

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/larsartmann/wise-go"
)

func main() {
	ctx := context.Background()
	client := wise.New(os.Getenv("WISE_API_KEY"))

	transfer, err := client.GetTransfer(ctx, wise.NewTransferID(16521634))
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(transfer.Status, transfer.Source, transfer.Target)
}

func (*Client) GetTransferNOC added in v0.14.0

func (c *Client) GetTransferNOC(ctx context.Context, transferID TransferID) ([]byte, error)

GetTransferNOC downloads the no-objection certificate for a transfer (GET /v1/transfers/{transferId}/documents/noc) — the document INR recipients use to obtain a FIRC from their bank.

The endpoint answers 404 (*NotFoundError) until the transfer reaches outgoing_payment_sent; treat that as "not issued yet", not a hard failure.

Example

Download the no-objection certificate (the Indian FIRC document) for a transfer into India. 404 before payout means it has not been issued yet.

package main

import (
	"context"
	"log"
	"os"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	noc, err := client.GetTransferNOC(context.Background(), wise.NewTransferID(987654))
	if err != nil {
		log.Fatal(err)
	}

	if err := os.WriteFile("transfer-987654-noc.pdf", noc, 0o600); err != nil {
		log.Fatal(err)
	}
}

func (*Client) GetTransferPayoutInfo added in v0.10.0

func (c *Client) GetTransferPayoutInfo(ctx context.Context, transferID TransferID) (*TransferPayoutInfo, error)

GetTransferPayoutInfo returns the banking-partner payout information for a transfer (GET /v1/transfers/{transferId}/invoices/bankingpartner): processor, delivery mode, the partner bank's tracking reference, and the SWIFT MT103 message when the corridor produced one.

MT103 is nil when no SWIFT message exists for the transfer. The endpoint is not SCA-protected.

Example

Fetch the SWIFT MT103 proof-of-payment for a transfer. MT103 is nil for non-SWIFT corridors.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	info, err := client.GetTransferPayoutInfo(context.Background(), wise.NewTransferID(987654))
	if err != nil {
		log.Fatal(err)
	}

	if info.MT103 != nil {
		fmt.Println("delivery mode:", info.DeliveryMode)
	}
}

func (*Client) GetTransferReceipt added in v0.10.0

func (c *Client) GetTransferReceipt(ctx context.Context, transferID TransferID) ([]byte, error)

GetTransferReceipt downloads the branded confirmation receipt for a transfer as a PDF (GET /v1/transfers/{transferId}/receipt.pdf) and returns its raw bytes.

Wise only issues receipts once a transfer has been paid out: for a transfer that never reached the outgoing_payment_sent state (or an unknown ID) the endpoint answers 404, classified as *NotFoundError. The endpoint is not SCA-protected and is available to personal API tokens in all regions.

Example

Download the branded confirmation receipt for a paid-out transfer. Wise answers 404 until the transfer reached outgoing_payment_sent; treat *wise.NotFoundError as "no receipt (yet)", not as a hard failure.

package main

import (
	"context"
	"log"
	"os"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	pdf, err := client.GetTransferReceipt(context.Background(), wise.NewTransferID(987654))
	if err != nil {
		log.Fatal(err)
	}

	if err := os.WriteFile("transfer-987654-receipt.pdf", pdf, 0o600); err != nil {
		log.Fatal(err)
	}
}

func (*Client) GetUSCombinedReceipt added in v0.14.0

func (c *Client) GetUSCombinedReceipt(ctx context.Context, transferID TransferID) ([]byte, error)

GetUSCombinedReceipt downloads the US combined disclosure receipt for a transfer (GET /v3/transfers/{transferId}/us-combined-receipt.pdf). US retail consumers must use this receipt instead of the standard GetTransferReceipt; note the /v3/ version prefix Wise puts on this path.

The document becomes available at incoming_payment_initiated and again at outgoing_payment_sent; a 404 (*NotFoundError) before that means "not issued yet", not a hard failure.

Example

Download the US combined receipt (a PDF combining transfer confirmation and funding proof, required by some US institutions) and save it to disk. 404 means the receipt does not exist yet, not that the transfer is gone.

package main

import (
	"context"
	"log"
	"os"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	pdf, err := client.GetUSCombinedReceipt(context.Background(), wise.NewTransferID(987654))
	if err != nil {
		log.Fatal(err)
	}

	if err := os.WriteFile("transfer-987654-us-combined-receipt.pdf", pdf, 0o600); err != nil {
		log.Fatal(err)
	}
}

func (*Client) GetUser added in v0.9.0

func (c *Client) GetUser(ctx context.Context, userID UserID) (*User, error)

GetUser returns a user account by ID. Personal API tokens can only read their own user; platform tokens may read their customers'.

Example

Read a user by ID. Personal API tokens can only read their own user.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	user, err := client.GetUser(context.Background(), wise.NewUserID(101))
	if err != nil {
		log.Fatal(err)
	}

	if user.Details != nil && !user.Details.DateOfBirth.IsZero() {
		fmt.Println(user.Name, user.Details.DateOfBirth.Year())
	}
}

func (*Client) Health

func (c *Client) Health(ctx context.Context) error

Health reports whether the client can reach the Wise API and its credentials are accepted, by running an authenticated ListProfiles call through the retry executor. It is a readiness probe, not a cheap liveness check: a *RateLimitError proves reachability (the API answered, under throttling), an *AuthError proves reachability with bad credentials, and the worst case spends the full default budget before returning — 4 attempts x 30s per-attempt timeout plus up to 3 x 5s of honored Retry-After delays (2 min 15 s) — unless the caller bounds ctx with a deadline. For a single-attempt credential check use VerifyCredentials.

Example

Health is the readiness probe: an authenticated ListProfiles call through the retry executor. Bound it with a context deadline — the default budget is 4 attempts x 30s plus honored Retry-After waits (2 min 15 s worst case).

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
	err := client.Health(ctx)

	cancel()

	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("wise API reachable")
}

func (*Client) ListActivities added in v0.18.0

func (c *Client) ListActivities(ctx context.Context, req ListActivitiesRequest) (*ActivityPage, error)

ListActivities returns one page of a profile's activity feed (GET /v1/profiles/{profileId}/activities): snapshots of performed actions such as transfers, card payments, deposits, and conversions, newest first.

The endpoint is not SCA-protected and serves a personal API token (live 2026-11-26 on five profiles: 200 for each, including four whose balance statements answer 403). It is the surface behind Wise's wise_list_activities MCP tool. See Activity for what the feed is and is not.

Example

ListActivities reads one page of a profile's activity feed: snapshots of transfers, card payments, deposits and conversions, newest first. The feed is display-oriented visibility, not the statement ledger.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")
	profileID := wise.NewProfileID(12345)

	page, err := client.ListActivities(context.Background(), wise.ListActivitiesRequest{
		ProfileID: profileID,
		Size:      100,
	})
	if err != nil {
		log.Fatal(err)
	}

	for _, activity := range page.Activities {
		amount := activity.PrimaryAmount.Text
		if !activity.PrimaryAmount.Present {
			amount = "n/a"
		}

		fmt.Printf("%s %s %s\n", activity.CreatedOn.Format("2006-01-02"), activity.Type, amount)
	}

	// page.NextCursor is "" on the last page; pass it as Cursor to continue.
}

func (*Client) ListBalances

func (c *Client) ListBalances(ctx context.Context, profileID ProfileID) ([]Balance, error)

ListBalances returns all balances for a profile.

Only visible, non-investment balances are returned. Hidden and invested balances are retrievable individually via GetBalance, which reads the direct per-balance endpoint without filtering.

func (*Client) ListCurrencies added in v0.9.0

func (c *Client) ListCurrencies(ctx context.Context) ([]CurrencyInfo, error)

ListCurrencies returns every currency Wise allows for transfers (GET /v1/currencies). The endpoint is public and needs no authentication.

Example

List every currency Wise supports — public reference data, handy for populating currency pickers.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	currencies, err := client.ListCurrencies(context.Background())
	if err != nil {
		log.Fatal(err)
	}

	for _, currency := range currencies {
		if currency.SupportsDecimals {
			fmt.Println(currency.Code, currency.Symbol)
		}
	}
}

func (*Client) ListProfileWebhookSubscriptions added in v0.11.0

func (c *Client) ListProfileWebhookSubscriptions(
	ctx context.Context,
	profileID ProfileID,
) ([]WebhookSubscription, error)

ListProfileWebhookSubscriptions returns every webhook subscription registered on a profile (GET /2027Q1/profiles/{profileId}/subscriptions). Wise returns the complete set in a single response (no pagination).

Example

List the webhook subscriptions registered on a profile — e.g. to audit what still delivers where, or to find an existing subscription before creating a duplicate.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	subs, err := client.ListProfileWebhookSubscriptions(context.Background(), wise.NewProfileID(12345))
	if err != nil {
		log.Fatal(err)
	}

	for _, sub := range subs {
		fmt.Printf("%s -> %s (%s)\n", sub.Name, sub.Delivery.URL, sub.TriggerOn)
	}
}

func (*Client) ListProfiles

func (c *Client) ListProfiles(ctx context.Context) ([]Profile, error)

ListProfiles returns all profiles for the authenticated user.

func (*Client) ListRecipients added in v0.8.0

func (c *Client) ListRecipients(
	ctx context.Context,
	req ListRecipientsRequest,
) ([]Recipient, error)

ListRecipients returns every recipient account of a profile, following the page envelope's seekPositionForNext cursor until the last page.

func (*Client) ListTransactions

func (c *Client) ListTransactions(
	ctx context.Context,
	req ListTransactionsRequest,
) (*ListTransactionsResponse, error)

ListTransactions returns transactions for a balance within a time range. Wise returns all transactions in a single response (no pagination).

func (*Client) ListTransferPayments added in v0.14.0

func (c *Client) ListTransferPayments(
	ctx context.Context,
	transferID TransferID,
) ([]TransferPayment, error)

ListTransferPayments returns the completed payments used to fund a transfer (GET /v1/transfers/{transferId}/payments). Usually a single payment per transfer; an empty result means the transfer has no completed funding yet.

Example

List the completed payments that funded a transfer. Usually a single payment; an empty result means the transfer is not funded (yet).

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	payments, err := client.ListTransferPayments(context.Background(), wise.NewTransferID(987654))
	if err != nil {
		log.Fatal(err)
	}

	for _, payment := range payments {
		fmt.Println(payment.ID, payment.Method, payment.Amount)
	}
}

func (*Client) ListTransfers added in v0.7.0

func (c *Client) ListTransfers(ctx context.Context, req ListTransfersRequest) ([]Transfer, error)

ListTransfers returns the transfers for a profile, automatically paginating through the complete result set in pages of 100 (Wise's per-request maximum). Results are ordered by creation date, newest first (Wise API order).

Unlike balance statements, the transfers endpoint is not SCA-protected and is available to personal API tokens in all regions.

Example

List recent transfers newest-first, then fetch the first one in full. ListTransfers pages through the complete result set automatically (pages of 100); pass From/To (both inclusive, transfer creation time) to narrow the window, and a ProfileID to target a specific profile — zero means Wise's default (personal) profile.

package main

import (
	"context"
	"fmt"
	"log"
	"os"
	"time"

	"github.com/larsartmann/wise-go"
)

func main() {
	ctx := context.Background()
	client := wise.New(os.Getenv("WISE_API_KEY"))

	transfers, err := client.ListTransfers(ctx, wise.ListTransfersRequest{
		From: time.Date(2026, 9, 1, 0, 0, 0, 0, time.UTC),
		To:   time.Date(2026, 10, 1, 0, 0, 0, 0, time.UTC),
	})
	if err != nil {
		log.Fatal(err)
	}

	if len(transfers) == 0 {
		return
	}

	transfer, err := client.GetTransfer(ctx, transfers[0].ID)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(transfer.ID, transfer.Status)
}

func (*Client) RefreshQuoteAccountRequirements added in v0.9.0

func (c *Client) RefreshQuoteAccountRequirements(
	ctx context.Context,
	req RefreshQuoteAccountRequirementsRequest,
) ([]AccountRequirement, error)

RefreshQuoteAccountRequirements completes the two-pass recipient flow: after GetQuoteAccountRequirements returns a field with RefreshRequirementsOnChange=true (e.g. legalEntityType or a country selector), submit the recipient form with that field updated and Wise returns the revised requirements for the chosen route — for example selecting the US reveals the address.state field.

The recipient payload does not need to be complete: Wise resolves the dependent form, not the account. Like the GET, the SDK sends Accept-Minor-Version: 1 so recipient name and email fields are included.

func (*Client) TriggerOTT added in v0.11.0

func (c *Client) TriggerOTT(ctx context.Context, ott OneTimeToken, channel OTTChannel) (*OTTTriggerResult, error)

TriggerOTT sends the one-time password for the given channel to the user's verified phone number (POST /2027Q1/one-time-token/{channel}/trigger). The OTP arrives out of band; submit it with Client.VerifyOTT. Triggering is required before verifying. On the sandbox no real SMS is sent and the OTP is always "111111". With a personal API token, statement-challenge tokens answer not-found here (see Client.GetOTTStatus for the cause).

func (*Client) ValidateTransferRequirements added in v0.8.0

func (c *Client) ValidateTransferRequirements(
	ctx context.Context,
	req ValidateTransferRequirementsRequest,
) ([]TransferRequirement, error)

ValidateTransferRequirements discovers the transfer-specific fields required for a quote and recipient combination. Requirements vary by currency route, transfer amount, and regulatory region; calling this before CreateTransfer avoids delays caused by missing details.

The response is an array of dynamic forms. Fields flagged RefreshRequirementsOnChange mean the validation must be repeated once the field is populated to discover lower-level required fields. Cross-reference the response against a prepared transfer with MissingTransferDetails to learn which required fields are still unsatisfied.

Example

Discover the dynamic transfer details a corridor requires and check a prepared request against them before spending a customerTransactionId.

package main

import (
	"context"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	requirements, err := client.ValidateTransferRequirements(context.Background(),
		wise.ValidateTransferRequirementsRequest{
			TargetAccount: wise.NewRecipientID(98765432),
			QuoteID:       wise.NewQuoteID("11144c35-9fe8-4c32-b7fd-d05c2a7734bf"),
		})
	if err != nil {
		log.Fatal(err)
	}

	transferReq := wise.CreateTransferRequest{
		QuoteID:               wise.NewQuoteID("11144c35-9fe8-4c32-b7fd-d05c2a7734bf"),
		TargetAccount:         wise.NewRecipientID(98765432),
		CustomerTransactionID: wise.NewCustomerTransactionID("22244c35-9fe8-4c32-b7fd-d05c2a7734bf"),
	}

	if missing := wise.MissingTransferDetails(requirements, transferReq); len(missing) > 0 {
		log.Fatalf("transfer details still missing: %v", missing)
	}
}

func (*Client) VerifyCredentials added in v0.17.0

func (c *Client) VerifyCredentials(ctx context.Context) error

VerifyCredentials validates the API key with a single authenticated ListProfiles round-trip — the retry ladder is disabled, so the answer arrives after exactly one request (bounded by the client timeout or the caller's ctx deadline, not by ~2 min of retries). The typed errors match Health: an *AuthError means bad credentials, a *RateLimitError means the API answered under throttling, and a *ServerError surfaces after one failed attempt instead of four. Use it for startup config checks; use Health for readiness polling that should ride the retry budget.

Example

VerifyCredentials is the fail-fast probe: one authenticated round-trip with the retry ladder disabled, for startup config checks. Health is for readiness polling that should ride the retry budget.

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/larsartmann/wise-go"
)

func main() {
	client := wise.New("your-api-key")

	if err := client.VerifyCredentials(context.Background()); err != nil {
		log.Fatal(err)
	}

	fmt.Println("credentials accepted")
}

func (*Client) VerifyOTT added in v0.11.0

func (c *Client) VerifyOTT(
	ctx context.Context,
	ott OneTimeToken,
	channel OTTChannel,
	otpCode string,
) (*OTTStatus, error)

VerifyOTT submits the one-time password for the given channel (POST /2027Q1/one-time-token/{channel}/verify) and returns the OTT's updated status: an empty pending-required set means the challenge is cleared and the SCA-protected request can be retried, optionally with the OTT in the x-2fa-approval header via WithSCAApprovalToken.

type CreateBalanceRequest added in v0.9.0

type CreateBalanceRequest struct {
	ProfileID      ProfileID
	Currency       Currency
	Type           BalanceType // BalanceTypeStandard or BalanceTypeSavings.
	Name           string
	IdempotencyKey string
}

CreateBalanceRequest opens a new balance for a profile. Name is required for SAVINGS balances. IdempotencyKey optionally carries the caller's X-idempotence-uuid value (required by Wise); when empty the SDK generates a fresh UUID per call, so retries across process restarts that must not create duplicate balances should pass an explicit key.

type CreateQuoteRequest added in v0.8.0

type CreateQuoteRequest struct {
	SourceCurrency Currency
	TargetCurrency Currency
	SourceAmount   *Money // Optional; sets sourceAmount on the wire.
	TargetAmount   *Money // Optional; sets targetAmount on the wire.
	PreferredPayIn PayIn  // Optional; defaults to BANK_TRANSFER.
	PayOut         PayOut // Optional; defaults to BANK_TRANSFER for authenticated quotes.
	TargetAccount  RecipientID
}

CreateQuoteRequest parameters for creating an authenticated or unauthenticated quote. Exactly one of SourceAmount or TargetAmount must be set, and its currency must match the corresponding currency field.

type CreateRecipientRequest added in v0.8.0

type CreateRecipientRequest struct {
	ProfileID         ProfileID
	Currency          Currency
	Type              string
	AccountHolderName string
	Details           map[string]string
	OwnedByCustomer   bool
}

CreateRecipientRequest parameters for creating a recipient account.

type CreateThirdPartyTransferRequest added in v0.14.0

type CreateThirdPartyTransferRequest struct {
	ProfileID          ProfileID
	OriginalTransferID string
	TargetAccount      RecipientID
	SourceAccount      *RecipientID
	QuoteID            QuoteID
	Reference          string
	Originator         Originator
}

CreateThirdPartyTransferRequest is the body of a third-party (originator) transfer: money moved on behalf of an originator, funded through your own quote. OriginalTransferID is the idempotency key (Wise deduplicates on it); QuoteID is a quoteUUID.

type CreateTransferRequest added in v0.8.0

type CreateTransferRequest struct {
	QuoteID                           QuoteID
	TargetAccount                     RecipientID
	SourceAccount                     RecipientID // Optional refund recipient account.
	CustomerTransactionID             CustomerTransactionID
	Reference                         string
	SourceOfFunds                     string
	TransferPurpose                   string
	TransferPurposeInvoiceNumber      string
	TransferPurposeSubTransferPurpose string
}

CreateTransferRequest parameters for creating a standard transfer.

customerTransactionId is required for idempotency. QuoteID comes from an authenticated quote; TargetAccount is the recipient account ID returned by CreateRecipient or ListRecipients. SourceAccount is the optional refund recipient account ID.

type CreateWebhookSubscriptionRequest added in v0.11.0

type CreateWebhookSubscriptionRequest struct {
	Name      string
	TriggerOn WebhookEventType
	Delivery  WebhookDelivery
}

CreateWebhookSubscriptionRequest registers a new webhook subscription. Name, TriggerOn, and Delivery (version + URL) are required by Wise; they are validated client-side so a malformed request never reaches the API.

type Currency

type Currency string

Currency is an ISO 4217 currency code (e.g., "EUR", "USD", "GBP"). Construct via NewCurrency for validation, or use Currency("EUR") directly when the value is known to be valid.

func NewCurrency

func NewCurrency(s string) (Currency, error)

NewCurrency validates and constructs a Currency from a raw string. Returns an error if the string is not exactly 3 uppercase ASCII letters.

Example
package main

import (
	"fmt"

	"github.com/larsartmann/wise-go"
)

func main() {
	currency, err := wise.NewCurrency("EUR")
	if err != nil {
		panic(err)
	}

	fmt.Println(currency)
}
Output:
EUR

type CurrencyInfo added in v0.9.0

type CurrencyInfo struct {
	Code             Currency
	Symbol           string
	Name             string
	CountryKeywords  []string
	SupportsDecimals bool
}

CurrencyInfo describes one currency Wise allows for transfers — reference data for populating currency pickers.

type CustomerTransactionID added in v0.12.0

type CustomerTransactionID = id.ID[CustomerTransactionIDBrand, string]

CustomerTransactionID is the caller-supplied idempotency key of a Wise transfer (wire "customerTransactionId", a UUID). Wise deduplicates create attempts by it and echoes it back on the created transfer.

func NewCustomerTransactionID added in v0.12.0

func NewCustomerTransactionID(v string) CustomerTransactionID

NewCustomerTransactionID creates a new CustomerTransactionID from a string UUID value.

type CustomerTransactionIDBrand added in v0.12.0

type CustomerTransactionIDBrand struct{}

CustomerTransactionIDBrand is a phantom type for CustomerTransactionID.

func (CustomerTransactionIDBrand) Name added in v0.12.0

type DeliveryEstimate added in v0.8.0

type DeliveryEstimate struct {
	EstimatedDeliveryDate          time.Time
	FormattedEstimatedDeliveryDate string
}

DeliveryEstimate is the parsed representation of the estimated delivery time for a transfer. EstimatedDeliveryDate is the raw timestamp, and FormattedEstimatedDeliveryDate is a customer-friendly string suitable for passing through to a front-end.

type DetailType

type DetailType string

DetailType represents Wise's wire-format values for details.type. They classify transaction details in responses; statement request filtering uses the StatementType* constants instead.

const (
	DetailTypeCard             DetailType = "CARD"
	DetailTypeDeposit          DetailType = "DEPOSIT"
	DetailTypeMoneyAdded       DetailType = "MONEY_ADDED"
	DetailTypeDirectDebit      DetailType = "DIRECT_DEBIT"
	DetailTypeAcquiringPayment DetailType = "ACQUIRING_PAYMENT"
	DetailTypeCardCashback     DetailType = "CARD_CASHBACK"

	DetailTypeCardPayment DetailType = "CARD_PAYMENT"
	DetailTypeCardRefund  DetailType = "CARD_REFUND"
	DetailTypeTransfer    DetailType = "TRANSFER"
	DetailTypePayment     DetailType = "PAYMENT"
	DetailTypeConversion  DetailType = "CONVERSION"
	DetailTypeExchange    DetailType = "EXCHANGE"
	DetailTypeFee         DetailType = "FEE"
)

DetailType constants are Wise's wire-format values for details.type. The first block reflects the balance-statement contract in docs/reviews/wise-api-openapi.json; the second block carries the legacy values from the earlier prose docs, kept mapped for compatibility.

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer is the interface for an HTTP client. *http.Client satisfies this. Inject a custom implementation via WithHTTPClient for testing or middleware (tracing, logging, retries at the transport layer).

type ExchangeRate added in v0.8.0

type ExchangeRate struct {
	Source Currency
	Target Currency
	Rate   float64
	Time   time.Time
}

ExchangeRate is the parsed representation of a Wise exchange rate. Source and Target are ISO 4217 currency codes; Rate is the amount of Target currency per one unit of Source currency.

type FundTransferResult added in v0.9.0

type FundTransferResult struct {
	Type                 FundingType
	Status               FundingStatus
	ErrorCode            FundingErrorCode      // Set only when Status is FundingStatusRejected.
	ErrorMessage         string                // Developer-facing rejection explanation; not for end users.
	BalanceTransactionID *BalanceTransactionID // Set for FundingTypeBalance: the debit applied to the balance.
	PartnerReference     string                // Set for trusted pre-fund types: the echoed partner reference.
}

FundTransferResult is the parsed result of funding a transfer with FundTransfer.

Wise models the response as a oneOf discriminated by "type": the BALANCE variant carries balanceTransactionId, the trusted-pre-fund variants carry partnerReference. The SDK deliberately flattens the variants into this one struct: the discriminated union has only three members, every member shares Type and Status, and the member-specific fields are marked by which one is set (nil / empty). A Go sum type here would force a type switch for a two-field difference and give nothing back; revisit only if Wise grows the union with structurally divergent variants.

Status FundingStatusRejected reports a funding attempt the API refused (for example an underfunded balance); the machine-readable reason is in ErrorCode and a developer-facing explanation in ErrorMessage. This is a successful API call that declined the funding — retry FundTransfer once the underlying problem (e.g. balance top-up) is resolved, unless ErrorCode is payment.exists, which means the transfer was already funded.

type FundingErrorCode added in v0.9.0

type FundingErrorCode string

FundingErrorCode is the machine-readable reason for a rejected funding attempt. Wise may add codes; unknown values flow through unmodified, so switch on the constants for known cases and handle the default explicitly.

const (
	FundingErrorCodeTransferNotFound                FundingErrorCode = "transfer.not-found"
	FundingErrorCodeTransferInvalidState            FundingErrorCode = "transfer.invalid-state"
	FundingErrorCodePaymentExists                   FundingErrorCode = "payment.exists"
	FundingErrorCodeTransferNotAccessibleForUser    FundingErrorCode = "transfer.not-accessible-for-user"
	FundingErrorCodeBalanceMissingSecurityRole      FundingErrorCode = "balance.unauthorised.missing-security-role"
	FundingErrorCodePaymentNotFound                 FundingErrorCode = "payment.not-found"
	FundingErrorCodeInvalidRequest                  FundingErrorCode = "invalid.request"
	FundingErrorCodeUnexpectedError                 FundingErrorCode = "unexpected.error"
	FundingErrorCodePaymentOptionUnavailable        FundingErrorCode = "payment.option-unavailable"
	FundingErrorCodeBalancePaymentOptionUnavailable FundingErrorCode = "balance.payment-option-unavailable"
	FundingErrorCodeBalanceAccountNotFound          FundingErrorCode = "balance.account-not-found"
	FundingErrorCodeBalanceAccountInactive          FundingErrorCode = "balance.account-inactive"
	FundingErrorCodeBalanceInsufficientFunds        FundingErrorCode = "balance.insufficient-funds"
	FundingErrorCodeBalanceNoBalanceForCurrency     FundingErrorCode = "balance.no-balance-for-currency"
	FundingErrorCodeBalanceCurrencyUnsupported      FundingErrorCode = "balance.currency-unsupported"
	FundingErrorCodePreFundBulkOptionUnavailable    FundingErrorCode = "trustedprefundbulk.payment-option-unavailable"
	FundingErrorCodePreFundTxOptionUnavailable      FundingErrorCode = "trustedprefundtx.payment-option-unavailable"
)

Documented funding error codes ("type" prefixes indicate which funding models can produce them).

type FundingStatus added in v0.9.0

type FundingStatus string

FundingStatus is the outcome of a funding attempt.

const (
	FundingStatusCreated   FundingStatus = "CREATED"
	FundingStatusCompleted FundingStatus = "COMPLETED"
	FundingStatusRejected  FundingStatus = "REJECTED"
)

Funding outcomes reported by the fund-transfer endpoint.

type FundingType added in v0.9.0

type FundingType string

FundingType identifies the funding model Wise used to pay for a transfer.

const (
	FundingTypeBalance            FundingType = "BALANCE"
	FundingTypeTrustedPreFundBulk FundingType = "TRUSTED_PRE_FUND_BULK"
	FundingTypeTrustedPreFundTx   FundingType = "TRUSTED_PRE_FUND_TX"
)

Funding types reported by the fund-transfer endpoint.

type GBAccountIdentification added in v0.14.0

type GBAccountIdentification struct {
	BIC                string
	IBAN               string
	SortCode           string
	AccountNumber      string
	InstitutionName    string
	InstitutionAddress *ISO20022Address
}

GBAccountIdentification is the UK details format.

type GetStatementRequest added in v0.9.0

type GetStatementRequest struct {
	ProfileID ProfileID
	BalanceID BalanceID
	Currency  Currency
	From      time.Time
	To        time.Time
	Type      StatementType // Optional statement layout filter; see StatementType* constants.
	Format    StatementFormat

	// Locale optionally localizes the statement (2-character language code,
	// e.g. "en" or "de"); Wise defaults to the profile's language.
	Locale string
}

GetStatementRequest parameters for downloading a balance statement as a file. The interval From..To cannot exceed 469 days (Wise limit).

type ISO20022Address added in v0.14.0

type ISO20022Address struct {
	StreetName         string
	BuildingNumber     string
	TownName           string
	PostCode           string
	CountrySubDivision string
	Country            string
	AddressLines       []string
}

ISO20022Address is Wise's structured postal address for the instructing institution, with optional free-form address lines.

type InvestmentState

type InvestmentState string

InvestmentState identifies whether a Wise balance is invested.

const (
	InvestmentStateNotInvested InvestmentState = "NOT_INVESTED"
	InvestmentStateInvested    InvestmentState = "INVESTED"
)

InvestmentState values reported by Wise balances (Balance.InvestmentState).

type ListActivitiesRequest added in v0.18.0

type ListActivitiesRequest struct {
	ProfileID    ProfileID
	Since        time.Time
	Until        time.Time
	ResourceType ActivityResourceType
	Status       ActivityStatus
	Cursor       string
	Size         int
}

ListActivitiesRequest parameters for listing a profile's activity feed.

Since and Until bound the window on the activity's creation time (both inclusive) and are omitted when zero. ResourceType (the endpoint's monetaryResourceType) and Status are optional filters. Cursor is the NextCursor of a previous page. Size is the page size (1 to 100); zero leaves Wise's default of 10.

type ListRecipientsRequest added in v0.8.0

type ListRecipientsRequest struct {
	ProfileID ProfileID
	Currency  Currency // Optional filter.
}

ListRecipientsRequest parameters for listing recipient accounts.

type ListTransactionsRequest

type ListTransactionsRequest struct {
	ProfileID ProfileID
	BalanceID BalanceID
	Currency  Currency
	From      time.Time
	To        time.Time
	Type      StatementType // Optional statement layout filter; see StatementType* constants.
}

ListTransactionsRequest parameters for listing transactions.

type ListTransactionsResponse

type ListTransactionsResponse struct {
	Transactions          []Transaction
	EndOfStatementBalance Money
}

ListTransactionsResponse from listing transactions.

type ListTransfersRequest added in v0.7.0

type ListTransfersRequest struct {
	ProfileID ProfileID
	From      time.Time
	To        time.Time
	Status    []TransferStatus // Optional filter: transfers in any of these statuses.
}

ListTransfersRequest parameters for listing transfers.

ProfileID is optional: when zero, Wise defaults to the user's personal profile. From/To filter on transfer creation time (createdDateStart/End, both inclusive) and are omitted when zero.

type Logger added in v0.9.0

type Logger interface {
	LogRequest(entry RequestLog)
}

Logger is notified about every HTTP attempt against the Wise API, including retries. Implementations must be safe for concurrent use and must not block.

type Money

type Money struct {
	Cents    int64
	Currency Currency
}

Money is a monetary amount in cents paired with its currency. The pairing makes mismatched currency/amount combinations unrepresentable.

func (Money) Amount added in v0.18.0

func (m Money) Amount() (money.Money, error)

Amount converts to the fleet-canonical money type (github.com/larsartmann/go-composable-business-types/money) — the typed bridge at the wire edge (plan P16): Wise's float64 major units never leave this package unpaired or untyped, and the conversion validates the ISO 4217 code the local constructor cannot.

func (Money) String

func (m Money) String() string

String formats Money as "CUR DD.DD" (e.g., "EUR 12.34", "USD -50.00").

Example
package main

import (
	"fmt"

	"github.com/larsartmann/wise-go"
)

func main() {
	m := wise.Money{Cents: 1234, Currency: wise.Currency("EUR")}
	fmt.Println(m)
}
Output:
EUR 12.34
Example (Negative)
package main

import (
	"fmt"

	"github.com/larsartmann/wise-go"
)

func main() {
	m := wise.Money{Cents: -5000, Currency: wise.Currency("USD")}
	fmt.Println(m)
}
Output:
USD -50.00

type MultiCurrencyAccount added in v0.9.0

type MultiCurrencyAccount struct {
	ID          AccountID
	ProfileID   ProfileID
	RecipientID RecipientID
	Created     time.Time
	Modified    time.Time
	Active      bool
	Eligible    bool
}

MultiCurrencyAccount is the profile's Wise account container — the holder of the currency balances and their receiving bank details.

RecipientID is the account's own recipient: create a transfer to it to top up the matching balance.

type NotFoundError

type NotFoundError struct {
	APIError
}

NotFoundError is returned when the Wise API returns HTTP 404.

func (*NotFoundError) ErrorCode

func (e *NotFoundError) ErrorCode() string

func (*NotFoundError) Unwrap added in v0.19.0

func (e *NotFoundError) Unwrap() error

type OTTAction added in v0.14.0

type OTTAction string

OTTAction names the action a one-time token authorizes, e.g. "BALANCE__GET_STATEMENT" for a balance statement download. It is an open enum: Wise adds actions, so unknown values pass through.

type OTTChallenge added in v0.11.0

type OTTChallenge struct {
	Primary      OTTChallengeView
	Alternatives []OTTChallengeView
	Required     bool
	Passed       bool
}

OTTChallenge is one entry of an OTT's challenge list: the primary way to clear it, alternative ways, and whether it is required to pass the OTT and already passed.

func (OTTChallenge) Supports added in v0.11.0

func (c OTTChallenge) Supports(channel OTTChannel) bool

Supports reports whether the challenge can be cleared over the given phone channel: either the primary challenge is that channel's type, or one of the alternatives is.

type OTTChallengeType added in v0.11.0

type OTTChallengeType string

OTTChallengeType is the type of a challenge Wise presents for an OTT (primaryChallenge.type). It is an open enum: Wise can add types, so unknown values pass through rather than failing to decode.

const (
	OTTChallengePIN                      OTTChallengeType = "PIN"
	OTTChallengeFaceMap                  OTTChallengeType = "FACE_MAP"
	OTTChallengeSMS                      OTTChallengeType = "SMS"
	OTTChallengeWhatsApp                 OTTChallengeType = "WHATSAPP"
	OTTChallengeVoice                    OTTChallengeType = "VOICE"
	OTTChallengePartnerDeviceFingerprint OTTChallengeType = "PARTNER_DEVICE_FINGERPRINT"
)

Challenge types documented for OTTs. Only the phone-based trio (SMS/WHATSAPP/VOICE) is clearable via the per-channel endpoints; PIN uses JOSE/JWE direct encryption and FACE_MAP/PARTNER_DEVICE_FINGERPRINT have no public API flow.

type OTTChallengeView added in v0.11.0

type OTTChallengeView struct {
	Type     OTTChallengeType
	ViewData map[string]any
}

OTTChallengeView is one concrete way to satisfy a challenge: its type plus the data Wise provides for rendering it (messages, IDs, or other attributes — e.g. an obfuscated phone number for SMS).

type OTTChannel added in v0.11.0

type OTTChannel string

OTTChannel is the phone-based delivery channel of a one-time password for an OTT challenge. Wise serves a trigger and a verify endpoint per channel.

const (
	OTTChannelSMS      OTTChannel = "sms"
	OTTChannelWhatsApp OTTChannel = "whatsapp"
	OTTChannelVoice    OTTChannel = "voice"
)

One-time-password delivery channels. These three channels share the same wire contract; PIN challenges use JOSE/JWE direct encryption and are not covered by this SDK.

func (OTTChannel) String added in v0.11.0

func (c OTTChannel) String() string

String returns the channel name.

type OTTCodeProvider added in v0.11.0

type OTTCodeProvider func(
	ctx context.Context,
	challenge OTTChallenge,
	channel OTTChannel,
	phoneHint string,
) (string, error)

OTTCodeProvider supplies the one-time-password (OTP) for one challenge attempt — typically by prompting the user. phoneHint is the obfuscated phone number from the trigger call (may be empty). Returning an error aborts clearing.

type OTTStatus added in v0.11.0

type OTTStatus struct {
	Challenges []OTTChallenge
	// Validity is the time until the one-time token expires.
	Validity time.Duration
	// ActionType names the action the token authorizes, e.g.
	// "BALANCE__GET_STATEMENT" for a balance statement download.
	ActionType OTTAction
	UserID     UserID
}

OTTStatus is the parsed state of a one-time token: its challenges, the remaining validity, the action the token authorizes (e.g. BALANCE__GET_STATEMENT), and the user who created it.

func (*OTTStatus) Cleared added in v0.11.0

func (s *OTTStatus) Cleared() bool

Cleared reports whether every required challenge has been passed — the state that unblocks the SCA-protected request.

func (*OTTStatus) PendingRequired added in v0.11.0

func (s *OTTStatus) PendingRequired() []OTTChallenge

PendingRequired returns the challenges that must still be passed to clear the OTT: required and not yet passed.

type OTTTriggerResult added in v0.11.0

type OTTTriggerResult struct {
	ObfuscatedPhoneNo string
}

OTTTriggerResult is the outcome of triggering a challenge: the obfuscated phone number the one-time password was sent to, as a hint for the user.

type OneTimeToken added in v0.14.0

type OneTimeToken string

OneTimeToken is the opaque credential Wise issues in the x-2fa-approval header of an SCA challenge: proof that the holder (or their user) cleared the challenge's requirements. It is a SECRET — never log it, never put it in an error message; pass it to the OTT endpoints and to WithSCAApprovalToken, and prefer reporting only whether one was issued (OneTimeToken.IsZero). The zero value means "no token": the challenge response carried no x-2fa-approval header (blocked, with nothing to clear).

It is a distinct type so an OTT can never be accidentally passed where an OTP code (the 6-digit user entry), an API key, or any other string is expected — the surrounding signatures would otherwise all be bare strings.

func NewOneTimeToken added in v0.14.0

func NewOneTimeToken(value string) (OneTimeToken, error)

NewOneTimeToken validates and returns a OneTimeToken. It rejects empty and whitespace-only values: a usable OTT is always non-blank, and an opaque credential must never be silently trimmed.

func (OneTimeToken) IsZero added in v0.14.0

func (t OneTimeToken) IsZero() bool

IsZero reports whether the token is absent — the SCA response carried no x-2fa-approval header, or no challenge was seen at all.

type Option

type Option func(*config)

Option configures a Client.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL sets a custom base URL (overrides production/sandbox).

func WithCorrelationID

func WithCorrelationID(id string) Option

WithCorrelationID sets a static correlation ID sent as the X-External-Correlation-Id header on every request. This is Wise's documented global header for distributed tracing across the API. If empty, no header is sent.

For per-request correlation IDs, derive a context with WithRequestCorrelationID; it takes precedence over this value.

func WithHTTPClient

func WithHTTPClient(client Doer) Option

WithHTTPClient sets a custom HTTP client. Accepts any type implementing Doer (*http.Client satisfies this implicitly). Use this to inject a client with custom Transport (tracing, logging, mTLS), custom Timeout, or a mock for testing.

func WithLogger added in v0.9.0

func WithLogger(logger Logger) Option

WithLogger installs a Logger that observes every HTTP attempt, including retries. Use it for operability (latency tracking, retry visibility) without wrapping the HTTP transport.

func WithRetry

func WithRetry(maxRetries int, minDelay, maxDelay time.Duration) Option

WithRetry configures the retry policy. maxRetries is the maximum number of retry attempts (not including the initial request).

func WithSCAApprovalToken added in v0.6.0

func WithSCAApprovalToken(token OneTimeToken) Option

WithSCAApprovalToken sends the given one-time token (OTT) as the x-2fa-approval header on every request. Configure it after clearing the challenge an SCAChallengeError carried (verify it via the one-time-token endpoints — see Client.ClearSCAChallenge — or view a statement on wise.com) to satisfy Wise's Strong Customer Authentication (required once per ~90 days for SCA-protected endpoints such as balance statements on UK/EEA profiles). Once the challenge window is satisfied, remove the token again.

func WithSandbox

func WithSandbox() Option

WithSandbox sets the client to use the Wise sandbox environment.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the HTTP client timeout.

func WithUserAgent added in v0.11.0

func WithUserAgent(userAgent string) Option

WithUserAgent sets the User-Agent header sent with every request, e.g. "bank-sync/1.0 (github.com/acme/bank-sync)". Wise recommends integrations identify themselves; without it requests carry Go's default client agent.

type Originator added in v0.14.0

type Originator struct {
	LegalEntityType          OriginatorLegalEntityType
	Reference                string
	Name                     OriginatorName
	DateOfBirth              time.Time
	Nationality              string
	BusinessRegistrationCode string
	BusinessRegistrationDate time.Time
	AccountDetails           string
	Address                  OriginatorAddress
}

Originator identifies who is really behind a third-party transfer. The same Reference must be reused for every transfer of one originator (Wise keys compliance on it). DateOfBirth applies to PRIVATE originators; BusinessRegistrationCode/Date to BUSINESS ones.

type OriginatorAddress added in v0.14.0

type OriginatorAddress struct {
	FirstLine   string
	City        string
	StateCode   string
	CountryCode string
	PostCode    string
}

OriginatorAddress is the originator's postal address. StateCode is required for US/CA/BR/AU addresses.

type OriginatorLegalEntityType added in v0.14.0

type OriginatorLegalEntityType string

OriginatorLegalEntityType discriminates the originator oneOf on the wire.

const (
	// OriginatorLegalEntityTypePrivate is a natural person.
	OriginatorLegalEntityTypePrivate OriginatorLegalEntityType = "PRIVATE"
	// OriginatorLegalEntityTypeBusiness is a registered business.
	OriginatorLegalEntityTypeBusiness OriginatorLegalEntityType = "BUSINESS"
)

Documented originator legal-entity types.

type OriginatorName added in v0.14.0

type OriginatorName struct {
	GivenName      string
	MiddleNames    []string
	FamilyName     string
	PatronymicName string
	FullName       string
}

OriginatorName captures the originator's name for compliance. For PRIVATE originators the given/family split is what Wise validates; for BUSINESS originators set FullName to the registered company name.

type PayIn added in v0.8.0

type PayIn string

PayIn identifies how a quote is funded.

const (
	PayInBankTransfer PayIn = "BANK_TRANSFER"
	PayInBalance      PayIn = "BALANCE"
	PayInCard         PayIn = "CARD"
)

PayIn values sent to the Wise API.

type PayOut added in v0.8.0

type PayOut string

PayOut identifies how a quote is paid out.

const (
	PayOutBankTransfer PayOut = "BANK_TRANSFER"
	PayOutBalance      PayOut = "BALANCE"
	PayOutSwift        PayOut = "SWIFT"
	PayOutSwiftOur     PayOut = "SWIFT_OUR"
)

PayOut values sent to the Wise API.

type Profile

type Profile struct {
	ID ProfileID
	// UserID is the owning user account's ID (GetUser reads it).
	UserID UserID
	// PublicID is Wise's opaque public identifier for the profile (wire
	// "publicId") — a reference string, distinct from the numeric ID.
	PublicID  string
	Type      ProfileType
	Name      string
	Email     string
	CreatedAt time.Time
}

Profile is the parsed representation of a Wise profile.

type ProfileBrand

type ProfileBrand struct{}

ProfileBrand is a phantom type for ProfileID.

func (ProfileBrand) Name added in v0.12.0

func (ProfileBrand) Name() string

type ProfileID

type ProfileID = id.ID[ProfileBrand, int64]

ProfileID is a strongly-typed identifier for Wise profiles.

func NewProfileID

func NewProfileID(v int64) ProfileID

NewProfileID creates a new ProfileID from an int64 value.

type ProfileType

type ProfileType string

ProfileType identifies the kind of Wise profile.

const (
	ProfileTypePersonal ProfileType = "personal"
	ProfileTypeBusiness ProfileType = "business"
)

type Quote added in v0.8.0

type Quote struct {
	ID                            QuoteID
	Source                        Money
	Target                        Money
	PayIn                         PayIn
	PayOut                        PayOut
	Rate                          float64
	Created                       time.Time
	ExpirationTime                time.Time
	Status                        QuoteStatus
	Profile                       ProfileID // Zero for unauthenticated quotes.
	RateType                      QuoteRateType
	ProvidedAmountType            QuoteProvidedAmountType
	GuaranteedTargetAmountAllowed bool
	GuaranteedTargetAmount        bool
	PreferredPayIn                PayIn
	RateExpirationTime            time.Time
	TargetAmountAllowed           bool
	User                          UserID // Zero when Wise omits the field (unauthenticated quotes).
	PaymentOptions                []QuotePaymentOption
	Notices                       []QuoteNotice
}

Quote is the parsed representation of a Wise quote — a locked exchange rate offer used to create a transfer. Authenticated quotes expire after 30 minutes.

ID is empty for unauthenticated quotes, which cannot be used to create a transfer. PaymentOptions lists the available pay-in/pay-out combinations with their fees and estimated delivery times; Notices carries messages Wise requires to be shown to the user (a BLOCKED notice means the quote must not be used to create a transfer).

type QuoteAccountRequirementsRequest added in v0.9.0

type QuoteAccountRequirementsRequest struct {
	QuoteID                   QuoteID
	OriginatorLegalEntityType string
}

QuoteAccountRequirementsRequest asks Wise which recipient-account fields the quote's currency corridor requires. The corridor is fully determined by the authenticated quote; OriginatorLegalEntityType is only needed for Correspondent Send integrations (PRIVATE or BUSINESS).

type QuoteBrand added in v0.8.0

type QuoteBrand struct{}

QuoteBrand is a phantom type for QuoteID.

func (QuoteBrand) Name added in v0.12.0

func (QuoteBrand) Name() string

type QuoteFee added in v0.8.0

type QuoteFee struct {
	TransferWise float64
	PayIn        float64
	Discount     float64
	Partner      float64
	Total        float64
}

QuoteFee is the fee breakdown Wise reports for a quote payment option, in source-currency major units (Wise's wire format). Total is the value to display when showing fees to the user.

type QuoteID added in v0.8.0

type QuoteID = id.ID[QuoteBrand, string]

QuoteID is a strongly-typed identifier for Wise quotes. Note: Wise quote IDs are UUIDs (strings), unlike the integer IDs used for profiles, balances, transfers, and recipients.

func NewQuoteID added in v0.8.0

func NewQuoteID(v string) QuoteID

NewQuoteID creates a new QuoteID from a string UUID value.

type QuoteNotice added in v0.8.0

type QuoteNotice struct {
	Text string
	Link *string
	Type QuoteNoticeType
}

QuoteNotice is a message Wise requires to be shown to the user. A notice of type BLOCKED means the quote must not be used to create a transfer.

type QuoteNoticeType added in v0.8.0

type QuoteNoticeType string

QuoteNoticeType is the severity class of a quote notice.

const (
	QuoteNoticeTypeWarning QuoteNoticeType = "WARNING"
	QuoteNoticeTypeInfo    QuoteNoticeType = "INFO"
	QuoteNoticeTypeBlocked QuoteNoticeType = "BLOCKED"
)

type QuotePaymentOption added in v0.8.0

type QuotePaymentOption struct {
	Disabled                   bool
	EstimatedDelivery          time.Time
	FormattedEstimatedDelivery string
	Fee                        QuoteFee
	Source                     Money
	Target                     Money
	PayIn                      PayIn
	PayOut                     PayOut
	PayInProduct               string
	FeePercentage              float64
}

QuotePaymentOption is one pay-in/pay-out combination available for a quote, with its fee breakdown and estimated delivery time. Source and Target are the amounts payable/receivable when using this option; EstimatedDelivery is parsed via the tolerant timestamp parser.

type QuoteProvidedAmountType added in v0.8.0

type QuoteProvidedAmountType string

QuoteProvidedAmountType records whether the quote was created from a source or a target amount.

const (
	QuoteProvidedAmountTypeSource QuoteProvidedAmountType = "SOURCE"
	QuoteProvidedAmountTypeTarget QuoteProvidedAmountType = "TARGET"
)

type QuoteRateType added in v0.8.0

type QuoteRateType string

QuoteRateType distinguishes a locked (guaranteed) rate from a floating one.

const (
	QuoteRateTypeFixed    QuoteRateType = "FIXED"
	QuoteRateTypeFloating QuoteRateType = "FLOATING"
)

type QuoteStatus added in v0.8.0

type QuoteStatus string

QuoteStatus is a Wise quote lifecycle status.

const (
	QuoteStatusPending QuoteStatus = "pending"
	QuoteStatusActive  QuoteStatus = "active"
	QuoteStatusExpired QuoteStatus = "expired"
)

Documented quote statuses.

type RateLimitError

type RateLimitError struct {
	APIError

	RetryAfter    time.Duration
	RateLimitedBy string
}

RateLimitError is returned when the Wise API returns HTTP 429.

func (*RateLimitError) ErrorCode

func (e *RateLimitError) ErrorCode() string

func (*RateLimitError) ErrorContext

func (e *RateLimitError) ErrorContext() map[string]string

func (*RateLimitError) ErrorFamily

func (e *RateLimitError) ErrorFamily() errorfamily.Family

func (*RateLimitError) IsRetryable

func (e *RateLimitError) IsRetryable() bool

func (*RateLimitError) Unwrap added in v0.19.0

func (e *RateLimitError) Unwrap() error

type Recipient added in v0.8.0

type Recipient struct {
	ID                RecipientID
	AccountHolderName string
	Currency          Currency
	Country           string
	Type              string
	Details           map[string]string
	Active            bool
}

Recipient is the parsed representation of a Wise recipient account.

Details contains the currency-specific account fields (e.g. sortCode, accountNumber, iban) as string values. Because the required fields differ by currency and route, consumers should use the account-requirements endpoints to discover the exact fields for their corridor.

type RecipientBrand added in v0.7.0

type RecipientBrand struct{}

RecipientBrand is a phantom type for RecipientID.

func (RecipientBrand) Name added in v0.12.0

func (RecipientBrand) Name() string

type RecipientID added in v0.7.0

type RecipientID = id.ID[RecipientBrand, int64]

RecipientID is a strongly-typed identifier for Wise recipient accounts.

func NewRecipientID added in v0.7.0

func NewRecipientID(v int64) RecipientID

NewRecipientID creates a new RecipientID from an int64 value.

type RefreshQuoteAccountRequirementsRequest added in v0.9.0

type RefreshQuoteAccountRequirementsRequest struct {
	QuoteID QuoteID

	// Recipient is the in-progress create-recipient payload: the same shape
	// CreateRecipient will eventually submit. Currency, Type, and the Details
	// collected so far (at minimum the field that triggered the refresh) are
	// required; AccountHolderName and ProfileID stay optional at this stage
	// because Wise resolves the dependent form, not the recipient itself.
	Recipient CreateRecipientRequest

	// OriginatorLegalEntityType is only needed for Correspondent Send
	// integrations (PRIVATE or BUSINESS); optional.
	OriginatorLegalEntityType string
}

RefreshQuoteAccountRequirementsRequest completes the second pass of the recipient requirements flow: when a field returned by GetQuoteAccountRequirements is flagged RefreshRequirementsOnChange, submit the in-progress recipient form with that field updated and Wise returns the revised field set for the chosen route.

type RequestLog added in v0.9.0

type RequestLog struct {
	Method   string
	URL      string
	Status   int // 0 when the attempt failed at the transport layer.
	Duration time.Duration
	Attempt  int   // 1-based; greater than 1 means this was a retry.
	Error    error // Transport error, if any; API errors are not logged here.

	// RetryAfterDelay is positive only on a delay-decision entry, emitted
	// between retry attempts when Wise's 429 Retry-After hint steered the
	// inter-attempt wait (capped at the client's inter-attempt ceiling).
	// Such entries carry the 429 in Status, the honored wait in Duration,
	// and leave Method and URL empty — no exchange happened.
	RetryAfterDelay time.Duration
}

RequestLog describes one completed HTTP exchange with the Wise API.

type RequestLogFunc added in v0.9.0

type RequestLogFunc func(entry RequestLog)

RequestLogFunc adapts a plain function to Logger.

func (RequestLogFunc) LogRequest added in v0.9.0

func (f RequestLogFunc) LogRequest(entry RequestLog)

LogRequest implements Logger.

type SCAChallengeError added in v0.6.0

type SCAChallengeError struct {
	APIError
}

SCAChallengeError is returned when the Wise API answers 403 with Wise's two-factor headers instead of a body: Strong Customer Authentication is required for the request. This is not a token permission problem — the same token works on non-SCA endpoints. For balance-statement challenges the WORKING remedy is the account holder approving in the Wise app or on wise.com (view or export a statement): live-verified 2026-11-10, the one-time-token endpoints answer not-found for statement-challenge tokens even when the token is fresh and unraced, so Client.ClearSCAChallenge cannot clear that surface with a personal API token — documented, not intermittent (wire-proven 2026-11-25): the spec scopes those endpoints to security: [{"UserToken": []}] (OAuth user tokens only), and the guide "Personal API tokens" does not support statement retrieval for accounts outside US/CA/AU/NZ/SG/MY. A challenge that carries NO token in HeaderTwoFAApproval is, in production, usually the response to a STALE token presented on the request — presenting no token mints a fresh one every time (live-verified 2026-11-10) — so audit the caller's token source before blaming Wise. The token value deliberately never appears in the error message — fetch it with SCAChallengeError.TwoFAApprovalToken.

func (*SCAChallengeError) Error added in v0.6.0

func (e *SCAChallengeError) Error() string

func (*SCAChallengeError) ErrorCode added in v0.6.0

func (e *SCAChallengeError) ErrorCode() string

func (*SCAChallengeError) ErrorContext added in v0.11.0

func (e *SCAChallengeError) ErrorContext() map[string]string

func (*SCAChallengeError) TwoFAApprovalToken added in v0.6.0

func (e *SCAChallengeError) TwoFAApprovalToken() OneTimeToken

TwoFAApprovalToken returns the one-time token (OTT) this challenge was issued with, for the retry request's x-2fa-approval header. The zero value means the response carried no OTT header — the request is still SCA-blocked. Live-verified 2026-11-10: a tokenless verdict is usually the response to a STALE token presented on the request (presenting no token mints a fresh OTT every time), not a Wise-side flavor — audit the caller's token source before treating it as unprogrammable.

func (*SCAChallengeError) Unwrap added in v0.19.0

func (e *SCAChallengeError) Unwrap() error

type ServerError

type ServerError struct {
	APIError
}

ServerError is returned when the Wise API returns HTTP 5xx.

func (*ServerError) ErrorCode

func (e *ServerError) ErrorCode() string

func (*ServerError) ErrorFamily

func (e *ServerError) ErrorFamily() errorfamily.Family

func (*ServerError) IsRetryable

func (e *ServerError) IsRetryable() bool

func (*ServerError) Unwrap added in v0.19.0

func (e *ServerError) Unwrap() error

type StatementFormat added in v0.9.0

type StatementFormat string

StatementFormat identifies a balance-statement file format. The format selects the endpoint suffix; use ListTransactions for the parsed JSON form.

const (
	StatementFormatCSV   StatementFormat = "csv"
	StatementFormatPDF   StatementFormat = "pdf"  // Includes Wise branding.
	StatementFormatXLSX  StatementFormat = "xlsx" // Excel.
	StatementFormatCAMT  StatementFormat = "xml"  // CAMT.053 XML.
	StatementFormatMT940 StatementFormat = "mt940"
	StatementFormatQIF   StatementFormat = "qif"
)

Statement file formats Wise serves for a balance.

type StatementType added in v0.12.0

type StatementType string

StatementType represents the layout variants of the balance statement endpoints' type query parameter. The wire contract accepts COMPACT and FLAT only (docs/reviews/wise-api-openapi.json); the DetailType values are response-classification values, not statement filters.

const (
	StatementTypeCompact StatementType = "COMPACT"
	StatementTypeFlat    StatementType = "FLAT"
)

type ThirdPartyTransfer added in v0.14.0

type ThirdPartyTransfer struct {
	ID                 TransferID
	UserID             UserID
	TargetAccount      RecipientID
	SourceAccount      *RecipientID
	QuoteID            QuoteID
	Status             TransferStatus
	Rate               float64
	Reference          string
	HasActiveIssues    bool
	Source             Money
	Target             Money
	OriginalTransferID string
	Created            time.Time
}

ThirdPartyTransfer is the parsed originator transfer. The amounts are the wire's source/target values as Money.

type TotalFunds added in v0.9.0

type TotalFunds struct {
	Worth     Money // Cash plus the valuation of any invested portfolio.
	Available Money // Cash plus any approved overdraft limit.
}

TotalFunds is a profile-wide funds overview in a single currency.

type Transaction

type Transaction struct {
	ID             TransactionID
	ProfileID      ProfileID
	BalanceID      BalanceID
	Amount         Money
	Fees           Money
	Total          Money
	RunningBalance Money
	Exchange       *TransactionExchange
	Type           TransactionType
	Description    string
	Reference      string
	Category       string
	MerchantName   string
	Date           time.Time
}

Transaction is the parsed representation of a Wise transaction. All monetary amounts are Money values (int64 cents paired with Currency) for precision-safe arithmetic.

Date is returned in UTC. Wise statement dates carry no timezone; the SDK interprets them as UTC via time.Parse. Convert explicitly before comparing against local-time values.

type TransactionBrand

type TransactionBrand struct{}

TransactionBrand is a phantom type for TransactionID.

func (TransactionBrand) Name added in v0.12.0

func (TransactionBrand) Name() string

type TransactionExchange

type TransactionExchange struct {
	From Money
	To   Money
	Rate float64
}

TransactionExchange captures the currency-conversion details of an exchange transaction. nil when the transaction is not a conversion.

type TransactionID

type TransactionID = id.ID[TransactionBrand, string]

TransactionID is a strongly-typed identifier for Wise transactions.

func NewTransactionID

func NewTransactionID(v string) TransactionID

NewTransactionID creates a new TransactionID from a string value.

type TransactionType

type TransactionType string

TransactionType categorizes the transaction kind.

const (
	TransactionTypeCard     TransactionType = "card"
	TransactionTypeCredit   TransactionType = "credit"
	TransactionTypeDebit    TransactionType = "debit"
	TransactionTypeExchange TransactionType = "exchange"
	TransactionTypeFee      TransactionType = "fee"
	TransactionTypeRefund   TransactionType = "refund"
	TransactionTypeTransfer TransactionType = "transfer"
	TransactionTypePayment  TransactionType = "payment"
)

type Transfer added in v0.7.0

type Transfer struct {
	ID                    TransferID
	RecipientID           RecipientID
	SourceAccount         *BalanceID
	Status                TransferStatus
	Rate                  float64
	Source                Money
	Target                Money
	Created               time.Time
	Reference             string
	CustomerTransactionID CustomerTransactionID
	HasActiveIssues       bool
}

Transfer is the parsed representation of a Wise transfer — a payment order to a recipient account based on a quote. Unlike statement transactions, transfers are retrievable with a personal API token without SCA approval.

SourceAccount is the balance the transfer debits, when Wise reports one; nil means the response omitted sourceAccount. Callers attributing transfers to balances MUST match on it (currency alone is ambiguous when a profile holds several same-currency balances).

Created is parsed via the SDK's tolerant timestamp handling; zoneless values are interpreted as UTC.

type TransferActiveCasesData added in v0.14.0

type TransferActiveCasesData struct {
	Resource    WebhookResource
	ActiveCases []string
}

TransferActiveCasesData is the typed payload of transfers#active-cases events: the transfer's currently open compliance/case flags. The payload carries no occurred_at (unlike the other transfer events), so there is nothing to order by — process it as a snapshot of the current case set.

type TransferBrand added in v0.7.0

type TransferBrand struct{}

TransferBrand is a phantom type for TransferID.

func (TransferBrand) Name added in v0.12.0

func (TransferBrand) Name() string

type TransferID added in v0.7.0

type TransferID = id.ID[TransferBrand, int64]

TransferID is a strongly-typed identifier for Wise transfers.

func NewTransferID added in v0.7.0

func NewTransferID(v int64) TransferID

NewTransferID creates a new TransferID from an int64 value.

type TransferPayment added in v0.14.0

type TransferPayment struct {
	ID             TransferPaymentID
	Method         string
	PricingVariant *string
	Amount         Money
	Created        time.Time
	Updated        time.Time
}

TransferPayment is one completed payment that funded a transfer: the method used (BANK_TRANSFER, BALANCE, ...), the optional pricing variant, and the source amount actually debited.

type TransferPaymentBrand added in v0.14.0

type TransferPaymentBrand struct{}

TransferPaymentBrand is a phantom type for TransferPaymentID.

func (TransferPaymentBrand) Name added in v0.14.0

type TransferPaymentID added in v0.14.0

type TransferPaymentID = id.ID[TransferPaymentBrand, int64]

TransferPaymentID is a strongly-typed identifier for one funding payment of a transfer (wire "id" of GET /transfers/{transferId}/payments).

func NewTransferPaymentID added in v0.14.0

func NewTransferPaymentID(v int64) TransferPaymentID

NewTransferPaymentID creates a new TransferPaymentID from an int64 value.

type TransferPayoutFailureData added in v0.11.0

type TransferPayoutFailureData struct {
	TransferID         TransferID
	ProfileID          ProfileID
	FailureReasonCode  string
	FailureDescription string
	OccurredAt         time.Time
}

TransferPayoutFailureData is the typed payload of transfers#payout-failure events (schema version 5.0.0). FailureReasonCode is an open set — Wise adds new codes over time, so handle unrecognized codes defensively.

type TransferPayoutInfo added in v0.10.0

type TransferPayoutInfo struct {
	ProcessorName           string
	DeliveryMode            string
	BankingPartnerReference string
	BankingPartnerName      string
	MT103                   *string
}

TransferPayoutInfo is the banking-partner payout information for a transfer: who processed the payment, how it was delivered, the partner bank's tracking reference, and the SWIFT MT103 message when the corridor produced one.

MT103 is nil when no SWIFT message exists for the transfer (non-SWIFT corridors, or the message is not yet available).

type TransferRefundData added in v0.14.0

type TransferRefundData struct {
	Resource   WebhookResource
	Amount     Money
	OccurredAt time.Time
}

TransferRefundData is the typed payload of transfers#refund events, raised when a transfer's status becomes funds_refunded. Amount is the refunded sum as Money (the wire amount rides on the resource block in major units).

type TransferRequirement added in v0.8.0

type TransferRequirement struct {
	Type   string
	Fields []TransferRequirementForm
}

TransferRequirement is the parsed representation of one dynamic form from the transfer-requirements response.

art-dupl:accept parsed domain types intentionally mirror the tagged wire types in internal/raw; the tag-free domain layer decouples callers from the JSON shapes

type TransferRequirementField added in v0.8.0

type TransferRequirementField struct {
	Key                         string
	Name                        string
	Type                        string
	RefreshRequirementsOnChange bool
	Required                    bool
	DisplayFormat               *string
	Example                     *string
	MinLength                   *int32
	MaxLength                   *int32
	ValidationRegexp            *string
	ValuesAllowed               []TransferRequirementValue
}

TransferRequirementField describes a single dynamic form control. ValuesAllowed is populated only for select fields.

type TransferRequirementForm added in v0.8.0

type TransferRequirementForm struct {
	Name  string
	Group []TransferRequirementField
}

TransferRequirementForm is a labelled group of related form fields.

type TransferRequirementValue added in v0.8.0

type TransferRequirementValue struct {
	Key  string
	Name string
}

TransferRequirementValue is one allowed value of a select field.

type TransferRequirementsDetails added in v0.8.0

type TransferRequirementsDetails struct {
	Reference                         string
	SourceOfFunds                     string
	SourceOfFundsOther                string
	TransferPurpose                   string
	TransferPurposeSubTransferPurpose string
	TransferPurposeInvoiceNumber      string
	TransferNature                    string
}

TransferRequirementsDetails mirrors the free-form details block accepted by the validation endpoint.

type TransferStateChangeData added in v0.11.0

type TransferStateChangeData struct {
	Resource      WebhookResource
	CurrentState  TransferStatus
	PreviousState TransferStatus
	OccurredAt    time.Time
}

TransferStateChangeData is the typed payload of transfers#state-change events: the transfer's new and previous states. Wise recommends also subscribing to transfers#payout-failure — a payout can fail without the transfer state changing.

type TransferStatus added in v0.7.0

type TransferStatus string

TransferStatus is a Wise transfer lifecycle status. Wise may add values; unrecognised statuses are preserved as-is, so comparisons should use the constants only for the states they handle.

const (
	TransferStatusIncomingPaymentWaiting TransferStatus = "incoming_payment_waiting"
	TransferStatusWaitingForFunds        TransferStatus = "waiting_for_funds"
	TransferStatusProcessing             TransferStatus = "processing"
	TransferStatusFundsConverted         TransferStatus = "funds_converted"
	TransferStatusOutgoingPaymentSent    TransferStatus = "outgoing_payment_sent"
	TransferStatusBouncesCompleted       TransferStatus = "bounces_completed"
	TransferStatusDelivered              TransferStatus = "delivered"
	TransferStatusRefunded               TransferStatus = "refunded"
	TransferStatusCancelled              TransferStatus = "cancelled"
	TransferStatusUnsuccessful           TransferStatus = "unsuccessful"
	TransferStatusChargedBack            TransferStatus = "charged_back"
	TransferStatusFundsRefunded          TransferStatus = "funds_refunded"
)

Documented transfer lifecycle statuses (see Wise "Tracking transfers").

type USAccountIdentification added in v0.14.0

type USAccountIdentification struct {
	BIC                string
	RoutingNumber      string
	AccountNumber      string
	InstitutionName    string
	InstitutionAddress *ISO20022Address
}

USAccountIdentification is the US (ACH) details format.

type User added in v0.9.0

type User struct {
	ID      UserID
	Name    string
	Email   string
	Active  bool
	Details *UserDetails
}

User is the parsed representation of a Wise user account — the owner of an API token and its profiles. Details is nil when Wise has no personal details on file.

type UserAddress added in v0.9.0

type UserAddress struct {
	CountryCode string
	FirstLine   string
	PostCode    string
	City        string
	State       string
	Occupation  string
}

UserAddress is the address Wise has on file for a user.

type UserBrand added in v0.9.0

type UserBrand struct{}

UserBrand is a phantom type for UserID.

func (UserBrand) Name added in v0.12.0

func (UserBrand) Name() string

type UserDetails added in v0.9.0

type UserDetails struct {
	FirstName      string
	LastName       string
	PhoneNumber    string
	DateOfBirth    time.Time
	Occupation     string
	Avatar         string
	PrimaryAddress int64
	Address        *UserAddress
}

UserDetails is the personal-details block of a User. PrimaryAddress is the address object ID for Wise's addresses endpoints; DateOfBirth is parsed from Wise's date-only wire format and is the zero time when unset.

type UserID added in v0.9.0

type UserID = id.ID[UserBrand, int64]

UserID is a strongly-typed identifier for Wise user accounts.

func NewUserID added in v0.9.0

func NewUserID(v int64) UserID

NewUserID creates a new UserID from an int64 value.

type ValidateTransferRequirementsRequest added in v0.8.0

type ValidateTransferRequirementsRequest struct {
	TargetAccount             RecipientID
	QuoteID                   QuoteID
	CustomerTransactionID     CustomerTransactionID
	OriginatorLegalEntityType string
	Details                   TransferRequirementsDetails // Optional; populated from the response.
}

ValidateTransferRequirementsRequest asks Wise which dynamic transfer details are required for a specific quote and recipient combination. Requirements vary by currency route, transfer amount, and regulatory region; calling this before CreateTransfer avoids delays caused by missing details.

targetAccount and quoteUuid are required. customerTransactionId is optional; originatorLegalEntityType is required from March 2026 for Correspondent Send integrations (PRIVATE or BUSINESS).

type WebhookCreator added in v0.11.0

type WebhookCreator struct {
	ID   string
	Type WebhookCreatorType
}

WebhookCreator identifies what created a webhook subscription.

type WebhookCreatorType added in v0.11.0

type WebhookCreatorType string

WebhookCreatorType identifies what created a webhook subscription. Open string: unknown creator types pass through unchanged.

const (
	WebhookCreatorTypeApplication WebhookCreatorType = "application"
	WebhookCreatorTypeUser        WebhookCreatorType = "user"
)

Documented webhook subscription creator types.

type WebhookDelivery added in v0.11.0

type WebhookDelivery struct {
	Version string
	URL     string
}

WebhookDelivery is the transport contract of a webhook subscription: the HTTPS endpoint Wise POSTs event envelopes to, and the event-schema semantic version (e.g. "4.0.0") those payloads use.

type WebhookEvent added in v0.11.0

type WebhookEvent struct {
	SchemaVersion  string
	SubscriptionID WebhookSubscriptionID
	EventType      WebhookEventType
	SentAt         time.Time
	Data           jsontext.Value
}

WebhookEvent is the envelope Wise POSTs to a subscription's delivery URL whenever a subscribed event occurs. Data stays raw (jsontext.Value): the typed payload is decoded per event type via the accessor methods (TransferStateChange, TransferPayoutFailure, BalanceCredit), so unknown future event types parse without breaking. Compose with VerifyWebhookSignature — verify the raw request bytes first, then parse the same bytes; no combined helper is provided because a failed verification is a transport-level rejection (answer 401/403), not a parse error.

func ParseWebhookEvent added in v0.11.0

func ParseWebhookEvent(payload []byte) (*WebhookEvent, error)

ParseWebhookEvent decodes the envelope Wise POSTs to a subscription's delivery URL: schema version, subscription ID, event type, sent-at timestamp, and the raw data payload. The event type set is open — envelopes with event types this SDK has never seen parse successfully (Data stays raw for hand decoding), so new Wise events never break your handler.

Compose with VerifyWebhookSignature: verify the raw request bytes first, then parse the same bytes (see VerifyWebhookSignature for the signature header). Malformed envelopes — undecodable JSON, a missing event type, an unparseable sent_at — are corruption-classified errors: the sender's bytes cannot be trusted, so the delivery should be rejected.

Example

Verify a delivery, then decode the envelope and its typed payload. Unknown event types parse fine — the data stays raw — so new Wise events never break your handler.

package main

import (
	"io"
	"log"
	"net/http"

	"github.com/larsartmann/wise-go"
)

func main() {
	webhookKey, err := wise.ParseWebhookPublicKey([]byte(`-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA... (from the dashboard)
-----END PUBLIC KEY-----`))
	if err != nil {
		log.Fatal(err)
	}

	http.HandleFunc("/webhooks/wise", func(w http.ResponseWriter, r *http.Request) {
		body, readErr := io.ReadAll(r.Body)
		if readErr != nil {
			http.Error(w, "read body", http.StatusBadRequest)

			return
		}

		if !wise.VerifyWebhookSignature(body, r.Header.Get(wise.HeaderWebhookSignature), webhookKey) {
			http.Error(w, "invalid signature", http.StatusUnauthorized)

			return
		}

		event, parseErr := wise.ParseWebhookEvent(body)
		if parseErr != nil {
			http.Error(w, "malformed event", http.StatusBadRequest)

			return
		}

		switch event.EventType {
		case wise.WebhookEventTransfersStateChange:
			state, stateErr := event.TransferStateChange()
			if stateErr != nil {
				http.Error(w, "malformed payload", http.StatusBadRequest)

				return
			}

			if state.CurrentState == "blocked" {
				log.Printf("transfer %d blocked (was %s)", state.Resource.ID, state.PreviousState)
			}
		case wise.WebhookEventTransfersPayoutFailure:
			failure, failureErr := event.TransferPayoutFailure()
			if failureErr != nil {
				http.Error(w, "malformed payload", http.StatusBadRequest)

				return
			}

			log.Printf("payout failed: %s", failure.FailureReasonCode)
		default:
			// Unrecognized event type: the envelope is valid, the payload is
			// raw. Log it and acknowledge — Wise redelivers otherwise.
			log.Printf("unhandled event %s", event.EventType)
		}

		w.WriteHeader(http.StatusOK)
	})
}

func (*WebhookEvent) BalanceCredit added in v0.11.0

func (e *WebhookEvent) BalanceCredit() (*BalanceCreditData, error)

BalanceCredit decodes the data payload of a balances#credit event. Calling it on an envelope of a different event type fails with a corruption-classified error.

func (*WebhookEvent) TransferActiveCases added in v0.14.0

func (e *WebhookEvent) TransferActiveCases() (*TransferActiveCasesData, error)

TransferActiveCases decodes the data payload of a transfers#active-cases event. The payload carries no occurred_at, so nothing is parsed beyond the case list. Calling it on an envelope of a different event type fails with a corruption-classified error.

func (*WebhookEvent) TransferPayoutFailure added in v0.11.0

func (e *WebhookEvent) TransferPayoutFailure() (*TransferPayoutFailureData, error)

TransferPayoutFailure decodes the data payload of a transfers#payout-failure event. Calling it on an envelope of a different event type fails with a corruption-classified error.

func (*WebhookEvent) TransferRefund added in v0.14.0

func (e *WebhookEvent) TransferRefund() (*TransferRefundData, error)

TransferRefund decodes the data payload of a transfers#refund event, parsing the resource-block refund amount into Money. Calling it on an envelope of a different event type fails with a corruption-classified error.

func (*WebhookEvent) TransferStateChange added in v0.11.0

func (e *WebhookEvent) TransferStateChange() (*TransferStateChangeData, error)

TransferStateChange decodes the data payload of a transfers#state-change event. Calling it on an envelope of a different event type fails with a corruption-classified error.

type WebhookEventType added in v0.11.0

type WebhookEventType string

WebhookEventType names the Wise event a webhook subscription listens for (the create request's TriggerOn) or that a delivered event envelope carries. The set is open: Wise adds event types over time, so any string is representable and unknown values pass through unchanged.

const (
	WebhookEventTransfersStateChange                    WebhookEventType = "transfers#state-change"
	WebhookEventTransfersPayoutFailure                  WebhookEventType = "transfers#payout-failure"
	WebhookEventTransfersActiveCases                    WebhookEventType = "transfers#active-cases"
	WebhookEventTransfersRefund                         WebhookEventType = "transfers#refund"
	WebhookEventTransfersCaseStateChange                WebhookEventType = "transfers#case-state-change"
	WebhookEventBalancesCredit                          WebhookEventType = "balances#credit"
	WebhookEventBalancesDebit                           WebhookEventType = "balances#debit"
	WebhookEventBalancesThresholdMet                    WebhookEventType = "balances#threshold-met"
	WebhookEventBalancesPendingTransactionStateChange   WebhookEventType = "balances#pending-transaction-state-change"
	WebhookEventBatchPaymentInitiationsStateChange      WebhookEventType = "batch-payment-initiations#state-change"
	WebhookEventBatchTransfersStateChange               WebhookEventType = "batch-transfers#state-change"
	WebhookEventCards3DSChallenge                       WebhookEventType = "cards#3ds-challenge"
	WebhookEventCardsCardProductionStatusChange         WebhookEventType = "cards#card-production-status-change"
	WebhookEventCardsCardStatusChange                   WebhookEventType = "cards#card-status-change"
	WebhookEventCardsTransactionStateChange             WebhookEventType = "cards#transaction-state-change"
	WebhookEventCustomerAgreementsAgreementStatusChange WebhookEventType = "customer-agreements#agreement-status-change"
	WebhookEventDirectDebitsStateChange                 WebhookEventType = "direct-debits#state-change"
	WebhookEventProfilesDocumentStateChange             WebhookEventType = "profiles#document-state-change"
	WebhookEventProfilesVerificationStateChange         WebhookEventType = "profiles#verification-state-change"
	WebhookEventRecipientAccountsStateChange            WebhookEventType = "recipient-accounts#state-change"
	WebhookEventSimulationsCardTransactionCreated       WebhookEventType = "simulations#card-transaction-created"
	WebhookEventSimulationsCardTransactionCleared       WebhookEventType = "simulations#card-transaction-cleared"
	WebhookEventSimulationsCardTransactionReversed      WebhookEventType = "simulations#card-transaction-reversed"
	WebhookEventSpendTransactionStateChange             WebhookEventType = "spend#transaction-state-change"
	WebhookEventSwiftInCredit                           WebhookEventType = "swift-in#credit"
	WebhookEventTrustedPartiesStateChange               WebhookEventType = "trusted-parties#state-change"
	WebhookEventVouchersStateChange                     WebhookEventType = "vouchers#state-change"
	WebhookEventVouchersBatchStateChange                WebhookEventType = "vouchers#batch-state-change"
	WebhookEventVouchersBalanceCheck                    WebhookEventType = "vouchers#balance-check"
	WebhookEventVouchersRedemptionStatusChange          WebhookEventType = "vouchers#redemption-status-change"
	WebhookEventVouchersRedemptionNotification          WebhookEventType = "vouchers#redemption-notification"
	WebhookEventAccountDetailsOrderOrderStateChange     WebhookEventType = "account-details-order#order-state-change"
	WebhookEventAccountDetailsPaymentStateChange        WebhookEventType = "account-details-payment#state-change"
)

Documented Wise webhook event types (the trigger_on values), from the OpenAPI spec and the live webhook-event reference. The list is a convenience, not a constraint — subscriptions accept any event type string.

type WebhookResource added in v0.11.0

type WebhookResource struct {
	Type      string
	ID        int64 // ID space varies by event type: a transfer ID on transfer events, a balance ID on account-details events.
	ProfileID ProfileID
	AccountID *int64 // ID space varies by event type: a recipient account ID on transfer events, a balance ID on swift-in credit events.
}

WebhookResource identifies the entity an event payload is about (e.g. the transfer that changed state, or the balance account that was credited). AccountID is only present for transfer events.

type WebhookScope added in v0.11.0

type WebhookScope struct {
	Domain WebhookScopeDomain
	ID     string
}

WebhookScope names the owning surface of a webhook subscription: the client key (application scope) or the profile ID (profile scope).

type WebhookScopeDomain added in v0.11.0

type WebhookScopeDomain string

WebhookScopeDomain names the owning surface of a webhook subscription. Open string: unknown domains pass through unchanged.

const (
	WebhookScopeDomainApplication WebhookScopeDomain = "application"
	WebhookScopeDomainProfile     WebhookScopeDomain = "profile"
)

Documented webhook subscription scope domains.

type WebhookSubscription added in v0.11.0

type WebhookSubscription struct {
	ID        WebhookSubscriptionID
	Name      string
	TriggerOn WebhookEventType
	Delivery  WebhookDelivery
	CreatedAt time.Time
	CreatedBy WebhookCreator
	Scope     WebhookScope
}

WebhookSubscription is a registered webhook: the standing instruction for Wise to POST an event envelope to Delivery.URL whenever the TriggerOn event occurs. Subscriptions have no update operation — they are created, listed, fetched, and deleted, never edited.

type WebhookSubscriptionBrand added in v0.11.0

type WebhookSubscriptionBrand struct{}

WebhookSubscriptionBrand is a phantom type for WebhookSubscriptionID.

func (WebhookSubscriptionBrand) Name added in v0.12.0

type WebhookSubscriptionID added in v0.11.0

type WebhookSubscriptionID = id.ID[WebhookSubscriptionBrand, string]

WebhookSubscriptionID is a strongly-typed identifier for Wise webhook subscriptions. Like QuoteID it is a UUID string on the wire (spec: "UUID that uniquely identifies the subscription"), not an int64.

func NewWebhookSubscriptionID added in v0.11.0

func NewWebhookSubscriptionID(v string) WebhookSubscriptionID

NewWebhookSubscriptionID creates a new WebhookSubscriptionID from a string UUID value.

type WiseErrorCode added in v0.15.0

type WiseErrorCode string

WiseErrorCode is Wise's own granular, machine-readable error code from the errors[].code field of a non-2xx response body (for example resource_not_found on a 404 or rate_limit_exceeded on a 429). It is an open enum: Wise documents a growing set of codes and may add new ones at any time, so values received from the wire pass through unmodified; switch on the constants for known cases and handle the default explicitly. Read the codes structurally from APIError.Details, match the curated ones with errors.Is against the Err* code sentinels, or branch on any code (curated or not) with APIError.HasCode.

const (
	WiseErrorCodeNotValid              WiseErrorCode = "not.valid"
	WiseErrorCodeInvalidValue          WiseErrorCode = "invalid_value"
	WiseErrorCodeParameterMissing      WiseErrorCode = "parameter_missing"
	WiseErrorCodeParameterInvalid      WiseErrorCode = "parameter_invalid"
	WiseErrorCodeMissingValue          WiseErrorCode = "missing_value"
	WiseErrorCodeInvalidRequest        WiseErrorCode = "invalid_request"
	WiseErrorCodeUnauthorized          WiseErrorCode = "unauthorized"
	WiseErrorCodeForbidden             WiseErrorCode = "forbidden"
	WiseErrorCodeResourceNotFound      WiseErrorCode = "resource_not_found"
	WiseErrorCodeOperationNotSupported WiseErrorCode = "operation_not_supported"
	WiseErrorCodeRateLimitExceeded     WiseErrorCode = "rate_limit_exceeded"
	WiseErrorCodeSystemError           WiseErrorCode = "system_error"
	WiseErrorCodeInvalidFileExtension  WiseErrorCode = "invalid_file_extension"
	WiseErrorCodeUnexpectedError       WiseErrorCode = "unexpected.error"
)

Granular Wise error codes from the documented API surface (census against the vendored OpenAPI snapshot, 2026-10-16). This list is deliberately NOT exhaustive: it names the codes with a consumer branching story. Unknown wire values are valid WiseErrorCodes.

func Code added in v0.19.0

func Code(err error) (WiseErrorCode, bool)

Code returns the first granular Wise code carried by err, in wire order, and whether err was a Wise API error with a decodable envelope at all. It is the open-enum read: switch on the result, handle unknown values explicitly, and use the second return to tell "Wise said no" from "the request never reached Wise".

type WiseErrorDetail added in v0.15.0

type WiseErrorDetail struct {
	Code    WiseErrorCode
	Message string
}

WiseErrorDetail is one entry of Wise's structured error envelope: the granular wire code plus Wise's own human-readable message for that entry. A single response can carry several entries (the envelope is an array).

Directories

Path Synopsis
internal
raw
Package raw contains Wise API wire-format types used for JSON deserialization.
Package raw contains Wise API wire-format types used for JSON deserialization.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址