quickbooks

The quickbooks package gives you all the tools you need to get the date from QuickbooksPlatform in dart.

Installation

In the dependencies: section of your pubspec.yaml, add the following line:

dependencies:
  quickbooks: <latest_version>

To import it in your dart file, add the following line:

import 'package:quickbooks/quickbooks.dart';

Getting started

To use the different features of this project, you will need:

  1. A Quickbooks developper account: https://developer.intuit.com/app/developer/qbdesktop/docs/get-started/create-an-intuit-developer-account
  2. A quickbooks app: https://developer.intuit.com/app/developer/qbo/docs/get-started/start-developing-your-app

Your Quickbooks app will give you a client_id and a client_secret keys: https://developer.intuit.com/app/developer/qbo/docs/get-started/get-client-id-and-client-secret

You can set these values in the environment variables as QUICKBOOKS_CLIENT_ID and QUICKBOOKS_CLIENT_SECRET or set it directly on the Oauth2 authentification service.

Environment

This package is set to use automatically the environment variables of your system if you didn't specify values to services that uses them.

The environment variables used by this package are:

  • QUICKBOOKS_CLIENT_ID: The id of the app you use.
  • QUICKBOOKS_CLIENT_SECRET: The secret key of the app you use.
  • QUICKBOOKS_REDIRECT_URI: The uri Oauth2 will redirect after connection to send informations.
  • QUICKBOOKS_STATE: The confirmation string used by Oauth2 to confirm a connection is valid.
  • QUICKBOOKS_IS_PRODUCTION: Boolean that specifies if the app is in production or in sandbox mode. Will be automatically set to production if no value is given.

Features

Oauth2 connection

You can use this package to connect to a Quickbooks account via Oauth2 authentification standard.

To perform an authentification, you must:

  1. Generate an authentification url for your quickbooks app. Example:
var service = QuickbooksOauth2Service(
    clientId: QuickbooksEnvironment.clientId,
    clientSecret: QuickbooksEnvironment.clientSecret,
    redirectUrl: QuickbooksEnvironment.redirectUri,
    isProduction: QuickbooksEnvironment.isProduction,
);

String authUrl = await service.getAuthUrl();
  1. Get the authentification code and realm id by receiving it at the redirection url (set in the QUICKBOOKS_REDIRECT_URI environment variable or directly on the service). You must run you own api to do so.
  2. Get the tokens from the authentification code and realm id. Example:
QuickbooksOauth2Tokens tokens =
      await service.getTokens(authorizationCode: code, realmId: realmId);

You now have the tokens you need to query the Quickbooks api.

Data management

This package can manage these types of Quickbooks data:

  • Products
  • Categories
  • Your own company
  • Customers
  • Invoices
  • Payments

Each of these data types have their own service that can get, create, update and delete data. Example:

var service = QuickbooksPaymentService();

var value = await service.getAll(
    accessToken: tokens.accessToken,
    companyId: tokens.companyId!,
    conditions: '<your conditions in MySql>',
);

If you need to get a data that is not covered by the prebuilt services, you can use the QuickbooksQueryService to build your own custom service easily. Example:

var service = QuickbooksQueryService(
    postEndpoint: '<post endpoint of your date>',
    baseQuery: '<base query to get your data in MySql>',
    baseConditions: '<base conditions to get your data in Mysql>', // Is null by default
    isProduction: true //Will be set with the environment variable by default
);

By example, to set a QuickbooksQueryService to get Payments, you need this code:

var service = QuickbooksQueryService(
    postEndpoint: '<post endpoint of your date>',
    baseQuery: '<base query to get your data in MySql>',
    baseConditions: '<base conditions to get your data in Mysql>', // Is null by default
    isProduction: true //Will be set with the environment variable by default
);

Libraries

account_based_expense_line
account_based_expense_line_details
base.services.export
claims.enum
configuration.service
description_line_details.entity
description_only_line.entity
detail_type.enum
discount_line.entity
discount_line_details.entity
entity.export
enums
enums.export
environment.export
global_tax_calculation_type.enum
group_line.entity
group_line_defails.entity
invoice.enum.export
item_based_expense_line
item_based_expense_line_details
line.entity
line.entity.export
markup_info.entity
oauth2.entity.export
oauth2.enum.export
oauth2_configuration.entity
oauth2_connection.service
oauth2_tokens.entity
payment.entity.export
quickbooks
quickbooks_account.entity
quickbooks_accounts.service
quickbooks_attachable.entity
quickbooks_category.entity
quickbooks_caterogies.service
quickbooks_company.service
quickbooks_company_infos.entity
quickbooks_credit_card_payment.entity
quickbooks_credit_charge_info.entity
quickbooks_credit_charge_response.entity
quickbooks_customer
quickbooks_customers.service
quickbooks_delivery_info.entity
quickbooks_email_address
quickbooks_environment
quickbooks_invoice.entity
quickbooks_invoices.service
quickbooks_linked_txn.entity
quickbooks_memo_ref.entity
quickbooks_name_value.entity
quickbooks_payment.entity
quickbooks_payment_line.entity
quickbooks_payment_line_ex.entity
quickbooks_payment_line_ex_list.entity
quickbooks_payments.service
quickbooks_phone_number.entity
quickbooks_physical_address.entity
quickbooks_product.entity
quickbooks_products.service
quickbooks_purchase.entity
quickbooks_purchases.service
quickbooks_query.service
quickbooks_txn_tax_detail
quickbooks_web_address.entity
response_types.enum
sales_item_line.entity
sales_item_line_detail.entity
scopes.enum
services.export
signing_alg.enum
sub_total_line.entity
sub_total_line_details.entity
subject_types.enum
tax_line.entity
tax_line_details.entity
token_endpoint_auth_methods.enum