Documentation
¶
Overview ¶
Package revolut is the top-level entry point for the Revolut Go SDK.
It provides a unified Client that composes all API sub-clients:
- Merchant – online payment orders, customers, subscriptions, disputes
- Business – accounts, transfers, FX, payment drafts, payout links
- OpenBanking – consent-based account info and payment initiation (TPPs)
- CryptoRamp – fiat-to-crypto on-ramp for partners
- CryptoExchange – Revolut X trading: orders, balances, market data
Quick Start ¶
sdk, err := revolut.New(
revolut.WithMerchantKey("sk_live_..."),
revolut.WithBusinessKey("business_sk_..."),
revolut.WithEnvironment(types.EnvProduction),
revolut.WithRateLimit(50, 100),
)
order, err := sdk.Merchant.CreateOrder(ctx, &merchant.CreateOrderRequest{
Amount: 1000,
Currency: "GBP",
})
Sandbox ¶
sdk, err := revolut.New(
revolut.WithMerchantKey("sk_sandbox_..."),
revolut.WithSandbox(),
)
Telemetry ¶
sdk, err := revolut.New(
revolut.WithMerchantKey("..."),
revolut.WithTelemetry(telemetry.Hook{
OnRequest: func(ctx context.Context, e telemetry.RequestEvent) { /* log */ },
OnResponse: func(ctx context.Context, e telemetry.ResponseEvent) { /* metrics */ },
OnError: func(ctx context.Context, e telemetry.ErrorEvent) { /* alert */ },
}),
)
Index ¶
- type SDK
- type SDKOption
- func WithBusinessKey(key string) SDKOption
- func WithCryptoExchangeKey(key string) SDKOption
- func WithCryptoRampKey(key string) SDKOption
- func WithEnvironment(env types.Environment) SDKOption
- func WithMerchantKey(key string) SDKOption
- func WithNoRetry() SDKOption
- func WithOpenBankingKey(key string) SDKOption
- func WithRateLimit(perSecond, burst float64) SDKOption
- func WithRetryPolicy(p retry.Policy) SDKOption
- func WithSandbox() SDKOption
- func WithTelemetry(h telemetry.Hook) SDKOption
- func WithUserAgent(ua string) SDKOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SDK ¶
type SDK struct {
// Merchant is the Revolut Merchant API client.
Merchant *merchant.Client
// Business is the Revolut Business API client.
Business *business.Client
// OpenBanking is the Revolut Open Banking API client (TPP use).
OpenBanking *openbanking.Client
// CryptoRamp is the Revolut Crypto Ramp API client (partner use).
CryptoRamp *cryptoramp.Client
// CryptoExchange is the Revolut X Crypto Exchange REST API client.
CryptoExchange *cryptoexchange.Client
}
SDK is the unified Revolut client that composes all API sub-clients. Construct it with New() and functional options. All sub-clients are safe for concurrent use.
type SDKOption ¶
type SDKOption func(*sdkConfig)
SDKOption configures the top-level SDK.
func WithBusinessKey ¶
WithBusinessKey sets the access token for the Business API.
func WithCryptoExchangeKey ¶
WithCryptoExchangeKey sets the API key for the Crypto Exchange REST API.
func WithCryptoRampKey ¶
WithCryptoRampKey sets the X-API-KEY for the Crypto Ramp API.
func WithEnvironment ¶
func WithEnvironment(env types.Environment) SDKOption
WithEnvironment sets the API environment (prod or sandbox) for all clients.
func WithMerchantKey ¶
WithMerchantKey sets the secret key for the Merchant API.
func WithOpenBankingKey ¶
WithOpenBankingKey sets the bearer token for the Open Banking API.
func WithRateLimit ¶
WithRateLimit configures a shared token-bucket rate limiter applied to all sub-clients. perSecond is the sustained rate; burst is the max burst size.
func WithRetryPolicy ¶
WithRetryPolicy sets the retry policy for all sub-clients.
func WithSandbox ¶
func WithSandbox() SDKOption
WithSandbox is a convenience alias for WithEnvironment(types.EnvSandbox).
func WithTelemetry ¶
WithTelemetry attaches observability hooks to all sub-clients.
func WithUserAgent ¶
WithUserAgent sets a custom User-Agent on all sub-clients.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package business implements the complete Revolut Business API.
|
Package business implements the complete Revolut Business API. |
|
Package client implements the core HTTP transport layer for the Revolut Go SDK.
|
Package client implements the core HTTP transport layer for the Revolut Go SDK. |
|
Package cryptoexchange implements the complete Revolut X Crypto Exchange REST API.
|
Package cryptoexchange implements the complete Revolut X Crypto Exchange REST API. |
|
Package cryptoramp implements the complete Revolut Crypto Ramp API.
|
Package cryptoramp implements the complete Revolut Crypto Ramp API. |
|
Package errors provides structured error types for the Revolut Go SDK.
|
Package errors provides structured error types for the Revolut Go SDK. |
|
internal
|
|
|
ratelimit
Package ratelimit implements a thread-safe token-bucket rate limiter using only the Go standard library.
|
Package ratelimit implements a thread-safe token-bucket rate limiter using only the Go standard library. |
|
retry
Package retry implements exponential backoff with full jitter for transient HTTP failures.
|
Package retry implements exponential backoff with full jitter for transient HTTP failures. |
|
signature
Package signature provides HMAC-SHA256 webhook payload verification using constant-time comparison to prevent timing attacks.
|
Package signature provides HMAC-SHA256 webhook payload verification using constant-time comparison to prevent timing attacks. |
|
telemetry
Package telemetry defines hook interfaces for request/response observability.
|
Package telemetry defines hook interfaces for request/response observability. |
|
Package merchant implements the complete Revolut Merchant API.
|
Package merchant implements the complete Revolut Merchant API. |
|
Package openbanking implements the complete Revolut Open Banking API.
|
Package openbanking implements the complete Revolut Open Banking API. |
|
Package types provides all shared value types, enumerations, and pagination primitives used across every Revolut API sub-package.
|
Package types provides all shared value types, enumerations, and pagination primitives used across every Revolut API sub-package. |
|
Package webhook provides HTTP middleware and typed event parsing for Revolut webhook payloads.
|
Package webhook provides HTTP middleware and typed event parsing for Revolut webhook payloads. |