Complyance Logo

Complyance Java SDK v3.0

Production ready Java SDK with Log on DocType support, automatic 320/32C classification, multi country compliance for KSA, Malaysia, and Belgium, and enterprise grade features. Built for real world e-invoice applications.

Feature Summary

  • 34 Types - Registered DocType support
  • 3 Countries - KSA, Malaysia, Belgium supported
  • 5 Overloads - Good Comply methods
  • v3.0 - Production ready

Installation

The automated setup will detect your operating system and provide the correct instructions.

macOS & Linux

  1. Install Java (JDK 11 or higher)

    brew install openjdk@11
  2. Set JAVA_HOME environment variable

    export JAVA_HOME=$(/usr/libexec/java_home -v 11)
  3. Verify installation

    java -version

Windows

  1. Download and install OpenJDK 11+
  2. Set JAVA_HOME environment variable
  3. Add Java to PATH

Manual Installation

Maven

Add the dependency to your pom.xml:

<dependency>
  <groupId>io.complyance</groupId>
  <artifactId>unify-sdk</artifactId>
  <version>3.0.5-beta</version>
</dependency>

Gradle

implementation 'io.complyance:unify-sdk:3.0.5-beta'

Windows Installation

# Install Chocolatey (run as Administrator)
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

# Install OpenJDK 11 and Maven
choco install openjdk11 maven -y

# Verify installation
java -version
mvn -version

PowerShell Profile Configuration

# Edit PowerShell profile
notepad $PROFILE

# Add these lines to your PowerShell profile:
$env:JAVA_HOME = "C:\Program Files\OpenJDK\openjdk-11"
$env:M2_HOME = "C:\Program Files\Apache\maven"
$env:PATH = "$env:JAVA_HOME\bin;$env:M2_HOME\bin;$env:PATH"

# Complyance SDK Environment Variables
$env:COMPLYANCE_API_BASE_URL = "http://127.0.0.1:4000"
$env:COMPLYANCE_JWT_TOKEN = "your-jwt-token-here"



## Linux Installation

### Ubuntu/Debian

