pns/laravel-qbo

This is a Laravel package for integrating QuickBooks Online API.

v1.2.1 2022-04-04 16:32 UTC

This package is auto-updated.

Last update: 2024-04-04 20:41:06 UTC


README

This is a Laravel package for integrating QuickBooks Online API.

Getting Started

Below are the steps in order to integrate QuickBooks Online API to your Laravel project.

Installation

Install the package using composer:

  composer require pns/laravel-qbo

Export the configuration file:

  php artisan vendor:publish --provider="Pns\LaravelQbo\Providers\LaravelQboServiceProvider" --tag="config"

Export the migration files:

  php artisan vendor:publish --provider="Pns\LaravelQbo\Providers\LaravelQboServiceProvider" --tag="migrations"

Do a quick migration:

  php artisan migrate

Environment Variables

In order to run this package, you will need to add the following environment variables to your .env file

QBO_AUTH_MODE=oauth2

QBO_ATH_REQUEST_URL=https://appcenter.intuit.com/connect/oauth2

QBO_TOKEN_END_POINT_URL=https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer

QBO_CLIENT_ID=

QBO_CLIENT_SECRET=

QBO_REDIRECT_URI=

QBO_SCOPE=com.intuit.quickbooks.accounting

QBO_BASE_URL=Development

QBO_COMPANY_ID=

You may follow the steps on how to get the environment variables here: https://developer.intuit.com/app/developer/homepage

or follow the steps below

Generating Environment Variables

  1. Log in to your QuickBooks Online account at https://accounts.intuit.com

  2. After logging in, go to https://developer.intuit.com/app/developer/sandbox in order to create a new sandbox company.

68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f696e7374616c6c6174696f6e2f737465702d312e4a50473f73616e6974697a653d74727565

  1. Add a sandbox company.

68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f696e7374616c6c6174696f6e2f737465702d322e4a50473f73616e6974697a653d74727565

  1. After creating a sandbox company, copy the Company ID to be used in QBO_COMPANY_ID environment variable.

68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f696e7374616c6c6174696f6e2f737465702d332e4a50473f73616e6974697a653d74727565

  1. Then, go to https://developer.intuit.com/app/developer/dashboard.

68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f696e7374616c6c6174696f6e2f737465702d342e4a50473f73616e6974697a653d74727565

  1. Create an app.

68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f696e7374616c6c6174696f6e2f737465702d352e4a50473f73616e6974697a653d74727565

  1. Complete the form in order to create a new app.

68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f696e7374616c6c6174696f6e2f737465702d362e4a50473f73616e6974697a653d74727565

  1. Upon creation, you will be redirected to the Getting Started page for your app.

68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f696e7374616c6c6174696f6e2f737465702d372e4a50473f73616e6974697a653d74727565

  1. Go to Keys and credentials. Copy the Client ID and Client Secret to QBO_CLIENT_ID and QBO_CLIENT_SECRET respectively.

68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f696e7374616c6c6174696f6e2f737465702d382e4a50473f73616e6974697a653d74727565

  1. Scroll down to create or copy the Redirect URI to QBO_REDIRECT_URI.

68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f696e7374616c6c6174696f6e2f737465702d392e4a50473f73616e6974697a653d74727565

How To Use

Download Postman API

Download the Postman API Collection here.

Authentication

Use this in order to authenticate and refresh the access token.

Controller

  \Pns\LaravelQbo\Http\Controllers\QboAuthController

Authenticate Token

Postman URL:

  {{url}}/qbo/authorize

Response:

  {
    "authorizationCodeUrl": "https://appcenter.intuit.com/connect/oauth2?client_id=ABEP4t682b0kTjxo8G6yuJGftr506G6oZ5DsOMP0b2MbSHdWP2&scope=com.intuit.quickbooks.accounting&redirect_uri=https%3A%2F%2Fdeveloper.intuit.com%2Fv2%2FOAuth2Playground%2FRedirectUrl&response_type=code&state=DATTK"
  }

