Cross-border trade, compliance, and multi-currency commerce solutions
import { StateSetClient } from '@stateset/commerce-sdk';
const client = new StateSetClient({
endpoint: 'https://api.stateset.network',
apiKey: process.env.STATESET_API_KEY
});
// Create cross-border order with compliance
const internationalOrder = await client.global.createOrder({
buyer: {
country: 'US',
entity_id: 'did:stateset:buyer:usa123'
},
seller: {
country: 'DE',
entity_id: 'did:stateset:seller:ger456'
},
items: [{
hs_code: '8471.30.01', // Computer parts
description: 'Laptop processors',
quantity: 100,
unit_price: '299.99',
origin_country: 'TW'
}],
shipping: {
incoterm: 'DDP',
method: 'air_freight'
},
compliance: {
auto_check: true,
required_docs: ['commercial_invoice', 'packing_list']
}
});
console.log(`International order ${internationalOrder.id} created with compliance checks`);
POST /v1/global/orders
{
"buyer": {
"entity_id": "did:stateset:buyer:usa123",
"country": "US",
"state": "CA",
"tax_id": "12-3456789"
},
"seller": {
"entity_id": "did:stateset:seller:ger456",
"country": "DE",
"vat_number": "DE123456789"
},
"items": [
{
"sku": "LAPTOP-PRO-001",
"description": "Professional Laptop",
"hs_code": "8471.30.01",
"quantity": 10,
"unit_price": "999.00",
"unit_price_currency": "EUR",
"origin_country": "TW",
"weight_kg": 2.5
}
],
"currency_preferences": {
"display_currency": "EUR",
"payment_currency": "USDC",
"hedge_enabled": true
},
"shipping": {
"incoterm": "DDP",
"from_address": {
"street": "HauptstraΓe 123",
"city": "Berlin",
"postal_code": "10115",
"country": "DE"
},
"to_address": {
"street": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
}
},
"trade_terms": {
"payment_terms": "NET_30",
"currency_rate_lock": true,
"force_majeure_clause": true
}
}
{
"order_id": "gord_7x9kPm2nQ1",
"status": "CREATED",
"currency_conversion": {
"display_total_eur": "9990.00",
"payment_total_usdc": "10889.10",
"exchange_rate": 1.09,
"rate_locked_until": "2024-06-25T14:00:00Z"
},
"tax_calculation": {
"base_amount": "9990.00",
"vat_rate": 0.19,
"vat_amount": "1898.10",
"import_duty_rate": 0.035,
"import_duty": "349.65",
"total_taxes": "2247.75"
},
"compliance_status": {
"sanctions_check": "CLEAR",
"export_control": "CLEAR",
"restricted_party": "CLEAR",
"documentation_required": [
"commercial_invoice",
"packing_list",
"certificate_of_origin"
]
},
"shipping_estimate": {
"method": "DHL_EXPRESS",
"cost_usdc": "156.50",
"transit_days": 3,
"tracking_available": true
}
}
GET /v1/global/exchange-rates?base=EUR&targets=USD,USDC,GBP
{
"base_currency": "EUR",
"timestamp": "2024-06-25T12:00:00Z",
"rates": {
"USD": 1.0847,
"USDC": 1.0889,
"GBP": 0.8521
},
"spread": {
"buy": 0.001,
"sell": 0.001
},
"rate_lock_available": true,
"lock_duration_max": "24_hours"
}
POST /v1/global/compliance/sanctions-screen
{
"entities": [
{
"type": "individual",
"name": "John Smith",
"date_of_birth": "1980-01-15",
"nationality": "US",
"address": {
"country": "US",
"state": "NY"
}
},
{
"type": "organization",
"name": "Example Corp Ltd",
"registration_number": "12345678",
"country": "GB",
"business_type": "technology"
}
],
"screening_lists": [
"OFAC_SDN",
"OFAC_SSI",
"EU_SANCTIONS",
"UN_SANCTIONS",
"UK_SANCTIONS"
],
"match_threshold": 0.85
}
{
"screening_id": "scr_8y4mQr5oP2",
"status": "COMPLETED",
"timestamp": "2024-06-25T12:05:00Z",
"results": [
{
"entity_index": 0,
"status": "CLEAR",
"matches": [],
"confidence": 1.0
},
{
"entity_index": 1,
"status": "CLEAR",
"matches": [],
"confidence": 1.0
}
],
"lists_checked": [
"OFAC_SDN",
"OFAC_SSI",
"EU_SANCTIONS",
"UN_SANCTIONS",
"UK_SANCTIONS"
],
"next_screening_due": "2024-06-26T12:05:00Z"
}
POST /v1/global/compliance/export-control
{
"items": [
{
"description": "High-performance computing processors",
"eccn": "3A001",
"hs_code": "8542.31.00",
"value": "50000.00",
"quantity": 100
}
],
"destination_country": "CN",
"end_user": {
"name": "Beijing Tech Corp",
"type": "commercial",
"industry": "telecommunications"
},
"intended_use": "Commercial data center equipment"
}
{
"control_check_id": "ecc_3k8mRx7nQ9",
"status": "REQUIRES_LICENSE",
"items_assessment": [
{
"item_index": 0,
"classification": "3A001.a.1",
"control_reason": "NS - National Security",
"license_required": true,
"license_exception_available": false,
"restricted_countries": ["CN", "RU", "IR"],
"recommendation": "Apply for export license via SNAP-R system"
}
],
"license_application": {
"estimated_processing_time": "60-90 days",
"application_fee": "0.00",
"required_documents": [
"technical_specifications",
"end_user_statement",
"import_certificate"
]
}
}
POST /v1/global/documents/commercial-invoice
{
"order_id": "gord_7x9kPm2nQ1",
"template": "standard_international",
"customization": {
"logo_url": "https://company.com/logo.png",
"terms_and_conditions": "Payment due within 30 days...",
"notes": "Handle with care - fragile items"
},
"signatures_required": [
{
"signatory": "did:stateset:seller:ger456",
"role": "exporter",
"signature_type": "digital"
}
]
}
{
"document_id": "doc_5z8nPq3oW7",
"type": "commercial_invoice",
"status": "GENERATED",
"order_id": "gord_7x9kPm2nQ1",
"document_url": "https://docs.stateset.network/doc_5z8nPq3oW7.pdf",
"hash": "0x742d35Cc6634C0532925a3b8D097C00D4dfece08",
"blockchain_proof": {
"transaction_hash": "0x9f2e45Bb8734C1523456a7b9E087F00E4dfebe19",
"block_number": 1542389,
"timestamp": "2024-06-25T12:10:00Z"
},
"signatures": [
{
"signatory": "did:stateset:seller:ger456",
"status": "PENDING",
"signature_url": "https://sign.stateset.network/doc_5z8nPq3oW7"
}
],
"customs_integration": {
"us_customs": "ABI_READY",
"eu_customs": "ICS2_READY",
"tracking_number": "SSCI2024062501"
}
}
POST /v1/global/documents/certificate-of-origin
{
"order_id": "gord_7x9kPm2nQ1",
"origin_criteria": {
"preferential_origin": true,
"trade_agreement": "USMCA",
"manufacturing_country": "TW",
"materials_origin": [
{"country": "TW", "percentage": 70},
{"country": "JP", "percentage": 30}
]
},
"chamber_of_commerce": {
"issue_authority": "Taiwan Chamber of Commerce",
"certification_required": true
}
}
{
"document_id": "coo_4k7mLx9nQ2",
"type": "certificate_of_origin",
"status": "CERTIFIED",
"trade_agreement": "USMCA",
"preferential_treatment": {
"eligible": true,
"duty_savings": "1748.25",
"tariff_reduction": "from 5% to 0%"
},
"certification": {
"authority": "Taiwan Chamber of Commerce",
"certificate_number": "COO-TW-2024-062501",
"issued_date": "2024-06-25",
"valid_until": "2024-12-25"
},
"blockchain_verification": {
"immutable_hash": "0x3a8f72Dd9865E1234567b2c3F0987A00B5efghi01",
"verification_url": "https://verify.stateset.network/coo_4k7mLx9nQ2"
}
}
POST /v1/global/tax/calculate
{
"shipment": {
"from_country": "DE",
"to_country": "US",
"to_state": "CA"
},
"items": [
{
"hs_code": "8471.30.01",
"description": "Laptop computers",
"value": "9990.00",
"currency": "EUR",
"quantity": 10,
"weight_kg": 25.0,
"origin_country": "TW"
}
],
"shipping_cost": "150.00",
"insurance_cost": "50.00",
"incoterm": "DDP",
"trade_agreements": ["USMCA", "EU-TAIWAN_FTA"]
}
{
"calculation_id": "tax_6j9nSt4pX8",
"total_value_usd": "10839.30",
"duties": {
"base_rate": 0.035,
"preferential_rate": 0.00,
"applied_rate": 0.00,
"duty_amount": "0.00",
"trade_agreement": "Most Favored Nation",
"savings": "379.38"
},
"taxes": {
"federal": {
"type": "import_tax",
"rate": 0.00,
"amount": "0.00"
},
"state": {
"type": "sales_tax",
"rate": 0.0725,
"amount": "785.85",
"jurisdiction": "California"
}
},
"fees": {
"merchandise_processing": "54.20",
"harbor_maintenance": "25.10",
"customs_brokerage": "125.00"
},
"total_charges": {
"duties": "0.00",
"taxes": "785.85",
"fees": "204.30",
"total": "990.15"
},
"documentation": {
"tariff_classification": "8471.30.01.00",
"ruling_references": ["HQ 561234", "NY N123456"],
"effective_date": "2024-06-25"
}
}
GET /v1/global/duty-rates?hs_code=8471.30.01&from_country=TW&to_country=US
{
"hs_code": "8471.30.01",
"description": "Portable automatic data processing machines, weighing not more than 10 kg",
"rates": [
{
"country_pair": "TW-US",
"mfn_rate": 0.00,
"applied_rate": 0.00,
"trade_agreement": "Most Favored Nation",
"effective_date": "2019-01-01"
}
],
"additional_charges": [
{
"type": "merchandise_processing_fee",
"rate": "0.3464%",
"minimum": "27.23",
"maximum": "528.33"
}
],
"special_programs": [
{
"program": "Generalized System of Preferences",
"eligible": false,
"reason": "Country not eligible"
}
]
}
POST /v1/global/shipping/quotes
{
"from_address": {
"street": "HauptstraΓe 123",
"city": "Berlin",
"postal_code": "10115",
"country": "DE"
},
"to_address": {
"street": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94105",
"country": "US"
},
"packages": [
{
"weight_kg": 25.0,
"dimensions_cm": {
"length": 60,
"width": 40,
"height": 30
},
"value": "10000.00",
"currency": "EUR",
"dangerous_goods": false
}
],
"service_level": ["standard", "express", "economy"],
"insurance_required": true,
"signature_required": true
}
{
"quote_id": "shq_7m3kLx8nR4",
"valid_until": "2024-06-25T18:00:00Z",
"options": [
{
"carrier": "DHL_EXPRESS",
"service": "DHL Express Worldwide",
"cost": {
"shipping": "186.50",
"fuel_surcharge": "18.65",
"insurance": "25.00",
"total": "230.15",
"currency": "EUR"
},
"transit_time": {
"min_days": 2,
"max_days": 3,
"delivery_by": "2024-06-28T18:00:00Z"
},
"features": [
"tracking",
"signature_required",
"insurance_included",
"customs_clearance"
]
},
{
"carrier": "FEDEX_INTERNATIONAL",
"service": "FedEx International Priority",
"cost": {
"shipping": "198.75",
"fuel_surcharge": "19.88",
"insurance": "25.00",
"total": "243.63",
"currency": "EUR"
},
"transit_time": {
"min_days": 2,
"max_days": 4,
"delivery_by": "2024-06-29T18:00:00Z"
},
"features": [
"tracking",
"signature_required",
"insurance_included",
"money_back_guarantee"
]
}
]
}
POST /v1/global/shipping/shipments
{
"quote_id": "shq_7m3kLx8nR4",
"selected_option": 0,
"order_id": "gord_7x9kPm2nQ1",
"customs_documents": [
{
"type": "commercial_invoice",
"document_id": "doc_5z8nPq3oW7"
},
{
"type": "certificate_of_origin",
"document_id": "coo_4k7mLx9nQ2"
}
],
"pickup": {
"date": "2024-06-26",
"time_window": "09:00-17:00",
"special_instructions": "Ring doorbell twice"
}
}
{
"shipment_id": "ship_9k5mNx2oQ6",
"carrier": "DHL_EXPRESS",
"tracking_number": "1234567890",
"status": "SCHEDULED_FOR_PICKUP",
"pickup": {
"scheduled_date": "2024-06-26",
"time_window": "09:00-17:00",
"confirmation_number": "DHL-PKP-789012"
},
"delivery_estimate": "2024-06-28T18:00:00Z",
"shipping_label": {
"url": "https://labels.stateset.network/ship_9k5mNx2oQ6.pdf",
"format": "PDF_A4"
},
"customs_tracking": {
"status": "DOCUMENTS_SUBMITTED",
"customs_reference": "CBP-2024-062501",
"estimated_clearance": "2024-06-28T06:00:00Z"
},
"cost": {
"total_charged": "230.15",
"currency": "EUR",
"payment_method": "USDC"
}
}
POST /v1/global/trade-finance/letter-of-credit
{
"type": "documentary_credit",
"applicant": {
"entity_id": "did:stateset:importer:usa123",
"name": "US Importer Corp",
"country": "US"
},
"beneficiary": {
"entity_id": "did:stateset:exporter:ger456",
"name": "German Exporter GmbH",
"country": "DE"
},
"amount": "100000.00",
"currency": "USDC",
"goods_description": "High-precision manufacturing equipment",
"shipping_terms": {
"incoterm": "CIF",
"port_of_loading": "Hamburg",
"port_of_discharge": "Los Angeles",
"latest_shipment": "2024-08-15",
"partial_shipments": false,
"transhipment": true
},
"documents_required": [
{
"type": "commercial_invoice",
"copies": 3,
"signed": true
},
{
"type": "bill_of_lading",
"copies": 1,
"requirements": ["clean_on_board", "to_order_of_bank"]
},
{
"type": "packing_list",
"copies": 2
},
{
"type": "certificate_of_origin",
"copies": 1,
"authority": "German Chamber of Commerce"
}
],
"presentation_period": 21,
"expiry_date": "2024-09-30",
"expiry_place": "Hamburg, Germany",
"confirmation_required": true
}
{
"lc_id": "lc_8y4mQr5oP2",
"lc_number": "SSLC-2024-062501",
"status": "ISSUED",
"issuing_bank": "StateSet Trade Bank",
"confirming_bank": "Deutsche Handelsbank AG",
"amount": "100000.00",
"currency": "USDC",
"collateral_required": {
"amount": "25000.00",
"type": "cash_deposit",
"locked_until": "2024-10-15"
},
"fees": {
"issuance_fee": "500.00",
"confirmation_fee": "750.00",
"amendment_fee": "150.00",
"total_fees": "1400.00"
},
"smart_contract": {
"address": "stateset1lc8y4mQr5oP2...",
"auto_payment": true,
"compliance_rules": [
"document_verification",
"presentation_deadline",
"discrepancy_handling"
]
},
"blockchain_proof": {
"transaction_hash": "0xab3f45Cc8634E1523456c7b2F097B00C4efece12",
"block_number": 1542401,
"immutable_record": true
}
}
POST /v1/global/trade-finance/credit-insurance
{
"policy_type": "trade_credit",
"insured": {
"entity_id": "did:stateset:seller:ger456",
"annual_turnover": "5000000.00"
},
"coverage": {
"insured_percentage": 90,
"maximum_amount": "500000.00",
"currency": "USDC",
"geographic_scope": ["US", "CA", "MX"],
"coverage_types": [
"commercial_insolvency",
"protracted_default",
"political_risk"
]
},
"buyers": [
{
"entity_id": "did:stateset:buyer:usa123",
"credit_limit": "250000.00",
"payment_terms": "NET_60"
}
],
"premium_payment": {
"frequency": "monthly",
"method": "usdc_auto_debit"
}
}
{
"policy_id": "tci_5z8nPq3oW7",
"policy_number": "SSTCI-2024-062501",
"status": "ACTIVE",
"coverage_start": "2024-07-01T00:00:00Z",
"coverage_end": "2025-06-30T23:59:59Z",
"premium": {
"annual_premium": "7500.00",
"monthly_payment": "625.00",
"currency": "USDC",
"next_payment_due": "2024-07-01"
},
"coverage_details": {
"maximum_claim": "500000.00",
"deductible": "10000.00",
"waiting_period_days": 90,
"claim_payment_days": 30
},
"parametric_triggers": {
"enabled": true,
"auto_claim_processing": true,
"oracle_sources": ["credit_rating_agencies", "payment_data"]
}
}
GET /v1/global/analytics/trade-flows?start_date=2024-01-01&end_date=2024-06-25
{
"period": {
"start": "2024-01-01",
"end": "2024-06-25"
},
"summary": {
"total_orders": 1247,
"total_value_usd": "15847293.45",
"unique_countries": 47,
"avg_order_value": "12701.75"
},
"by_region": [
{
"region": "North America",
"orders": 456,
"value": "6234567.89",
"percentage": 39.3
},
{
"region": "Europe",
"orders": 389,
"value": "4567890.12",
"percentage": 28.8
},
{
"region": "Asia Pacific",
"orders": 289,
"value": "3456789.01",
"percentage": 21.8
}
],
"top_corridors": [
{
"from": "DE",
"to": "US",
"orders": 234,
"value": "2987654.32"
},
{
"from": "CN",
"to": "US",
"orders": 198,
"value": "2456789.01"
}
],
"compliance_metrics": {
"sanctions_alerts": 0,
"export_control_flags": 2,
"documentation_delays": 8,
"average_clearance_time_hours": 4.2
}
}
GET /v1/global/analytics/currency?currencies=EUR,GBP,JPY&period=30d
{
"period": "30_days",
"base_currency": "USDC",
"currencies": [
{
"currency": "EUR",
"volume": "2847293.45",
"avg_rate": 1.0847,
"volatility": 0.023,
"hedge_ratio": 0.85,
"saved_fees": "14236.47"
},
{
"currency": "GBP",
"volume": "1456789.01",
"avg_rate": 0.7934,
"volatility": 0.031,
"hedge_ratio": 0.78,
"saved_fees": "7283.95"
}
],
"hedging_performance": {
"total_hedged_volume": "3847293.45",
"average_savings": 0.0037,
"hedging_cost": "14211.58",
"net_benefit": "7308.84"
}
}
// GDPR-compliant data handling
const gdprCompliance = await client.global.compliance.gdpr({
data_subject: 'did:stateset:person:eu456',
processing_purpose: 'trade_finance_kyc',
lawful_basis: 'legitimate_interest',
retention_period: '7_years',
data_minimization: true,
consent_required: false
});
// Right to be forgotten
await client.global.compliance.deletePersonalData({
subject_id: 'did:stateset:person:eu456',
scope: 'all_data',
retain_legal_obligations: true
});
// EAR compliance checking
const earCompliance = await client.global.compliance.ear({
items: [{
eccn: '3A001.a.1',
description: 'High-performance processors'
}],
destination: 'CN',
end_user: 'commercial_entity',
license_exception: 'TSR'
});
if (earCompliance.license_required) {
const application = await client.global.compliance.applyExportLicense({
item_details: earCompliance.items,
justification: 'Commercial use in non-sensitive application'
});
}
// Track goods movement on blockchain
const tracking = await client.global.tracking.create({
shipment_id: 'ship_9k5mNx2oQ6',
checkpoints: [
'manufacturing_complete',
'quality_inspection',
'customs_departure',
'in_transit',
'customs_arrival',
'final_delivery'
],
iot_sensors: {
temperature: true,
humidity: true,
shock: true,
location: true
},
notifications: {
webhook_url: 'https://api.company.com/tracking',
email_alerts: ['ops@company.com'],
sms_alerts: ['+15551234567']
}
});
// Real-time updates via IoT
tracking.on('checkpoint_reached', (data) => {
console.log(`Shipment reached ${data.checkpoint} at ${data.timestamp}`);
console.log(`Condition: Temp ${data.temperature}Β°C, Humidity ${data.humidity}%`);
});
// Machine learning trade optimization
const insights = await client.global.ai.analyzeTradeOpportunities({
company_profile: 'did:stateset:company:abc123',
product_categories: ['electronics', 'automotive_parts'],
target_regions: ['EU', 'ASEAN'],
analysis_depth: 'comprehensive'
});
// Response includes ML-generated recommendations
{
"opportunities": [
{
"market": "Germany",
"product": "Electronics Components",
"potential_revenue": "2400000.00",
"confidence": 0.87,
"entry_barriers": ["CE_certification", "WEEE_compliance"],
"recommended_strategy": "Partner with local distributor"
}
],
"risk_factors": [
{
"type": "regulatory_change",
"probability": 0.23,
"impact": "medium",
"mitigation": "Monitor EU Digital Services Act implementation"
}
]
}
import { StateSetGlobal } from '@stateset/react-native';
const GlobalCommerceScreen = () => {
const [orders, setOrders] = useState([]);
const createInternationalOrder = async () => {
try {
const order = await StateSetGlobal.createOrder({
buyer_country: 'US',
seller_country: 'DE',
items: [...items],
auto_compliance: true
});
setOrders([...orders, order]);
} catch (error) {
console.error('Order creation failed:', error);
}
};
return (
<GlobalOrderComponent
onCreateOrder={createInternationalOrder}
complianceEnabled={true}
supportedCountries={StateSetGlobal.getSupportedCountries()}
/>
);
};
// SAP Integration
public class StateSetGlobalSAPConnector {
private StateSetGlobalClient client;
public void syncInternationalOrders() {
// Fetch orders from SAP
List<SAPOrder> sapOrders = sapService.getNewOrders();
for (SAPOrder sapOrder : sapOrders) {
// Convert to StateSet format
GlobalOrder stateSetOrder = convertSAPToStateSet(sapOrder);
// Create with compliance
stateSetOrder.setComplianceEnabled(true);
stateSetOrder.setAutoDocuments(true);
// Submit to StateSet
client.global().createOrder(stateSetOrder);
// Update SAP with StateSet order ID
sapService.updateOrderReference(
sapOrder.getId(),
stateSetOrder.getId()
);
}
}
}
Metric | Before StateSet | With StateSet | Improvement |
---|---|---|---|
Countries Accessible | 12 | 195+ | 1,525% |
Compliance Time | 2-6 weeks | 2 minutes | 99.9% faster |
Documentation Cost | $500-2000 | $5-20 | 99% cheaper |
Settlement Time | 5-30 days | 1 hour | 99.8% faster |
Error Rate | 15-25% | 0.1% | 99.6% reduction |