iShoppingBot 1.0.0

Complete iShoppingBot Installation & Administration Guide

Comprehensive 1.0.0 reference: installation, all settings, products, markets, payments, Mini App, workers, security, backup, updates and troubleshooting
This manual is written for operators and installers and covers installation through production operation and maintenance.

1. Before you start

This is the primary operator manual for version 1.0.0. Prepare an HTTPS domain/subdomain, an empty database, a Telegram Bot Token and the numeric Telegram Admin ID before installation.

Important: 1.0.0 is the first public release. db.sql is the complete database baseline. migrations/ is reserved for future updates; a fresh 1.0.0 install does not depend on historical development migrations.

2. Server requirements

ItemRequirement
PHP8.1+
DatabaseMySQL/MariaDB with CREATE/ALTER/INDEX privileges
Extensionspdo_mysql, curl, json, openssl, mbstring, fileinfo
WebValid HTTPS
Writableshop/config and storage
JobsCron or systemd/process manager
OutboundTelegram API plus enabled payment/SMS providers

Correct server time is important for payments, TOTP, queues and expiration.

3. Create the Telegram Bot

  1. Create a bot with BotFather and copy its token.
  2. Send /start to the bot.
  3. Prepare the numeric Telegram user ID of the owner/admin.
  4. If mandatory channel membership is used, add the bot with required permissions and prepare Channel ID/Link/Name.
Never publish Bot Token, APP_KEY, bridge secrets or database credentials.

4. Database preparation

Create a database and a dedicated database user in cPanel/DirectAdmin, grant the required privileges, and use a clean database for the first installation. On shared hosting, use the full prefixed database/user names.

5. Step-by-step installation

  1. Extract the ZIP into the domain/subdomain document root.
  2. Confirm db.sql, setup/, shop/ and storage/ exist.
  3. Open setup/.install-code in File Manager and copy the install code.
  4. Open https://bot.example.com/setup/.
  5. Enter install code, store name, database credentials, Bot Token, Admin ID, APP URL and optional channel settings.
  6. APP URL must be HTTPS and end in /shop/.
  7. The installer validates requirements/connectivity, installs the database baseline, creates local configuration/secrets and configures the Telegram webhook.
  8. After success, test the bot, Web Admin and Health Center.
Avoid permanent 777. Use correct ownership and appropriate file/directory permissions for your host.

6. Installer fields

FieldPurpose
Install codeRead from setup/.install-code
Store nameBot/store display name
Bot TokenOfficial BotFather token
Admin IDNumeric Telegram user ID
APP URLHTTPS application URL ending in /shop/
DB Host/Name/User/PasswordDatabase connection
Channel ID/LinkOptional mandatory-membership channel

7. All base configuration keys

The installer creates shop/config/local.php. .env.example documents supported configuration.

KeyPurpose
BOT_TOKEN / BOT_USERNAME / BOT_NAMETelegram identity and store name
ADMIN_IDSNumeric administrator IDs
APP_URLHTTPS application URL
TELEGRAM_WEBHOOK_SECRETWebhook validation secret
DB_HOST / DB_NAME / DB_USER / DB_PASSWORDDatabase connection
CHANNEL_ID / CHANNEL_LINK / CHANNEL_NAMEMembership channel
PAYMENTS_ENABLEDGlobal online-payment switch
ZARINPAL_MERCHANT_IDLegacy/direct Zarinpal compatibility setting
GATEWAY_AMOUNT_MULTIPLIERProvider amount-unit multiplier; configure carefully
PAYMENT_DESCRIPTIONBase transaction description
BROADCAST_BATCH_SIZE / PREPARE_BATCH_SIZE / MAX_ATTEMPTS / LEASE_SECONDS / RATE_PER_SECOND / IDLE_SLEEP_MSBroadcast queue tuning
APP_KEYEncryption key for integration secrets; do not rotate casually after secrets are stored
SMS_BATCH_SIZE / SMS_MAX_ATTEMPTS / SMS_LEASE_SECONDS / SMS_IDLE_SLEEP_MSSMS queue tuning
DEFAULT_LANGUAGEfa or en

8. Web Admin

Web Admin contains Dashboard, Products, Categories, Orders, Customers, Import/Export, Integrations, Mini App, Growth & Finance, Support, Returns, Health, Logs, Admins & Roles, Audit and Profile. Review Profile/security and enable TOTP 2FA after the first login.

9. Products and variants