Refresh Token

Postman URL:

  {{url}}/qbo/token-save

Request:

  {
    "code": "AB11645453718yt4XS3Ngih24yMxDSQYXYG4Hpy2oR6lNkC87L",
    "realmId": "4620816365213659530" 
  }

Response:

  {
    "message": "Token refreshed.",
    "accessToken": {
      "access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..GpEotUwWZJnVEbrOGYSLcg.AdIOfTVbSs73d8-b0wgmFnbgIPbrUKWoIW6_9FJQ27lKWO5xXy5VykvAyUEd_PUpBLhpXfhnnXMkvO_75YecvducgHCHlFy9NdBGfy1WCpkZ8OZQTKIdC1Up4FrsPurK7eAqY8y1-eJNcgARK4TyLtwy14dWeIvZXe3v3uHFtsSz5BsiGj8mC1o9MoKdvFep6BgOtBeZu_nacr7qcPlTXAztWNLLExhZtzSlJqMMMcjErHJ0SOpCZfauba_KrzCT5m0GBmyHvT-maV4EbseiK_hjhdegh0T1kkznxZK92j3tPfqCeAGL3IxJQT2iJlpgyGmTTotX2Mnoz6OPPykxN-8SRh8itzOdqPquQ-P4eqXI-XtnIiHzWBhyi-jvTAfGWuTYx5ohKOQKGvOiyDV4xbqkYw-XNbwsGLtF9EUY-Z8HWk6waj5g07O_-WxOY8lOlhJ4u7lkMaCLm6KMSHLNhfwRykp81wlxac80IQF8_InBseH1jVfShP89WMgYdGzuoy-8hY9jXwBgDudVm5uoqhQiIMaLbZQ1_V1XuHs9-1pBsLtq4KjoabTCJ3lma_cv-wff0plsXDaQFih-StmyWWvBZYRzRPvWbloTsGDEt8WxIANUd2AWZhZFwfJIxkgTpfLnDEySg2QyV-LoNjFU_FAYulFGn1-V6b7JBBYTEJkZXssVGRcy62zGzw_K0Y5DlJUnesbShcAA9rwrA7L430DPi_yYLm472-OKWjhM9OaeR2f6QcrsUxuhj96XcwQd.CynAG529fBQbeDV7OY7WRw",
      "refresh_token": "AB116541797850qjxumAQNzUirNxrOs9C8Sj0U1o59iT0Ev2o2",
      "x_refresh_token_expires_in": "2022/06/02 14:23:05",
      "expires_in": "2022/02/21 15:23:05"
    }
  }

Company

Use this in order to get and update your company profile.

Controller

  \Pns\LaravelQbo\Http\Controllers\QboCompanyController

Get Company Profile

Postman URL:

  {{url}}/qbo/company

Response:

  {
    "authorizationCodeUrl": "https://appcenter.intuit.com/connect/oauth2?client_id=ABEP4t682b0kTjxo8G6yuJGftr506G6oZ5DsOMP0b2MbSHdWP2&scope=com.intuit.quickbooks.accounting&redirect_uri=https%3A%2F%2Fdeveloper.intuit.com%2Fv2%2FOAuth2Playground%2FRedirectUrl&response_type=code&state=DATTK"
  }

Features

  • Authentication
  • Company Profile
    • View
  • Invoice
    • Create
    • View
    • Delete
    • List
    • Send To Email
  • Customer
    • Create
    • View
    • Delete
    • List

Support

For support, email jeddsaliba@gmail.com or join our Slack channel.

Fly high, butterfly! 68747470733a2f2f7261772e6769746875622e636f6d2f6a65646473616c6962612f6c61726176656c2d71626f2f6d61737465722f7372632f6173736574732f69636f6e732f627574746572666c792e7376673f73616e6974697a653d74727565