A practical demonstration of creating tax transactions using the Kintsugi Tax Platform Java SDK. This project shows how to integrate with Kintsugi's API to programmatically create sales transactions with proper tax calculations.
This application demonstrates the complete workflow for creating a transaction through the Kintsugi Tax Platform. It handles authentication, transaction data construction, API communication, and response processing. The implementation follows the official SDK documentation and includes all necessary fields for accurate tax calculation.
- Complete transaction creation workflow
- Proper authentication with Kintsugi's security model
- Comprehensive transaction data mapping
- Address and customer information handling
- Tax calculation field management
- Error handling and response parsing
- Production-ready code patterns
- Java 17 or higher
- Gradle (wrapper included)
- Kintsugi Tax Platform account with API access
- Valid API key and organization ID
kintsugi-java-creation-demo/
├── app/
│ ├── build.gradle.kts # Build configuration
│ └── src/
│ ├── main/kotlin/
│ │ └── com/kintsugi/demo/
│ │ └── App.kt # Main application
│ └── test/kotlin/
│ └── com/kintsugi/demo/
│ └── AppTest.kt # Basic tests
├── gradle/ # Gradle wrapper files
└── README.md # This file
-
Clone the repository
git clone <repository-url> cd kintsugi-java-creation-demo
-
Configure your credentials
Open
app/src/main/kotlin/com/kintsugi/demo/App.ktand replace the placeholder values:.apiKeyHeader("your-api-key-here") .customHeader("your-organization-id-here")
Also update the organization ID references in the transaction data:
.organizationId("your-organization-id-here") -
Build the project
./gradlew build
Run the application to create a sample transaction:
./gradlew runThe application will:
- Initialize the Kintsugi SDK with your credentials
- Construct a transaction with sample data
- Send the request to Kintsugi's API
- Display the results
Starting Kintsugi Transaction Creation Demo...
Creating transaction with external ID: REV-DEMO-001
Transaction created successfully!
Transaction ID: txn_abc123xyz789
External ID: REV-DEMO-001
Status: COMMITTED
Total Amount: $99.0
Demo completed!
The demo creates a transaction with the following sample data:
- Product: Formal Dress ($99.00)
- Customer: Demo Customer
- Address: 333 N Main St, Cedar City, UT 84721
- Tax Amount: $6.75
- Transaction Type: Sale
- Status: Committed
To customize the transaction data, edit the transaction builder in App.kt:
val transactionRequest = TransactionPublicRequest.builder()
.externalId("your-external-id")
.totalAmount(yourAmount)
.addresses(java.util.List.of(
TransactionAddressPublic.builder()
.street1("your address")
.city("your city")
// ... other fields
))
// ... other transaction detailsThis implementation explicitly sets numeric values for all tax-related fields to avoid serialization issues with the Speakeasy-generated SDK:
.totalAmount(99.0)
.totalTaxAmountImported(6.75)
.totalTaxAmountCalculated(6.75)
.taxRateImported(0.0681)
.taxRateCalculated(0.0681)The SDK uses two authentication headers:
x-api-key: Your Kintsugi API keyx-organization-id: Your organization identifier
Both are configured through the Security builder pattern.
- Kotlin: JVM-based implementation
- Kintsugi Tax Platform Java SDK: Version 0.10.0
- Java: Version 17 toolchain
- Gradle: Build automation
The application includes comprehensive error handling for:
- Authentication failures
- Network connectivity issues
- Invalid transaction data
- API response errors
- Serialization problems
./gradlew test./gradlew buildThe compiled application will be available in app/build/.
This implementation follows the official Kintsugi Java SDK documentation. For detailed API information, refer to:
Authentication Errors
- Verify your API key is correct and has proper permissions
- Ensure your organization ID matches your account
Serialization Errors
- Make sure all numeric fields are set with explicit Double values
- Check that date formats include proper timezone information
Network Issues
- Confirm network connectivity to Kintsugi's API endpoints
- Check for firewall or proxy restrictions
This demo project is provided as-is for educational and integration purposes. Please refer to Kintsugi's terms of service for API usage guidelines.
For issues related to:
- This demo: Create an issue in this repository
- Kintsugi SDK: Refer to the official SDK repository
- Kintsugi API: Contact Kintsugi support through their official channels