Supported commerce flows are Physical, Digital and VPN/Subscription, with optional variants.

  • Physical: stock, warehouse and shipping.
  • Digital: protected asset/delivery; never expose private files as fixed public URLs.
  • VPN/Subscription: plan, provisioning and service inventory.
  • Variants: duration, capacity, color, plan, volume, etc.; price and stock may be independent.

10. Languages and translations

UI language, country, market and currency are independent. Users can switch with /language or /lang. Language files live in shop/resources/lang/. Persian and English ship with the product. To add a language, copy an existing file, change its code/meta/direction and translate all keys. Product, category and variant translations are stored separately.

11. Market, Country, Currency and pricing

A user may use Persian UI while having Country=CA and Currency=CAD. An explicit saved country wins over IP/edge hints. Market prices may vary by Country, Currency, Variant and quantity. Decimal currencies use minor units: CAD 14.99 is stored as 1499. Order/item language, market, country and currency are snapshotted so later configuration changes do not rewrite historical orders.

12. Tax and FX

Configure Tax Rules and FX Rates in the payment/integrations area. Tax rules may match Market, Country, Currency and Product Type. Tax rates use basis points (1300 = 13%) and may be inclusive or exclusive. FX stores base/quote currency, rate, markup and expiry. Do not use stale rates for checkout.

The operator is responsible for legally correct tax configuration.

13. Payment gateways

Providers use either Direct API or Secure Bridge. Configure and enable an integration, then define Gateway Routing.

Direct API

ProviderMain fields
Zarinpalmerchant_id, sandbox, amount_multiplier
Zibalmerchant, amount_multiplier
IDPayapi_key, sandbox, amount_multiplier
NextPayapi_key, amount_multiplier
Vandarapi_key, amount_multiplier
AqayePardakhtpin, sandbox, amount_multiplier
Pay.irapi_key, amount_multiplier
Sepalapi_key, amount_multiplier
IranDargahapi_token, amount_multiplier

Secure Bridge / PSP

Catalog entries include Stripe, PayPal, custom international, PayPing, Jibit, BitPay, RayanPay, Toman, Custom PayFac, Mellat, Saman, Parsian, Pasargad, Sadad, IranKish, AsanPardakht, Sepehr, Fanava Card, Mabna Card, Payment Novin, Sayan Card and Custom PSP. Bridge providers require bridge_url and bridge_secret, with optional merchant/terminal IDs. A catalog entry is not a payment account; real credentials/endpoints are still required.

Gateway Routing can match Market, Country, Currency, Product Type and amount range. Payment callbacks are idempotent to suppress duplicate processing.

14. SMS and notifications

SMS providers: Kavenegar, SMS.ir, IPPanel, FarazSMS, Ghasedak, MeliPayamak, MAGFA Bridge and Custom HTTP Bridge. Save and enable the integration, send a test where supported, and make sure the SMS worker is running for queued messages.

15. Cart, checkout and order lifecycle

Checkout combines market price, variant, discounts, shipping, tax, wallet and eligible gateways. Use official order workflows for state changes. Paid state may trigger inventory, rewards, affiliate commission, invoice, digital/VPN delivery and notifications.

Do not directly edit paid orders with ad-hoc SQL; it can desynchronize ledgers, inventory and fulfillment.

16. Multi-currency wallet

Legacy IRT credit remains for compatibility. Other currencies use separate accounts/ledgers with idempotent credit/debit operations. Balances are never silently converted between currencies.

17. Coupons and discounts

Discount rules support scoped redemption. Validate currency/market for fixed-amount discounts, plus limits, dates and product/category scope. Reservations should be released on cancelled/expired checkout flows.

18. Referral, Reward and Affiliate

Referral handles invitations/rewards; Affiliate handles sales commissions. Reward Engine can issue points, wallet credit or coupons with event-key idempotency. Affiliate supports accounts, referrals, commissions, approval delay, payout requests, settlement/rejection and reversal. Runtime settings include affiliate_enabled, default commission, approval days, minimum payout and payout mode.

19. Inventory and shipping

Inventory supports warehouses, stock, reservations, movements, transfers, adjustments, low-stock and dormant-product views. Multi-warehouse is controlled by inventory_multiwarehouse_enabled. Configure shipping zones/methods/slots for physical products and test last-unit concurrency in staging.

20. Subscriptions and VPN

Subscriptions support order sync, renewal orders, early renewal, lifecycle notifications and expiry. Relevant settings include subscription_enabled and subscription_early_renewal_days. VPN uses plans, accounts and provisioning jobs. External provisioning should be retryable and observable.

21. Digital delivery

