A .NET 7.0 background service that pulls orders from Trendyol API and saves them to SQL Server database. Runs continuously in the background and checks for new orders every 10 seconds.
- Connects to Trendyol API with your credentials
- Fetches orders every 10 seconds
- Saves order data to local database
- Prevents duplicate entries
- Logs all operations
- .NET 7.0 SDK (or install .NET 8.0 for better support)
- SQL Server (LocalDB works fine)
- Trendyol API credentials (get from Trendyol seller panel)
git clone https://github.com/erennmutlu1/TrendyolOrderService.git
cd TrendyolOrderServiceOpen SQL Server Management Studio and run the SQL commands from CreateDatabase.txt file. This creates the database and all required tables.
Open appsettings.json and fill in your information:
{
"TrendyolApi": {
"ApiKey": "put-your-api-key-here",
"ApiSecret": "put-your-api-secret-here",
"SupplierId": "put-your-supplier-id-here",
"PollingIntervalSeconds": 10
}
}dotnet restore
dotnet build
dotnet runThe service starts running and will check for orders every 10 seconds.
- Service starts and validates your API credentials
- Every 10 seconds it calls Trendyol API
- For each new order, it saves:
- Order details (customer name, total price, etc.)
- Shipping address
- Invoice address
- Product line items
- Package tracking history
- If order already exists, skips it
- If something fails, rolls back that order and continues with next one
TrendyolOrders- main order dataTrendyolOrders_ShipmentAddresses- where to shipTrendyolOrders_InvoiceAddresses- billing infoTrendyolOrders_Lines- products in orderTrendyolOrders_PackageHistories- shipping updates
"API credentials are not configured"
- You forgot to fill in API credentials in appsettings.json
"Cannot connect to database"
- SQL Server not running or wrong connection string
- Make sure you created the database and tables
"API request failed"
- Wrong API credentials
- No internet connection
- Check your Trendyol account status
TrendyolOrderService/
├── Worker.cs - main service logic
├── Program.cs - starts the service
├── DBContext/ - database connection
├── Models/ - database table definitions
├── Context/ - API response structure
├── Utils/ - helper functions
└── appsettings.json - your settings here
Don't upload appsettings.json with real credentials to GitHub. The .gitignore file already excludes it.
Eren Mutlu - GitHub
Current: 1.0.0 (uses .NET 7.0)
Note: .NET 7.0 is no longer supported. Consider upgrading to .NET 8.0 LTS.