```bash
sudo apt update && sudo apt install -y openjdk-11-jdk maven
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

CentOS/RHEL

sudo yum install java-1.8.0-openjdk-devel maven

Arch Linux

sudo pacman -S jre8-openjdk maven

Quickstart (Correct Workflow)

The SDK follows a structured Configure → Mapping → Template → Invoicing flow. This process ensures your document data correctly translates to regulatory standards across all supported countries (KSA, Malaysia, UAE, etc.).

1) Configure the SDK (once per application)

Connect to the Complyance platform by providing your API key and defining your application source.

import io.complyance.sdk.Environment;
import io.complyance.sdk.GETSUnifySDK;
import io.complyance.sdk.SDKConfig;
import io.complyance.sdk.Source;
import io.complyance.sdk.SourceType;
import java.util.Arrays;

Source source = new Source("my-app", "1.0", SourceType.FIRST_PARTY);
SDKConfig config = new SDKConfig(
    "YOUR_API_KEY",
    Environment.SANDBOX, // Change to PRODUCTION when going live
    Arrays.asList(source)
);

GETSUnifySDK.configure(config);

The "Purpose" Workflow

The integration requires a specific logical sequence for the Purpose parameter to ensure data accuracy and compliance.

Step 1: MAPPING (Setup & Template Creation)

Set the Purpose to Purpose.MAPPING to push your raw business data to the Complyance platform. This stage is used for field discovery and blueprinting.

  • In Code: Submit your payload using Purpose.MAPPING. At this stage, you may use null for the source name and version.
  • In Portal: Locate the uploaded payload in the Complyance portal, complete the field mapping until validations pass, and save it as a Template.
  • Final Step: Register and bind your unique sourceName and sourceVersion (e.g., my-app / 1.0) to this saved template.
import io.complyance.sdk.Country;
import io.complyance.sdk.LogicalDocType;
import io.complyance.sdk.Mode;
import io.complyance.sdk.Operation;
import io.complyance.sdk.Purpose;
import io.complyance.sdk.UnifyResponse;
import java.util.List;
import java.util.Map;

// Build your business payload
Map<String, Object> payload = Map.of(
    "invoice_data", Map.of(
        "document_number", "INV-2026-0001",
        "invoice_date", "2026-02-18",
        "currency_code", "SAR"
    ),
    "seller_info", Map.of("seller_name", "My Company"),
    "buyer_info", Map.of("buyer_name", "My Customer"),
    "line_items", List.of(
        Map.of("item_name", "Consulting", "quantity", 1, "unit_price", 1000.00)
    )
);

// Push for initial mapping
UnifyResponse mappingResponse = GETSUnifySDK.pushToUnify(
    null,            // sourceName
    null,            // sourceVersion
    LogicalDocType.TAX_INVOICE,
    Country.SA,      // Specify target country
    Operation.SINGLE,
    Mode.DOCUMENTS,
    Purpose.MAPPING,
    payload
);

Step 2: INVOICING (Production Submission)

After your template is successfully bound to your source identifiers on the portal, switch the Purpose to Purpose.INVOICING.

  • Action: The platform now recognizes your sourceName/sourceVersion and applies the saved template logic to transform and officially submit the document.
  • Requirement: You must provide the exact sourceName and sourceVersion that were bound to the template.
// Submit for production invoicing
UnifyResponse invoiceResponse = GETSUnifySDK.pushToUnify(
    "my-app",        // Registered sourceName
    "1.0",           // Registered sourceVersion
    LogicalDocType.TAX_INVOICE,
    Country.SA,
    Operation.SINGLE,
    Mode.DOCUMENTS,
    Purpose.INVOICING,
    payload
);

if (invoiceResponse != null && invoiceResponse.isSuccess()) {
    System.out.println("✅ Invoice submitted: " + invoiceResponse.getData().getSubmission().getSubmissionId());
}

Why this structure is important:

  1. MAPPING is the "Discovery" phase where you build the data blueprint.
  2. The Portal is where you finalize the compliance logic and connect it to your application source.
  3. INVOICING is the "Execution" phase where the SDK performs the actual regulatory submission using that blueprint.

Payload structure (example: UAE)

Use this structure as a reference when building your payload.

{
  "invoice_data": {
    "document_number": "UAE-INV-2026-0001",
    "document_id": "550e8400-e29b-41d4-a716-446655440000",
    "document_type": "tax_invoice",
    "invoice_date": "2026-02-18",
    "currency_code": "AED",
    "total_amount": 10500.0,
    "amount_due": 10500.0
  },
  "seller_info": {
    "seller_name": "ABC Trading LLC",
    "vat_number": "100819867100003",
    "country_code": "AE"
  },
  "buyer_info": {
    "buyer_name": "XYZ Corporation LLC",
    "buyer_vat_number": "100889867100003",
    "buyer_country": "AE"
  },
  "line_items": [
    {
      "item_name": "Professional Services",
      "quantity": 10.0,
      "unit_price": 1000.0,
      "tax_rate": 5.0,
      "line_total": 10500.0
    }
  ],
  "uae_extensions": {
    "specification_identifier": "urn:peppol:pint:ae:invoice:v1",
    "total_amount_including_tax_in_aed": 10500.0
  }
}

Need a working payload?

Run a sample class from the test project with Maven using your target country's test file.

# From the repo root
mvn -q -f test-project/pom.xml compile exec:java \
  -Dexec.mainClass=io.complyance.test.UAE.UAETaxInvoiceTest

Change -Dexec.mainClass to the class you want to run for another country.

LogicalDocType

LogicalDocType is the recommended way to drive document behavior (B2B/B2C variants, export/self-billed/third-party, etc.). The same LogicalDocType values apply across all supported countries.

Examples:

  • B2B: TAX_INVOICE, TAX_INVOICE_CREDIT_NOTE, TAX_INVOICE_DEBIT_NOTE
  • B2C: SIMPLIFIED_TAX_INVOICE, SIMPLIFIED_TAX_INVOICE_CREDIT_NOTE
  • Special: EXPORT_INVOICE, SELF_BILLED_INVOICE, THIRD_PARTY_INVOICE

Reference (download)

Download the full class file: UAETaxInvoiceTest.java

Support

  • Contact: Contact Complyance for E-Invoicing - Complyance has helped over 1000+ organizations simplify global e-invoicing. Let us help you understand how Complyance can work for you.