Both the QuickBooks Online Accounting API and the QuickBooks Online Payments API use JSON to send and receive information.
Check out the API Explorers to see all available entities, resources, and related operations:
There are different baseURLs for each of our API frameworks. There are also unique baseURL’s connecting to sandbox companies (i.e. testing environments) and live, customer-facing QuickBooks Online companies.
Use these samples and the relevant baseURL when setting up your SDK:
.Net SDK
1 | ServiceContext context = new ServiceContext(appToken, realmId, IntuitServicesType.QBO, oauthValidator); context.IppConfiguration.BaseUrl.Qbo = “https://sandbox-quickbooks.api.intuit.com/""; |
Java SDK
1 | Config.setProperty(Config.BASE_URL_QBO, “https://sandbox-quickbooks.api.intuit.com/v3/company""); |
PHP SDK
Edit the sdk.config file to use the new baseURL: https://sandbox-quickbooks.api.intuit.com/
Each API entity has a unique endpoint.
Send requests to the specific API entities and related operations you need. The baseURL is the same for all endpoints, but the entity and resource type varies.
Always set the request’s content type to application/json.
Basic format: <OPERATION> <baseURL>/v3/company/<id>/<entity>?<minorversion>
Basic format: <OPERATION> <base URL>/quickbooks/v4/customers/<id>/<entity>
Create an invoice
1 2 3 | POST https://quickbooks.api.intuit.com/v3/company/4620816365014867780/invoice?minorversion=63 Content type:application/json |
Create a card
1 2 3 | POST https://api.intuit.com/quickbooks/v4/customers/<id>/cards Content type:application/json |
Create a charge for a sandbox company
1 2 3 | POST https://sandbox.api.intuit.com/quickbooks/v4/payments/quickbooks/v4/payments/charges Content type:application/json |
Calling our APIs involves request and response JSON pairs.
Here’s a typical JSON request for our API. This example is a CREATE operation for the charge entity with card details in the payload.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | { "amount": "10.55", "card": { "expYear": "2020", "expMonth": "02", "address": { "region": "CA", "postalCode": "94086", "streetAddress": "1130 Kifer Rd", "country": "US", "city": "Sunnyvale" }, "name": "emulate=0", "cvc": "123", "number": "4111111111111111" }, "currency": "USD", "context": { "mobile": "false", "isEcommerce": "true" } } |
Each API entity has unique field:value pairs and operations. Some are required and some are optional. Always review the reference in the API Explorer to see what’s required.
The fields in this example tell us a lot about the transaction. We can see the amount of the charge in the amount
field. We can also see the credit card number in the number
field. There are additional attributes under the card
object, such as the expYear
and the associated address
.
The isEcommerce
field is unique to our API—it identifies this as a digital transaction.
Here’s a typical response from our server. Again, it’s in JSON. This example is a response to our previous CREATE example for the charge entity:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | { "created": "2018-01-31T18:48:25Z", "status": "CAPTURED", "amount": "10.55", "currency": "USD", "card": { "number": "xxxxxxxxxxxx1111", "name": "emulate=0", "address": { "city": "Sunnyvale", "region": "CA", "country": "US", "streetAddress": "1130 Kifer Rd", "postalCode": "94086" }, "cardType": "Visa", "expMonth": "02", "expYear": "2020", "cvc": "xxx" }, "avsStreet": "Pass", "avsZip": "Pass", "cardSecurityCodeMatch": "NotAvailable", "id": "EAQX3720TN5J", "context": { "mobile": false, "deviceInfo": {}, "recurring": false, "isEcommerce": true }, "authCode": "139111" } |