Go SDK configuration
You configure the SDK once, when you call mitu.New. The function validates your options straight away and returns an error wrapping ErrConfig if anything is wrong, so a mistake such as a malformed key is caught when your program starts. Creating the client does not contact Mitu, so your program can start even if Mitu happens to be unreachable at that moment. The client is safe to share across goroutines and holds no background resources, so there is nothing to close when your program exits.
Options
Sandbox and production
Your key decides which Mitu environment the SDK connects to, so there is no separate environment field.
Use a sandbox key while you develop and test, and switch to a live key when you are ready to accept real payments. Any other value causes mitu.New to return an error wrapping ErrConfig.
Default currency
Most APIs price everything in one currency. Setting DefaultCurrency means you only have to give the amount for each route. A route can still name a different currency when it needs to.
The currency must be enabled on your Mitu account. When a route is priced in a currency other than the one the caller pays in, Mitu converts the amount at a rate it locks when the payment is created.
HTTP client
By default the SDK creates its own HTTP client. You can pass your own instead, which is useful when you want to add tracing to outgoing calls or send them through a particular transport.
Logging
The SDK only logs through the *slog.Logger you provide. If you do not set one, its messages are discarded. The SDK takes care never to log anything sensitive, so its messages never include your key, a payment credential, a receipt or a request body.