8

My company uses QuickBooks Online, and I would like to write some c# scripts that retrieve very basic information like a list of customers and list of invoices from the QuickBooks Online subscription.

I would also like to submit invoices and payments.

I have created a QuickBooks IPP account (at developer.intuit.com).

I am able to authenticate myself (OAuth) just fine. My questions are:

1) Do I need to authenticate myself every time I wish to connect to QBO IPP (to retrieve a list of customers, submit an invoice, etc.)? Or can my app authenticate itself once & stay 'connected' for months?

2) Is there any sample code to do basic things such as obtain a list of customers, submit an invoice, etc.? I downloaded the sample MVC app from this link

And it was quite helpful - but when I try to get some of the code to work, I just get errors - which leads me to my first question - can I authenticate myself ONCE and use those tokens (appToken, and appTokenSecret) many times in order to perform simple tasks (obtain customer list), or do I have to authenticate myself every time?

Thank you.

Piyush Parashar
  • 866
  • 8
  • 20
briscoea
  • 128
  • 1
  • 6

1 Answers1

12

Re - 1) Do I need to authenticate myself every time I wish to connect to QBO IPP (to retrieve a list of customers, submit an invoice, etc.)? Or can my app authenticate itself once & stay 'connected' for months?

Please find below steps to get OAuth tokens using which you can make API call against your QBO account. If you create an app in appcenter, you'll get consumerKey and consumerSecret. https://developer.intuit.com/Application/Create/IA

Using the above two tokens, you can generate accessToken and accessSecret from the OAuthPlayground. https://appcenter.intuit.com/Playground/OAuth/IA PN - After completing C2QB(OAuth) flow, you should use 'App Menu API Test.' option which will show you accessToken and accessSecret.

These tokens are valid for 180 days (at max). When these tokens are more than 150 days old (and <180 days), you can make Reconnect API call to revalidate those again. Ref https://developer.intuit.com/docs/0050_quickbooks_api/0020_authentication_and_authorization/oauth_management_api#Reconnect

So you can always persist these tokens and reuse it.

To let end users connect their QB data with you SaaS app, you need to implement a wizard called 'Connect to Quickbook'. Using 3-legged Oauth your app will be able to capture the acessToken and acessSecret corresponding to the end-user's qbo account. Ref - https://developer.intuit.com/docs/0100_accounting/0060_authentication_and_authorization/connect_from_within_your_app#7._Add_the_Connect_to_QuickBooks_button

Re - 2) Is there any sample code to do basic things such as obtain a list of customers, submit an invoice, etc.?

Please refer - https://developer.intuit.com/docs/0100_accounting/0500_developer_kits/0150_ipp_.net_devkit_3.0/0002_synchronous_calls#/Data_Services_API

and how to add invoice or sales receipt quickbooks rest api v3.0

halfer
  • 19,824
  • 17
  • 99
  • 186
Manas Mukherjee
  • 5,270
  • 3
  • 18
  • 30
  • Thank you so much! I will give all of these links/suggestions a try. Thankfully, these links work - I was getting frustrated with all of the 404 errors I was coming across on Intuit's developer site (I noticed the qb_api links were 0025_quickbooks_api, which must have been older links hmph). – briscoea Nov 24 '14 at 15:17
  • You're welcome. And yes, UI and devsite is quite revamped. Please navigate from the root level links. (docs.developer.intuit.com). Thanks – Manas Mukherjee Nov 24 '14 at 21:36
  • 1
    I'm almost there. When I try to obtain a customer list, I just get a Bad Request error: "Fault Exception of type: VALIDATION has been generated." I am using this line of code: List customers = service.FindAll(customer, startPosition, maxResult).ToList(); – briscoea Nov 25 '14 at 17:27
  • 4
    SOLVED. To all who come across this thread, if you are using a sandbox company, you need to change your web.config to specify the sandbox BaseURL: – briscoea Nov 25 '14 at 17:46
  • Thanks for confirming, Briscoea. Good to know that things are in place. If possible, please mark this post as ans. Thanks – Manas Mukherjee Nov 25 '14 at 20:05
  • 1
    @briscoea Really?? Thank you for this and I'm so glad I could search for "Fault Exception of type: VALIDATION" and find your comment! – lc. Dec 26 '14 at 04:15
  • while in development , you will need to set BaseURL , context.IppConfiguration.BaseUrl.Qbo = "https://sandbox-quickbooks.api.intuit.com/"; found this @ https://developer.intuit.com/docs/0100_accounting/0500_developer_kits/0150_ipp_.net_devkit_3.0/0002_configuration – Vishal Sharma Sep 27 '15 at 20:18
  • Hello @Manas Mukherjee! I would like to have few suggestions on `QuickBooks OAuth 2.0` authentication. If you are available, please try to knock. – AT-2017 Jun 03 '19 at 08:56