Skip to content

shal/mono

Repository files navigation

MonoBank SDK

Circle CI Docs Go Report Version

🏦 Golang client for Mono API.

Monobank API

You can find documentation for all types of API here.

  1. Introduction
  2. Documentation
  3. Using library
  4. Example
  5. Contributions

Introduction

Read access APIs for monobank app.

Please, use personal API only in non-commersial services.

If you have a service or application and you want to centrally join the API for customer service, you need to connect to a corporate API that has more features.

This will allow monobank clients to log in to your service (for example, in a financial manager) to provide information about the status of an account or statements.

Documentation

As far as monobank have 3 types of API, we prepated three usage documentations:

Use

This package has no dependencies, install it with command below

go get github.com/shal/mono

You can take a look and inspire by following examples

Example

package main

import (
    "fmt"
    "os"
    "time"

    "github.com/shal/mono"
)

func main() {
    personal := mono.NewPersonal("token")

    user, err := personal.User(context.Background())
    if err != nil {
        fmt.Println(err.Error())
        os.Exit(1)
    }

    from := time.Now().Add(-730 * time.Hour)
    to := time.Now()

    var account mono.Account

    for _, acc := range user.Accounts {
        ccy, _ := mono.CurrencyFromISO4217(acc.CurrencyCode)
        if ccy.Code == "UAH" {
            account = acc
        }
    }

    transactions, err := personal.Transactions(context.Background(), account.ID, from, to)
    if err != nil {
        fmt.Println(err.Error())
        os.Exit(1)
    }

    fmt.Printf("Account: %s\n", account.ID)

    fmt.Println("Transactions:")
    for _, transaction := range transactions {
        fmt.Printf("%d\t%s\n", transaction.Amount, transaction.Description)
    }
}

More about this example here.

Example

License

Project released under the terms of the MIT license.