An interactive Ruby CLI application for tax estimation using the Kintsugi Tax Platform SDK.
- Ruby 3.2 or higher (Currently using Ruby 3.2.2)
- Kintsugi API Key
- Kintsugi Organization ID
- Clone or download this repository
- Install dependencies:
bundle install- Make the script executable:
chmod +x kintsugi_cli.rbRun the CLI application:
ruby kintsugi_cli.rbOr if you made it executable:
./kintsugi_cli.rbWhen you first run the application, you'll be prompted to:
- Enter your Kintsugi API Key - This will be masked for security
- Enter your Organization ID - Your Kintsugi organization identifier
- Enable Debug Logging - Optional for troubleshooting
Interactive wizard to create a tax estimation request:
- Transaction Details: External ID, total amount, currency, date
- Address Information: Shipping address with validation
- Transaction Items: Multiple items with categories and quantities
- Review & Submit: Preview the request before submission
Displays the example request structure from the Kintsugi documentation.
- Update Credentials: Change API key or organization ID
- Toggle Debug Logging: Enable/disable debug output
Safely exit the application.
The CLI creates requests in this format:
{
"addresses": [
{
"city": "Austin",
"country": "US",
"postal_code": "78701",
"state": "TX",
"street_1": "789 Pine St",
"type": "SHIP_TO"
}
],
"currency": "USD",
"date": "2025-08-19T13:01:29.949000000Z",
"external_id": "txn_12345",
"marketplace": false,
"total_amount": 200.0,
"transaction_items": [
{
"external_id": "Product-001",
"amount": 100.0,
"date": "2025-08-19T10:00:00.000000000Z",
"product_category": "PHYSICAL",
"product_subcategory": "PHYSICAL_GENERAL",
"quantity": 2.0
}
]
}- USD (US Dollar)
- EUR (Euro)
- GBP (British Pound)
- CAD (Canadian Dollar)
- US (United States)
- CA (Canada)
- GB (United Kingdom)
- DE (Germany)
- FR (France)
- PHYSICAL
- DIGITAL
- SERVICE
- PHYSICAL_GENERAL
- DIGITAL_GENERAL
- SERVICE_GENERAL
The CLI displays tax estimation results in a formatted table showing:
- External ID
- Total Amount
- Tax Amount
- Tax Rate
- Detailed tax breakdown (if available)
Results can be saved to JSON files for further processing.
The application includes comprehensive error handling for:
- Invalid API credentials
- Network connectivity issues
- Invalid input data
- API response errors
For development and debugging:
bundle exec prykintsugi_sdk(~> 5.5.9) - Official Kintsugi Ruby SDKtty-prompt(~> 0.23.1) - Interactive command line promptstty-table(~> 0.12.0) - Terminal table renderingtty-spinner(~> 0.9.3) - Terminal spinners for loading statescolorize(~> 1.1) - Terminal color output
- API keys are masked during input
- No credentials are stored persistently
- All communication uses the official Kintsugi SDK
- Debug logging can be toggled on/off
-
"Failed to initialize client"
- Verify your API key and organization ID
- Check your internet connection
- Ensure you have the correct permissions
-
"Tax estimation failed"
- Review the request data for validation errors
- Check the debug logs for detailed error information
- Verify the address information is correct
-
Gem installation issues
- Ensure Ruby 3.2+ is installed
- Run
bundle updateto update dependencies
Enable debug logging in the settings menu to see detailed API communication logs.
This project uses the Apache-2.0 license, matching the Kintsugi SDK license.
For issues with the Kintsugi API or SDK, please refer to the official Kintsugi documentation, or contact ryan.le@trykintsugi.com.