kintsugi-tax/tax-platform-sdk

v0.1.5 2025-07-11 22:30 UTC

README

Developer-friendly & type-safe Php SDK specifically catered to leverage kintsugi-tax/tax-platform-sdk API.



Important

This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your workspace. Delete this section before > publishing to a package manager.

Summary

Table of Contents

SDK Installation

The SDK relies on Composer to manage its dependencies.

To install the SDK and add it as a dependency to an existing composer.json file:

composer require "kintsugi-tax/tax-platform-sdk"

SDK Example Usage

Example

declare(strict_types=1);

require 'vendor/autoload.php';

use KintsugiTax\SDK;
use KintsugiTax\SDK\Models\Components;
use KintsugiTax\SDK\Models\Operations;

$sdk = SDK\SDK::builder()->build();

$request = new Components\AddressBase(
    phone: '555-123-4567',
    street1: '1600 Amphitheatre Parkway',
    street2: 'Building 40',
    city: 'Mountain View',
    county: 'Santa Clara',
    state: 'CA',
    postalCode: '94043',
    country: Components\CountryCodeEnum::Us,
    fullAddress: '1600 Amphitheatre Parkway, Mountain View, CA 94043',
);
$requestSecurity = new Operations\SearchV1AddressValidationSearchPostSecurity(
    apiKeyHeader: '<YOUR_API_KEY_HERE>',
);

$response = $sdk->addressValidation->search(
    request: $request,
    security: $requestSecurity
);

if ($response->response200SearchV1AddressValidationSearchPost !== null) {
    // handle response
}

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme
apiKeyHeader apiKey API key

To authenticate with the API the apiKeyHeader parameter must be set when initializing the SDK. For example:

Per-Operation Security Schemes

Some operations in this SDK require the security scheme to be specified at the request level. For example:

declare(strict_types=1);

require 'vendor/autoload.php';

use KintsugiTax\SDK;
use KintsugiTax\SDK\Models\Components;
use KintsugiTax\SDK\Models\Operations;

$sdk = SDK\SDK::builder()->build();

$request = new Components\AddressBase(
    phone: '555-123-4567',
    street1: '1600 Amphitheatre Parkway',
    street2: 'Building 40',
    city: 'Mountain View',
    county: 'Santa Clara',
    state: 'CA',
    postalCode: '94043',
    country: Components\CountryCodeEnum::Us,
    fullAddress: '1600 Amphitheatre Parkway, Mountain View, CA 94043',
);
$requestSecurity = new Operations\SearchV1AddressValidationSearchPostSecurity(
    apiKeyHeader: '<YOUR_API_KEY_HERE>',
);

$response = $sdk->addressValidation->search(
    request: $request,
    security: $requestSecurity
);

if ($response->response200SearchV1AddressValidationSearchPost !== null) {
    // handle response
}

Available Resources and Operations

Available methods

addressValidation

customers

exemptions

nexus

  • list - Get Nexus For Org

products

taxEstimation

transactions

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.

By default an API error will raise a Errors\APIException exception, which has the following properties:

Property Type Description
$message string The error message
$statusCode int The HTTP status code
$rawResponse ?\Psr\Http\Message\ResponseInterface The raw HTTP response
$body string The response content

When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the search method throws the following exceptions:

Error Type Status Code Content Type
Errors\ErrorResponse 401 application/json
Errors\BackendSrcAddressValidationResponsesValidationErrorResponse 422 application/json
Errors\ErrorResponse 500 application/json
Errors\APIException 4XX, 5XX */*

Example

declare(strict_types=1);

require 'vendor/autoload.php';

use KintsugiTax\SDK;
use KintsugiTax\SDK\Models\Components;
use KintsugiTax\SDK\Models\Errors;
use KintsugiTax\SDK\Models\Operations;

$sdk = SDK\SDK::builder()->build();

try {
    $request = new Components\AddressBase(
        phone: '555-123-4567',
        street1: '1600 Amphitheatre Parkway',
        street2: 'Building 40',
        city: 'Mountain View',
        county: 'Santa Clara',
        state: 'CA',
        postalCode: '94043',
        country: Components\CountryCodeEnum::Us,
        fullAddress: '1600 Amphitheatre Parkway, Mountain View, CA 94043',
    );
    $requestSecurity = new Operations\SearchV1AddressValidationSearchPostSecurity(
        apiKeyHeader: '<YOUR_API_KEY_HERE>',
    );

    $response = $sdk->addressValidation->search(
        request: $request,
        security: $requestSecurity
    );

    if ($response->response200SearchV1AddressValidationSearchPost !== null) {
        // handle response
    }
} catch (Errors\ErrorResponseThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\BackendSrcAddressValidationResponsesValidationErrorResponseThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\ErrorResponseThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\APIException $e) {
    // handle default exception
    throw $e;
}

Development

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.

SDK Created by Speakeasy