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")
}
}
}
Output:
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")
}
}
}
Output:
Index ¶
- Constants
- Variables
- func HasCode(err error, code WiseErrorCode) bool
- func IsNotFound(err error) bool
- func IsRetryable(err error) bool
- func MissingTransferDetails(requirements []TransferRequirement, req CreateTransferRequest) []string
- func ParseWebhookPublicKey(pemBytes []byte) (*rsa.PublicKey, error)
- func RetryAfter(err error) (time.Duration, bool)
- func VerifyWebhookSignature(payload []byte, signatureB64 string, key *rsa.PublicKey) bool
- func WithRequestCorrelationID(ctx context.Context, id string) context.Context
- type APIError
- type AccountBrand
- type AccountDetails
- type AccountDetailsBrand
- type AccountDetailsID
- type AccountDetailsState
- type AccountID
- type AccountIdentification
- type AccountRequirement
- type Activity
- type ActivityAmount
- type ActivityPage
- type ActivityResourceType
- type ActivityStatus
- type ActivityType
- type AuthError
- type BEAccountIdentification
- type BadRequestError
- type Balance
- type BalanceBrand
- type BalanceCreditData
- type BalanceID
- type BalanceTransactionBrand
- type BalanceTransactionID
- type BalanceType
- type CatalogEntry
- type Client
- func (c *Client) Authenticate(ctx context.Context) error
- func (c *Client) CancelTransfer(ctx context.Context, transferID TransferID) (*Transfer, error)
- func (c *Client) ClearSCAChallenge(ctx context.Context, ott OneTimeToken, channel OTTChannel, ...) (*OTTStatus, error)
- func (c *Client) CreateBalance(ctx context.Context, req CreateBalanceRequest) (*Balance, error)
- func (c *Client) CreateProfileWebhookSubscription(ctx context.Context, profileID ProfileID, req CreateWebhookSubscriptionRequest) (*WebhookSubscription, error)
- func (c *Client) CreateQuote(ctx context.Context, profileID ProfileID, req CreateQuoteRequest) (*Quote, error)
- func (c *Client) CreateRecipient(ctx context.Context, req CreateRecipientRequest) (*Recipient, error)
- func (c *Client) CreateThirdPartyTransfer(ctx context.Context, req CreateThirdPartyTransferRequest) (*ThirdPartyTransfer, error)
- func (c *Client) CreateTransfer(ctx context.Context, req CreateTransferRequest) (*Transfer, error)
- func (c *Client) CreateUnauthenticatedQuote(ctx context.Context, req CreateQuoteRequest) (*Quote, error)
- func (c *Client) DeleteProfileWebhookSubscription(ctx context.Context, profileID ProfileID, subscriptionID WebhookSubscriptionID) error
- func (c *Client) FundTransfer(ctx context.Context, profileID ProfileID, transferID TransferID) (*FundTransferResult, error)
- func (c *Client) GetBalance(ctx context.Context, profileID ProfileID, balanceID BalanceID) (*Balance, error)
- func (c *Client) GetBankAccountDetails(ctx context.Context, id AccountDetailsID) (*AccountDetails, error)
- func (c *Client) GetDeliveryEstimate(ctx context.Context, transferID TransferID, timezone string) (*DeliveryEstimate, error)
- func (c *Client) GetExchangeRate(ctx context.Context, source, target Currency, atTime time.Time) (*ExchangeRate, error)
- func (c *Client) GetMe(ctx context.Context) (*User, error)
- func (c *Client) GetMultiCurrencyAccount(ctx context.Context, profileID ProfileID) (*MultiCurrencyAccount, error)
- func (c *Client) GetOTTStatus(ctx context.Context, ott OneTimeToken) (*OTTStatus, error)
- func (c *Client) GetProfile(ctx context.Context, profileID ProfileID) (*Profile, error)
- func (c *Client) GetProfileWebhookSubscription(ctx context.Context, profileID ProfileID, subscriptionID WebhookSubscriptionID) (*WebhookSubscription, error)
- func (c *Client) GetQuote(ctx context.Context, profileID ProfileID, quoteID QuoteID) (*Quote, error)
- func (c *Client) GetQuoteAccountRequirements(ctx context.Context, req QuoteAccountRequirementsRequest) ([]AccountRequirement, error)
- func (c *Client) GetRecipient(ctx context.Context, recipientID RecipientID) (*Recipient, error)
- func (c *Client) GetStatement(ctx context.Context, req GetStatementRequest) ([]byte, error)
- func (c *Client) GetThirdPartyTransfer(ctx context.Context, profileID ProfileID, transferID TransferID) (*ThirdPartyTransfer, error)
- func (c *Client) GetTotalFunds(ctx context.Context, profileID ProfileID, currency Currency) (*TotalFunds, error)
- func (c *Client) GetTransfer(ctx context.Context, transferID TransferID) (*Transfer, error)
- func (c *Client) GetTransferNOC(ctx context.Context, transferID TransferID) ([]byte, error)
- func (c *Client) GetTransferPayoutInfo(ctx context.Context, transferID TransferID) (*TransferPayoutInfo, error)
- func (c *Client) GetTransferReceipt(ctx context.Context, transferID TransferID) ([]byte, error)
- func (c *Client) GetUSCombinedReceipt(ctx context.Context, transferID TransferID) ([]byte, error)
- func (c *Client) GetUser(ctx context.Context, userID UserID) (*User, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) ListActivities(ctx context.Context, req ListActivitiesRequest) (*ActivityPage, error)
- func (c *Client) ListBalances(ctx context.Context, profileID ProfileID) ([]Balance, error)
- func (c *Client) ListCurrencies(ctx context.Context) ([]CurrencyInfo, error)
- func (c *Client) ListProfileWebhookSubscriptions(ctx context.Context, profileID ProfileID) ([]WebhookSubscription, error)
- func (c *Client) ListProfiles(ctx context.Context) ([]Profile, error)
- func (c *Client) ListRecipients(ctx context.Context, req ListRecipientsRequest) ([]Recipient, error)
- func (c *Client) ListTransactions(ctx context.Context, req ListTransactionsRequest) (*ListTransactionsResponse, error)
- func (c *Client) ListTransferPayments(ctx context.Context, transferID TransferID) ([]TransferPayment, error)
- func (c *Client) ListTransfers(ctx context.Context, req ListTransfersRequest) ([]Transfer, error)
- func (c *Client) RefreshQuoteAccountRequirements(ctx context.Context, req RefreshQuoteAccountRequirementsRequest) ([]AccountRequirement, error)
- func (c *Client) TriggerOTT(ctx context.Context, ott OneTimeToken, channel OTTChannel) (*OTTTriggerResult, error)
- func (c *Client) ValidateTransferRequirements(ctx context.Context, req ValidateTransferRequirementsRequest) ([]TransferRequirement, error)
- func (c *Client) VerifyCredentials(ctx context.Context) error
- func (c *Client) VerifyOTT(ctx context.Context, ott OneTimeToken, channel OTTChannel, otpCode string) (*OTTStatus, error)
- type CreateBalanceRequest
- type CreateQuoteRequest
- type CreateRecipientRequest
- type CreateThirdPartyTransferRequest
- type CreateTransferRequest
- type CreateWebhookSubscriptionRequest
- type Currency
- type CurrencyInfo
- type CustomerTransactionID
- type CustomerTransactionIDBrand
- type DeliveryEstimate
- type DetailType
- type Doer
- type ExchangeRate
- type FundTransferResult
- type FundingErrorCode
- type FundingStatus
- type FundingType
- type GBAccountIdentification
- type GetStatementRequest
- type ISO20022Address
- type InvestmentState
- type ListActivitiesRequest
- type ListRecipientsRequest
- type ListTransactionsRequest
- type ListTransactionsResponse
- type ListTransfersRequest
- type Logger
- type Money
- type MultiCurrencyAccount
- type NotFoundError
- type OTTAction
- type OTTChallenge
- type OTTChallengeType
- type OTTChallengeView
- type OTTChannel
- type OTTCodeProvider
- type OTTStatus
- type OTTTriggerResult
- type OneTimeToken
- type Option
- func WithBaseURL(url string) Option
- func WithCorrelationID(id string) Option
- func WithHTTPClient(client Doer) Option
- func WithLogger(logger Logger) Option
- func WithRetry(maxRetries int, minDelay, maxDelay time.Duration) Option
- func WithSCAApprovalToken(token OneTimeToken) Option
- func WithSandbox() Option
- func WithTimeout(timeout time.Duration) Option
- func WithUserAgent(userAgent string) Option
- type Originator
- type OriginatorAddress
- type OriginatorLegalEntityType
- type OriginatorName
- type PayIn
- type PayOut
- type Profile
- type ProfileBrand
- type ProfileID
- type ProfileType
- type Quote
- type QuoteAccountRequirementsRequest
- type QuoteBrand
- type QuoteFee
- type QuoteID
- type QuoteNotice
- type QuoteNoticeType
- type QuotePaymentOption
- type QuoteProvidedAmountType
- type QuoteRateType
- type QuoteStatus
- type RateLimitError
- type Recipient
- type RecipientBrand
- type RecipientID
- type RefreshQuoteAccountRequirementsRequest
- type RequestLog
- type RequestLogFunc
- type SCAChallengeError
- type ServerError
- type StatementFormat
- type StatementType
- type ThirdPartyTransfer
- type TotalFunds
- type Transaction
- type TransactionBrand
- type TransactionExchange
- type TransactionID
- type TransactionType
- type Transfer
- type TransferActiveCasesData
- type TransferBrand
- type TransferID
- type TransferPayment
- type TransferPaymentBrand
- type TransferPaymentID
- type TransferPayoutFailureData
- type TransferPayoutInfo
- type TransferRefundData
- type TransferRequirement
- type TransferRequirementField
- type TransferRequirementForm
- type TransferRequirementValue
- type TransferRequirementsDetails
- type TransferStateChangeData
- type TransferStatus
- type USAccountIdentification
- type User
- type UserAddress
- type UserBrand
- type UserDetails
- type UserID
- type ValidateTransferRequirementsRequest
- type WebhookCreator
- type WebhookCreatorType
- type WebhookDelivery
- type WebhookEvent
- func (e *WebhookEvent) BalanceCredit() (*BalanceCreditData, error)
- func (e *WebhookEvent) TransferActiveCases() (*TransferActiveCasesData, error)
- func (e *WebhookEvent) TransferPayoutFailure() (*TransferPayoutFailureData, error)
- func (e *WebhookEvent) TransferRefund() (*TransferRefundData, error)
- func (e *WebhookEvent) TransferStateChange() (*TransferStateChangeData, error)
- type WebhookEventType
- type WebhookResource
- type WebhookScope
- type WebhookScopeDomain
- type WebhookSubscription
- type WebhookSubscriptionBrand
- type WebhookSubscriptionID
- type WiseErrorCode
- type WiseErrorDetail
Examples ¶
- Package (ErrorHandling)
- Package (ErrorMatchingSentinels)
- APIError.HasCode
- Client.CancelTransfer
- Client.ClearSCAChallenge
- Client.CreateBalance
- Client.CreateProfileWebhookSubscription
- Client.CreateQuote
- Client.CreateThirdPartyTransfer
- Client.FundTransfer
- Client.GetBalance
- Client.GetBankAccountDetails
- Client.GetDeliveryEstimate
- Client.GetMe
- Client.GetMultiCurrencyAccount
- Client.GetOTTStatus
- Client.GetStatement
- Client.GetThirdPartyTransfer
- Client.GetTotalFunds
- Client.GetTransfer
- Client.GetTransferNOC
- Client.GetTransferPayoutInfo
- Client.GetTransferReceipt
- Client.GetUSCombinedReceipt
- Client.GetUser
- Client.Health
- Client.ListActivities
- Client.ListCurrencies
- Client.ListProfileWebhookSubscriptions
- Client.ListTransferPayments
- Client.ListTransfers
- Client.ValidateTransferRequirements
- Client.VerifyCredentials
- Money.String
- Money.String (Negative)
- NewCurrency
- ParseWebhookEvent
- VerifyWebhookSignature
Constants ¶
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).
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.
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.
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).
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.
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 ¶
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.
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") // "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
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
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
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
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
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)
})
}
Output:
func WithRequestCorrelationID ¶ added in v0.9.0
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) ErrorContext ¶
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")
}
}
Output:
func (*APIError) Is ¶ added in v0.15.0
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
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.
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 ¶
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
func (BalanceTransactionBrand) Name() string
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 ¶
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 ¶
Authenticate validates the API key by calling ListProfiles.
func (*Client) CancelTransfer ¶ added in v0.8.0
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)
}
Output:
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())
}
}
}
Output:
func (*Client) CreateBalance ¶ added in v0.9.0
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)
}
Output:
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)
}
}
Output:
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)
}
}
Output:
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)
}
Output:
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)
}
Output:
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)
}
Output:
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)
}
}
Output:
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)
}
Output:
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
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)
}
Output:
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)
}
Output:
func (*Client) GetOTTStatus ¶ added in v0.11.0
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))
}
Output:
func (*Client) GetProfile ¶ added in v0.8.0
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
GetRecipient returns a single recipient account by ID.
func (*Client) GetStatement ¶ added in v0.9.0
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)
}
}
Output:
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)
}
Output:
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)
}
Output:
func (*Client) GetTransfer ¶ added in v0.8.0
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)
}
Output:
func (*Client) GetTransferNOC ¶ added in v0.14.0
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)
}
}
Output:
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)
}
}
Output:
func (*Client) GetTransferReceipt ¶ added in v0.10.0
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)
}
}
Output:
func (*Client) GetUSCombinedReceipt ¶ added in v0.14.0
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)
}
}
Output:
func (*Client) GetUser ¶ added in v0.9.0
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())
}
}
Output:
func (*Client) Health ¶
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")
}
Output:
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.
}
Output:
func (*Client) ListBalances ¶
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)
}
}
}
Output:
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)
}
}
Output:
func (*Client) ListProfiles ¶
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)
}
}
Output:
func (*Client) ListTransfers ¶ added in v0.7.0
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)
}
Output:
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)
}
}
Output:
func (*Client) VerifyCredentials ¶ added in v0.17.0
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")
}
Output:
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 ¶
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
func (CustomerTransactionIDBrand) Name() string
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 ¶
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
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" 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" )
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
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 ¶
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
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 ¶
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
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 ¶
WithBaseURL sets a custom base URL (overrides production/sandbox).
func WithCorrelationID ¶
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 ¶
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
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 ¶
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 ¶
WithTimeout sets the HTTP client timeout.
func WithUserAgent ¶ added in v0.11.0
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 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 ¶
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
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
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 ¶
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 ¶
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
func (TransferPaymentBrand) Name() string
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
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 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 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
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)
})
}
Output:
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
func (WebhookSubscriptionBrand) Name() string
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" 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).