Skip to content
A Go library for interacting with the Monzo Bank API.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Monzo.me! Jun 15, 2019
LICENSE
README.md Add more to Readme Jun 15, 2019
account.go add ability to create and list webhooks (#8) (#9) Jun 15, 2019
balance.go dev Jun 15, 2019
currency.go add USD currency Jun 15, 2019
deposit.go initial Jun 4, 2019
feeditem.go Add ability to create feed items (#3) Jun 15, 2019
go.mod initial Jun 4, 2019
merchant.go dev Jun 15, 2019
monzo.go Add ability to create and save receipts (#6) Jun 15, 2019
pot.go dev Jun 15, 2019
receipt.go Add ability to create and save receipts (#6) Jun 15, 2019
transaction.go Add ability to create and save receipts (#6) Jun 15, 2019
webhook.go add ability to create and list webhooks (#8) (#9) Jun 15, 2019
withdrawal.go initial Jun 4, 2019

README.md

Monzo Go Client

A Go client for interacting with the Monzo API.

Installation

go get -u github.com/tmus/monzo

Usage

The client API may change at some point, don't rely on this for anything serious, and make sure you use version numbers in your go.mod file.

Creating a Client

Create a monzo.Client and pass it your Monzo access token:

token, _ := os.LookupEnv("MONZO_TOKEN")
c = monzo.NewClient(token)

Creating a new client doesn't verify the connection to Monzo, so you should call the Ping method on the new client to ensure that the client can access Monzo:

if err := c.Ping(); err != nil {
    panic(err)
}

Retrieving Accounts

Call the Accounts function on the client to return a slice of accounts associated with the Monzo token.

accs, _ := c.Accounts()

for _, acc := range accs {
    fmt.Println(acc.ID)
}

Retrieving a Single Account

If you know the account id, you can call the Account function on the client to return a single account.

acc, _ := c.Account("acc_00000XXXXXXXXXXXXXXXXX")
fmt.Println(acc.ID)

Account Balance

The Account struct is fluent: it contains a pointer to the monzo.Client, meaning further API calls can be done directly from the Account, such as retrieving a balance:

acc, _ := c.Account("acc_00000XXXXXXXXXXXXXXXXX")

b, _ := acc.Balance()

The Balance struct contains all the information about an Account's balance:

  • Balance.Balance returns the amount available to spend
  • Balance.Total returns the total balance (including money in Pots)
  • Balance.WithSavings includes the total balance including money in Savings pots.

More details coming soon.

You can’t perform that action at this time.