Skip to main content

Overview

The Store Operations API handles the complete store lifecycle including registration, updates, approval workflows, and wallet initialization. This system manages the onboarding process for new merchants and provides administrative tools for store management. Location: convex/stores/operations.ts

Store Lifecycle

1

Store Registration

Merchant registers their store with basic information and documents
2

Document Review

Admin reviews trade license and store information
3

Approval/Rejection

Admin approves or rejects the store application
4

Wallet Initialization

Approved stores get a wallet for payment processing
5

Store Goes Live

Store can start selling products to customers

Register Store

Register a new store for the authenticated user.
name
string
required
Store name for public display
primaryCategory
Id<'categories'>
required
Primary business category ID
logoId
Id<'_storage'>
Store logo image storage ID
coverImageId
Id<'_storage'>
Store cover/banner image storage ID
tradeLicenseId
Id<'_storage'>
required
Trade license document storage ID

Update Store

Update store information for the authenticated store owner.
name
string
Updated store name
primaryCategory
Id<'categories'>
Updated primary category
logoId
Id<'_storage'>
Updated store logo
coverImageId
Id<'_storage'>
Updated cover image
tradeLicenseId
Id<'_storage'>
Updated trade license
status
'pending' | 'approved' | 'rejected'
Store status (admin only)
statusReason
string
Status reason or notes
settings
object
Store operational settings including delivery, pickup, and live status
bankAccount
object
Bank account details for payouts
address
object
Store physical address and location details

Update Store Address

Update only the address information for the authenticated store owner.
fullAddress
string
Complete formatted address string
city
Id<'cities'>
City ID reference
area
Id<'areas'>
Area/district ID reference
flatVilaNumber
string
Flat or villa number
buildingNameNumber
string
Building name or number
landmark
string
Nearby landmark for easier location
latitude
string
GPS latitude coordinate
longitude
string
GPS longitude coordinate

Approve Store (Admin)

Admin function to approve a store application and initialize its wallet.
storeId
Id<'stores'>
required
Store ID to approve
statusReason
string
Reason for approval (optional)

Reject Store (Admin)

Admin function to reject a store application.
storeId
Id<'stores'>
required
Store ID to reject
rejectionReason
string
required
Detailed reason for rejection

Initialize Store Wallet

Initialize wallet for an existing approved store.
storeId
Id<'stores'>
required
Store ID to initialize wallet for

Bulk Initialize Wallets (Admin)

Admin function to bulk initialize wallets for all approved stores without wallets.

Store Registration Form

Complete store registration component:

Store Status Management

Store applications go through several status states:

Pending

Initial status when store is registered. Awaiting admin review.

Under Review

Admin is actively reviewing documents and store information.

Approved

Store is approved and can start selling. Wallet is automatically initialized.

Rejected

Store application rejected. Reason provided for resubmission.

Admin Review Process

For administrators reviewing store applications:

Error Handling

Status Code: 400
Status Code: 404
Status Code: 400
Status Code: 404
Store registration requires a valid trade license document. The approval process typically takes 24-48 hours for document verification.
Upload high-quality images for better store presentation. Square logos (200x200px minimum) and banner cover images (1200x400px) work best.