Giter Site home page Giter Site logo

russell-pollari / stripe2qbo Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 1.29 MB

Import your Stripe transactions to Quick Books Online

License: MIT License

Python 62.75% TypeScript 36.66% CSS 0.03% JavaScript 0.11% Mako 0.36% Procfile 0.09%
bookkeeping quickbooks-api stripe

stripe2qbo's Introduction

Stripe to Quick Books Online

Import your Stripe transactions into Quick Books Online.

Connect your accounts, define your sync settings, and import your Stripe transactions into QBO with a single click.

screenshot

I saved myself ~$100 USD/month by replacing some SaaS tools with this custom solution. Sharing it here in case it's useful to anyone else.

Working on generalizing/customizing this so that it is valuable beyond my use cases. Issues, feature requests, and PRs welcome!

Installation

Requires a QBO developer account and an QBO app with a client ID and secret. See here

(Optionally) requires a Stripe account with Connect enabled

$ npm install

$ python3 -m venv venv

$ source venv/bin/activate

$ pip install -r requirements.txt

$ touch .env

Add the following variables to .env with your own values:

SECRET_KEY=<add your own secret key>

# QBO OAuth
QBO_CLIENT_ID=<Your QBO client id>
QBO_CLIENT_SECRET=<Your QBO client secret>
QBO_REDIRECT_URI=http://localhost:8000/qbo/oauth2/callback
QBO_BASE_URL=https://sandbox-quickbooks.api.intuit.com/v3/company
# For production QBO_BASE_URL=https://quickbooks.api.intuit.com/v3/company

STRIPE_API_KEY=<Your Stripe API key>

# Stripe Connect Oauth
STRIPE_CLIENT_ID=<Your Stripe client id, found in Connect settings>
STRIPE_REDIRECT_URL=http://localhost:8000/stripe/oauth2/callback

If you don't want to use Stripe Connect, you can set your Stripe account ID explicitly as an env variable. This will override the Connect flow.

STRIPE_ACCOUNT_ID=<Your Stripe account id, found in Account settings>

Make sure to update your QBO and Stripe Connect settings with the correct redirect URLs.

Initialize the database:

$ alembic upgrade head

By default, a local SQLite database will be created in the root directory. You can use a postgres db instead by setting the POSTGRES_URI env variable.

Development

Ensure pre-commit is installed

$ pip install pre-commit

$ npm run dev

(Both client and server will re-build on changes, but you will have to refresh the browser manually to see ui changes)

To create migrations

$ alembic revision --autogenerate -m "migration name"

Testing

$ pytest

Requires TEST_STRIPE_API_KEY and TEST_STRIPE_ACCOUNT_ID env vars to be set.

When first running tests, you will need to ensure a test_token for QBO is saved. Run pytest with -s flag and follow the prompts to generate and save a token.


Sync Settings

Stripe Clearing Account (Required)

The bank account in QBO that you want Stripe transactions to be synced to. This should track your Stripe Balance. (e.g. 'Stripe Balance')

Stripe Payout Account (Required)

The name of the bank account in QBO that you want Stripe Payouts to be transferred to. Probably your main bank account. (e.g. 'Chequing')

Stripe Vendor (Required)

The name of the vendor in QBO that you want Stripe fees to be sent to. (e.g. 'Stripe)

Stripe Expense Account (Required)

The name of the expense account in QBO that you want Stripe fees to be categorized under. (e.g. 'Stripe Fees')

Default Income Account (Required)

The name of the income account in QBO that you want Stripe sales to be categorized under. (e.g. 'Sales')

Products on QBO will be automatically created for you, using the product name from Stripe. If this product exists on QBO already, it may already be linked to an income account. If you want to change this, you'll need to do it manually.

Tax settings

For now, just two fields are required—a default tax code and an exempt tax code. The default tax code is used for all line items with non-zero tax. The exempt tax code is used for all line items with zero tax.

When syncing invoices, any automatic tax calculations done by QBO will be overwritten to ensure the total tax amount matches the Stripe invoice.

Default Tax Code (required if sales tax is enabled)

The default tax code to use for all invoice line items with non-zero tax. (e.g. TAX, or HST ON)

Exempt Tax Code (required if sales tax is enabled)

The default tax code to use for all invoice line items with zero tax. (e.g. TAX or Exempt)

'TAX' and 'NON' are psuedo tax codes specific to US-based QBO accounts. If you're using a different QBO region (e.g. Canada), you'll need to change these. See here for more info on setting up sales tax.

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.