The QuickBooks Online PHP SDK allows you to configure app settings such as minor version, number of retries, and logging. As installed, the SDK is configured with default values as listed the Default values section below. Override default settings as follows:
IppConfiguration
property take precedence over both their default values and their configuration file (if present) values at run time.Features you can configure:
The following table lists the default values configured in the PHP SDK:
FEATURE | CONFIGURATION FILE TAG | DEFAULT VALUE |
Base URL | <baseUrl qbo="url"/> |
https://quickbooks.api.intui
t.com/ |
Minor version | <minorVersion qbo=n/> |
Check release notes. |
Logging | <logger> |
Request and response. |
Serialization and| compression
|
<message> |
Request | Response
Xml | Xml
None | None
|
Retries | <retry> |
Retry policy not set. |
Authorization | <appSettings> | <add key ...> |
No defaults. |
The SDK allows you to define custom, local app settings in the sdk.config
file. Then, when your app makes QuickBooks OnlineAPI calls to access QuickBooks Online data, the SDK by default checks for configuration settings in the configuration file before using its defaults.
To configure app settings at the configuration file level, override the default for a feature by editing the appropriate section of the configuration file as described on this page. To see the configuration file with the sections you can edit, click here.
To configure app settings at the code level, first build the service context and then override the feature setting as described on this page.
A base URL defines the work environment accessed for REST API services. Supported work environments include:
WORK ENVIRONMENT | OAUTH AUTHORIZATION KEYS | QUICKBOOKS COMPANY | BASE URL |
Development | App’s development keys | Your sandbox data. For more information, see Sandboxes. | https://sandbox-quickbooks.api.intuit.com/ |
Production | App’s production keys | Your user’s company data | https://quickbooks.api.intuit.com/ |
The default configuration accesses the QuickBooks Online production environment for REST API services.
To test your code in the development environment using your QuickBooks Online sandbox, set the Base URL to development. You can either enter the specific URL or use the Development
keyword to specify the Base URL. For more information about sandboxes, click here.
To set the environment back to production, enter either the production URL or the Production
keyword. To set the Base URL, either enter the value in the <service>
section of the configuration file or set the value in the code. Both of these alternatives are shown below.
Configure the <service>
section in the configuration file to override the default production work environment:
1 2 3 4 5 6 7 8 9 | <intuit> <ipp> ... <service> <baseUrl qbo="https://qbonline-e2e.api.intuit.com/" ipp="https://appcenter.intuit.com/api/" /> </service> ... </ipp> </intuit> |
Use the steps in this section to override the default value or, if set, the value defined in the configuration file. Then, override the base URL setting as follows:
1 2 3 | <?php $context->IppConfiguration->BaseUrl->Qbo = "https://sandbox-quickbooks.api.intuit.com/"; ?> |
QuickBooks Online data services support minor versions in order to provide a way for you to access incremental changes without breaking existing apps. Check release notes for the current default value. Click here for more details about minor versions.
Override the default QuickBooks Online API minor version setting by replacing the value defined in the <minorVersion>
section with the desired value.
1 2 3 4 5 | <intuit> <ipp> <minorVersion>3</minorVersion> </ipp> </intuit> |
Use the steps in this section to override the default value or, if set, the value defined in the configuration file. Then, override the request and response formats, as follows:
1 2 3 | <?php $serviceContext->setMinorVersion = "5"; ?> |
Logging diagnostic information plays a key part for any application. The QuickBooks Online PHP SDK supports execution logging and request and response logging. You can configure request and response logging by enabling or disabling the feature and by setting the log location. For detailed information the logs and configuration, see Logging.
The PHP SDK supports XML serialization for QuickBooks Online API request and response payloads. It also supports compression of request and response data to Gzip and Deflate formats. You must use the same serialization format for both request and response payloads.
Include the following code to set the serialization and compression formats of requests and responses:
1 2 3 4 5 6 7 8 | <intuit> <ipp> <message> <Request serializationFormat="Xml" compression="GZip/Deflate" /> <Response serializationFormat="Xml" compression="GZip/Deflate" /> <message> </ipp> </intuit> |
Use the steps in this section to override the default value or, if set, the value defined in the configuration file. Then, override the request and response formats, as follows.
1 2 3 4 | <?php $context->IppConfiguration->Message->Request->SerializationFormat = $SerializationFormat->Xml; $context->IppConfiguration->Message->Response->SerializationFormat = $SerializationFormat->Xml; ?> |
The PHP SDK supports only XML serialization.
Include the following code to compress request and response code, respectively, data using Gzip format:
1 2 3 4 <?php $context->IppConfiguration->Message->Request->CompressionFormat = $CompressionFormat->GZip; $context->IppConfiguration->Message->Response->CompressionFormat = $CompressionFormat->GZip; ?>
Similarly, you can set data compression of requests to Deflate
or none
. When compression is set to none
, the SDK leaves the data uncompressed.
Configure the content writer to save responses to a temporary file. General configuration is as follows; define the prefix used in the file name with the prefix
parameter.
1 2 3 4 5 | <intuit> <ipp> <contentWriter strategy="file" prefix="<prefixString>"/> </ipp> </intuit> |
Note
Note
Advanced users may also specify returnObject="true"
, which can provide more advanced control and properties of the contentWriter
object.
Configure this content writer strategy to save the response into a temporary file and additionally provide a file handle. The file is automatically removed after script termination or when the app closes the handle.
1 2 3 4 5 | <intuit> <ipp> <contentWriter strategy="handler" prefix="<prefixString>"/> </ipp> </intuit> |
Configure this content writer strategy to save the response into a export folder. Define the target export folder with the exportDirectory
parameter.
1 2 3 4 5 | <intuit> <ipp> <contentWriter strategy="export" exportDirectory="<pathToTargetFolder>" prefix="<prefixString>"/> </ipp> </intuit> |
For an app to access a QuickBooks company, you must use OAuth to authorize the app. In this type of authorization, an OAuth token is used to authorize and connect an app to the company. For more information, see Authorization.