A production-grade Go package for the ClearBank UK API.
GBP Accounts GBP Payments (FPS, CHAPS, Bacs, CoP, Cheques) Multi-currency & FX Embedded Banking Webhooks
go get github.com/iamkanishka/clearbank-goclient, err := clearbank.New(clearbank.Config{
APIToken: os.Getenv("CLEARBANK_API_TOKEN"),
PrivateKeyPath: os.Getenv("CLEARBANK_PRIVATE_KEY_PATH"),
Environment: clearbank.Simulation,
})Create a client once and reuse it throughout your application.
ClearBank requires:
- API Token
- RSA private key
The SDK automatically signs mutating requests when a private key is configured.
- List Accounts
- Get Account
- Create Virtual Account
- Faster Payments (FPS)
- CHAPS Payments
- Confirmation of Payee
- Currency Accounts
- International Payments
- FX Quotes
- Customers
- Accounts
- Signature Verification
- Typed Event Handling
All API errors are returned as *clearbank.APIError.
Use clearbank.WithRequestID(...) when retrying mutating requests.
Register a telemetry hook to observe all API calls.
- Never commit your
private_key.pem— add it to.gitignore - In production, load private keys from an HSM, not the filesystem
- Rotate API tokens before their 1-year expiry
- Verify all inbound webhook signatures before processing
- Store
X-Correlation-Idfrom error responses — required for ClearBank support
MIT — see LICENSE.