---
title: "Integration Lifecycle"
space: "Integrations"
url: "https://integrations.frappe.cloud/integrations/ecommerce-integration/ecommerce-core/developer-documentation/integration-lifecycle"
updated: "2026-09-10"
---

### Phase 1: Configuration

1. **Provider Setup**
  - Install provider integration app (extends ecommerce_core)
  - Configure provider-specific settings (API credentials, endpoints)
  - Define warehouse mappings in provider settings doctype
2. **Warehouse Mapping**
  ```python
   # In provider settings
   def get_erpnext_to_integration_wh_mapping(self):
       return {
           "Stores - ERPNext": "warehouse_001",
           "Default Warehouse": "warehouse_main"
       }
  ```
3. **Scheduling Configuration**
  - Configure sync intervals in provider settings
  - Enable/disable specific synchronization streams
  - Set log retention policies

### Phase 2: Initial Synchronization

1. **Item Mapping**
  ```python
   create_ecommerce_item(
       integration="Unicommerce",
       erpnext_item_code="ITEM-001",
       integration_item_code="SKU-001",
       has_variants=False,
       variant_of=None
   )
  ```
2. **Customer Synchronization**
  ```python
   customer = EcommerceCustomer("CUST-001", "unicommerce_customer_id", "Unicommerce")
   if not customer.is_synced():
       customer.sync_customer("John Doe", "Individual")
       customer.create_customer_address({...})
       customer.create_customer_contact({...})
  ```
3. **Geographic Mapping**
  ```python
   map_country_and_state("US", "NY")  # Maps to ISO codes
  ```

### Phase 3: Operational Synchronization

1. **Inventory Sync**
  ```python
   # In scheduled job
   if need_to_run(settings, "inventory_interval", "last_inventory_sync"):
       warehouses = settings.get_erpnext_warehouses()
       inventory = get_inventory_levels(warehouses, integration)

       for item in inventory:
           update_platform_inventory(item)
           update_inventory_sync_status(item.ecom_item)
  ```
2. **Order Processing**
  - Fetch orders from platform
  - Create ERPNext Sales Order
  - Apply dummy tax category and price list
  - Reserve stock if applicable
3. **Logging & Monitoring**
  ```python
   create_log(
       integration="Unicommerce",
       method="sync_inventory",
       status="Success",
       request_data={...},
       response_data={...}
   )
  ```

### Phase 4: Error Handling & Retry

1. **Automatic Logging**
  - All operations logged to `Ecommerce Integration Log`
  - Exception capture with full stack traces
  - Request/response payload preservation
2. **Manual Retry**
  - Failed operations accessible from UI
  - Individual record retry capability
  - Bulk retry operations