Digital assets and deliveries are stored separately. Secure download tokens are used for access. Do not deliver private assets with permanent public URLs. Test paid delivery and token expiry.

22. Invoices

Enable invoices with invoice_enabled. Settings include prefix, seller name/address/phone/tax ID and fallback tax percentage. Invoice records should use order snapshots rather than current product prices.

23. Support and returns

Support provides tickets, messages and media messages. Returns have their own request/status flow. Before financial refund, inspect return state, fulfillment and provider status. Refund Ledger records refund lifecycle; actual online refund requires provider/bridge API support.

24. Mini App

  1. Enable Mini App in Web Admin.
  2. Use HTTPS.
  3. Configure Main Mini App in BotFather.
  4. Configure slides/featured/settings.
  5. Test Home, Categories, Product, Cart, Checkout, Orders and Deliveries on a real phone.
  6. Verify Language/Market/Currency matches the Telegram bot.

25. Webhook and user commands

Main user commands include /start, /language//lang and /market. Some flows also use /cancel//skip. Health Center exposes Telegram API, webhook, pending updates and recent errors. Do not use getUpdates concurrently with an active webhook.

26. Cron and workers

* * * * * /usr/local/bin/php /home/USERNAME/public_html/shop/cli/commerce_worker.php --once --max-jobs=30 >/dev/null 2>&1
* * * * * cd /home/USERNAME/public_html && /usr/local/bin/php shop/cli/sms_worker.php --once >/dev/null 2>&1
* * * * * /usr/bin/flock -n /tmp/ishoppingbot-broadcast.lock /usr/bin/php /home/USERNAME/public_html/shop/cli/broadcast_worker.php --max-runtime=50 >/dev/null 2>&1
17 3 * * * /usr/local/bin/php /home/USERNAME/public_html/shop/cron/stability_cleanup.php >/dev/null 2>&1

Replace paths for your server. Example systemd services for broadcast and SMS are included in deploy/. Verify fresh queue/worker heartbeats after enabling jobs.

27. Admins, roles and permissions

Use separate admin accounts and least privilege. Permissions cover dashboard, product view/edit/import/export, categories, order view/edit, customers, integrations, Mini App, health view/manage, support, returns, audit, finance, inventory, subscriptions, discounts, affiliate and growth. Enable TOTP 2FA in Profile. Login is rate-limited.

28. Health, logs and audit

Use Health Center for PHP/database/Telegram/webhook/queue operational checks, Logs for technical failures and Audit for sensitive admin changes. Run Health before and after updates.

29. Backup and restore

Back up before updates, large imports, gateway changes or database work. Keep off-server copies. Validate disaster recovery by restoring into staging, running Health, testing bot/webhook/admin/orders/integrations and completing a test order. A restore operation should create a safety backup first.

30. Update Manager

1.0.0 is the baseline. Future database changes should arrive as official update migrations. Update Manager validates release metadata/compatibility/checksums and coordinates backup, install and rollback. After updating, verify migrations, Health, webhook, workers and checkout.

31. Import / Export

Use admin Import/Export for bulk catalog operations. Use UTF-8, back up first, test a small sample in staging, and carefully map product/variant IDs, SKU, currency and prices.

32. File layout

PathPurpose
db.sqlComplete 1.0.0 database baseline
setup/Web installer
shop/Bot/Admin/Mini App/API/payment/workers
shop/config/Application configuration
shop/resources/lang/Language catalogs
storage/Writable runtime/backup data; protect from direct access
deploy/Cron/systemd examples
migrations/Reserved for future official migrations
release.jsonRelease metadata/minimum PHP
SHA256SUMSRelease file checksums

33. Production security

  • HTTPS everywhere.
  • Keep APP_KEY and secrets private.
  • Enable admin 2FA.
  • Use strong unique passwords.
  • Avoid permanent 777.
  • Do not expose PHP errors publicly.
  • Keep off-server backups.
  • Use webhook and bridge secrets.
  • Apply least privilege to admin/database accounts.
  • Keep PHP/MySQL/SSL current.

34. Complete go-live checklist

  1. Fresh install succeeds on target server.
  2. Health has no critical error.
  3. /start, language and market work.
  4. Webhook is healthy.
  5. Admin login, roles and 2FA tested.
  6. Workers have fresh heartbeats.
  7. Products/variants correct.
  8. Physical inventory/shipping tested if used.
  9. Digital delivery tested if used.
  10. VPN/subscription tested if used.
  11. Market/country/currency/price correct.
  12. Tax/FX tested if enabled.
  13. Gateway routing exposes only eligible providers.
  14. One sandbox/small live payment completed end-to-end.
  15. Duplicate callback does not double-pay.
  16. Coupon/reward/referral/affiliate tested if used.
  17. SMS/notifications tested.
  18. Invoice tested if enabled.
  19. Cancel/expire releases reservations.
  20. Return/refund flow tested if used.
  21. Backup and restore tested in staging.

