Error handling
The SDK throws typed errors for every HTTP status code. Catch them to handle specific failure modes:
In Go, every API error shares the type
*rainsdk.Error. Switch on apierr.StatusCode to branch on the HTTP status.
Retries
By default, the SDK retries connection errors, 408, 409, 429, and 5xx responses up to 2 times with exponential backoff.Timeouts
Requests time out after 60 seconds by default. The SDK retries timed-out requests.The Go SDK does not apply a default request timeout. Always pass a
context.Context with a deadline appropriate for your workload — option.WithRequestTimeout only governs each individual attempt.Pagination
List endpoints use cursor-based pagination. Passcursor and limit to page through results:
List returns *[]T — dereference the pointer to iterate. The cursor parameter is param.Opt[string]; import the helper from github.com/SignifyHQ/rain-sdk-go/packages/param and use rainsdk.String(...) to set it.
Logging
Control SDK log output with theRAIN_LOG environment variable or the logLevel client option:
option.WithDebugLog(nil) to log to stderr, or any *log.Logger to direct output elsewhere. There are no log levels.
Idempotency
Pass anIdempotency-Key header to safely retry write operations without duplicate side effects:
What’s next
Card Issuance
Issue your first card end-to-end with the SDK.
Transaction Monitoring
List, filter, and manage transactions.
Funding & Transfers
Fund cards with collateral deposits.