Skip to main content

QuickBooks Online Django integration server

Project description

QuickBooks Django Integration

A Django project that integrates with the QuickBooks Online API via OAuth2.

Features

  • OAuth2 connect/disconnect flow with Intuit
  • Customers — list & create
  • Invoices — list & create
  • Chart of Accounts — list
  • Profit & Loss report
  • Local DB sync (cache QB data locally)
  • DRF REST API endpoints
  • Django Admin for all models
  • Full test suite

Project Structure

quickbooks_integration/
├── config/
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── quickbooks_app/
│   ├── models.py       # QuickBooksToken, Customer, Invoice, Account
│   ├── services.py     # All QB API logic
│   ├── views.py        # OAuth views + DRF API views
│   ├── urls.py
│   ├── admin.py
│   ├── tests.py
│   └── templates/
│       └── quickbooks_app/dashboard.html
├── manage.py
├── requirements.txt
└── .env.example

Setup

1. Create a QuickBooks Developer App

  1. Go to https://developer.intuit.com
  2. Sign in / create an account
  3. Click Dashboard → Create an app → QuickBooks Online and Payments
  4. Under Development → Keys & OAuth, copy your Client ID and Client Secret
  5. Add http://localhost:8000/qb/callback/ to Redirect URIs

2. Local Environment

cd quickbooks_integration
python -m venv venv
source venv/bin/activate          # Windows: venv\Scripts\activate
pip install -r requirements.txt

cp .env.example .env
# Edit .env and fill in QUICKBOOKS_CLIENT_ID and QUICKBOOKS_CLIENT_SECRET

3. Database Setup

python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser

4. Run the Server

python manage.py runserver

Visit http://localhost:8000/qb/ for the dashboard.


Testing

Run the Full Test Suite

python manage.py test quickbooks_app

Run a Specific Test Class

python manage.py test quickbooks_app.tests.APIEndpointsTest
python manage.py test quickbooks_app.tests.SyncServiceTest
python manage.py test quickbooks_app.tests.OAuthViewsTest

Run with Verbosity

python manage.py test quickbooks_app -v 2

API Reference

All endpoints require session authentication (login via /admin/ or Django auth).

GET /qb/api/company/

Returns QuickBooks company info.

GET /qb/api/customers/

Lists all customers from QB.

POST /qb/api/customers/create/

{
  "display_name": "Acme Corporation",
  "email": "billing@acme.com",
  "phone": "+254 700 000000"
}

GET /qb/api/invoices/

Lists all invoices from QB.

POST /qb/api/invoices/create/

{
  "customer_ref_id": "59",
  "due_date": "2024-12-31",
  "line_items": [
    {
      "description": "Web Development Services",
      "amount": 150000,
      "quantity": 1,
      "unit_price": 150000
    }
  ]
}

GET /qb/api/accounts/

Lists chart of accounts.

GET /qb/api/reports/pnl/?start_date=2024-01-01&end_date=2024-12-31

Profit & Loss report.

GET /qb/api/sync/status/

Returns count of locally synced records.


Testing with cURL (after login)

# Get CSRF token first (from browser or admin login)
curl -b cookies.txt http://localhost:8000/qb/api/sync/status/

# Create a customer
curl -X POST http://localhost:8000/qb/api/customers/create/ \
  -H "Content-Type: application/json" \
  -H "X-CSRFToken: YOUR_CSRF_TOKEN" \
  -b cookies.txt \
  -d '{"display_name": "Test Corp", "email": "test@corp.com"}'

Testing with DRF Browsable API

Navigate to any /qb/api/* endpoint in your browser while logged in — Django REST Framework provides a built-in HTML interface for testing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quickbooks_django-0.1.0.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quickbooks_django-0.1.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file quickbooks_django-0.1.0.tar.gz.

File metadata

  • Download URL: quickbooks_django-0.1.0.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for quickbooks_django-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a57a6474e22cba8b924a0e647e0a7e96070b85c0d74e18a2668119b15dc0fbc3
MD5 013be4c971caba3b913834206ae647c9
BLAKE2b-256 091b3be62c22bafb62ff3e894232d60ce2193ad8e6de6eea7b396552e5b6f421

See more details on using hashes here.

File details

Details for the file quickbooks_django-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for quickbooks_django-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f39eba685b77540c0e96781fba9dbe84d7c56af34880c1d42e66f010d0c4563
MD5 cc01ac7c74ffb04a6082ea721635bd22
BLAKE2b-256 b57a3204f752d6ae929fdc99349130a507e7f25042549d14f6b8d2c2df0b0bd4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page