35. Troubleshooting

ProblemCheck
Bot silentToken, HTTPS, webhook URL/secret, Telegram connectivity, last error, logs
Webhook conflictDo not run getUpdates with webhook; re-register webhook and inspect pending updates
HTTP 500PHP/extensions, local config, DB credentials, permissions and logs
Admin login failsPassword, rate limit, session/cookie, HTTPS, TOTP and server time
Wrong priceMarket, country, currency, variant, market price and FX; language is not pricing
Gateway missingIntegration enabled/default, routing, country/currency/product type/amount
Charged but not PaidCallback, authority/reference, provider verify, APP URL, payment event and logs
SMS not sentCredentials, test mobile, SMS worker, queue, logs
Digital not deliveredPaid state, asset, token, file permission, worker
VPN not provisionedPlan, job, bridge/API, queue, retry/error
Queue stalledCron, PHP CLI path, lock, permissions, heartbeat
TOTP failsSync server and phone clocks; verify correct secret
Update rejectedManifest, min PHP, required version, checksum, write access, disk space
Restore failsDB privileges, disk, backup compatibility and logs

36. Maintenance

Daily: Health, queues, payment failures, stuck orders.

Weekly: off-server backup, low stock, audit, worker errors, disk space.

Before every release: staging update, backup/restore, checkout, webhook, workers, fulfillment and payment-callback tests.

37. Product and commerce field reference

GroupAvailable fields
IdentityName, Slug, SKU, Category, Status, Featured, Sort Order
ContentTitle/Description/Short Description, SEO Title, SEO Description, Post-purchase Message, Language
PricingPrice, Sale Price, Sale Start/End, Score, Market Price, Currency, Min Qty
InventoryStock, Stock Mode/Value, Low Stock Threshold, Allow Preorder, Warehouse
PhysicalRequires Shipping, Weight Grams, Shipping configuration
DigitalDigital File/Asset, Max Downloads, Download Expires Hours
VPNProtocol, Duration Days, Traffic GB, Device Limit, Provisioning Mode
SubscriptionEnabled, Default Months, Grace Days, Renewal Price 1m/3m/12m, Early Discount
VariantName, SKU, Attributes, Price, Stock, Status
ImagesImage/Image URL, Alt Text, Product Images

38. Runtime and Growth/Finance settings reference

SettingPurpose
affiliate_enabledEnable affiliate system
affiliate_default_commission_percentDefault commission
affiliate_approval_daysCommission approval delay
affiliate_minimum_payoutMinimum payout
affiliate_payout_modePayout mode
discount_engine_enabledDiscount engine
inventory_multiwarehouse_enabledMulti-warehouse inventory
subscription_enabledSubscriptions
subscription_early_renewal_daysEarly renewal window
invoice_enabledInvoices
invoice_prefixInvoice number prefix
invoice_seller_name/address/phone/tax_idSeller identity on invoice
invoice_tax_percentLegacy tax fallback; market Tax Engine rules take precedence when used
miniapp_enabledMini App

39. Mini App content settings

Mini App administration includes Enabled, Menu Button, Menu Text, featured products/order and slides. A slide may contain Title, Subtitle, Button Text, Link Type/Value, Image and Sort Order. Run sync after changes and verify the result inside the real Telegram client.

40. Secure Bridge setup

  1. Deploy the bridge on a separate HTTPS endpoint.
  2. Generate a strong random secret.
  3. Store bridge_url and bridge_secret in the integration.
  4. Add Merchant/Terminal ID where required.
  5. Test request, callback and verify in sandbox.
  6. Configure provider IP allowlists and SSL requirements.
Do not reuse the Bot Token as a bridge secret. Use a separate secret per integration.

41. VPS installation with systemd

  1. Install PHP CLI/MySQL and configure an HTTPS web server.
  2. Deploy to a path such as /var/www/ishoppingbot with correct service ownership.
  3. Run the web installer.
  4. Copy the example deploy/ishoppingbot-*-worker.service.example units and adjust paths/user.
  5. Run systemctl daemon-reload, enable and start the services.
  6. Verify with systemctl status and Health Center.