Giter Site home page Giter Site logo

quickbooks-go's Introduction

quickbooks-go

Build GoDoc Go Report Card

quickbooks-go is a Go library that provides access to Intuit's QuickBooks Online API.

NOTE: This library is very incomplete. I just implemented the minimum for my use case. Pull requests welcome :)

Example

Authorization flow

See auth_flow_test.go

clientId     := "<your-client-id>"
clientSecret := "<your-client-secret>"
realmId      := "<realm-id>"

qbClient, _ := quickbooks.NewQuickbooksClient(clientId, clientSecret, realmId, false, nil)

// To do first when you receive the authorization code from quickbooks callback
authorizationCode := "<received-from-callback>"
redirectURI := "https://developer.intuit.com/v2/OAuth2Playground/RedirectUrl"
bearerToken, _ := qbClient.RetrieveBearerToken(authorizationCode, redirectURI)
// Save the bearer token inside a db

// When the token expire, you can use the following function
bearerToken, _ = qbClient.RefreshToken(bearerToken.RefreshToken)

// Make a request!
info, _ := qbClient.FetchCompanyInfo()
fmt.Println(info)

// Revoke the token, this should be done only if a user unsubscribe from your app
qbClient.RevokeToken(bearerToken.RefreshToken)

Re-using tokens

See reuse_token_test.go

clientId     := "<your-client-id>"
clientSecret := "<your-client-secret>"
realmId      := "<realm-id>"

token := quickbooks.BearerToken{
RefreshToken:           "<saved-refresh-token>",
AccessToken:            "<saved-access-token>",
}

qbClient, _ := quickbooks.NewQuickbooksClient(clientId, clientSecret, realmId, false, &token)

// Make a request!
info, _ := qbClient.FetchCompanyInfo()
fmt.Println(info)

License

BSD-2-Clause

quickbooks-go's People

Contributors

nsotgui avatar rwestlund avatar vderic avatar lukecyca avatar wardviaene avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.