Sub-Module 19.1

Mobile App Integration

Connect your iOS and Android applications to the Selfimart platform using our plug & play API credentials system. Generate credentials, configure your app, and start making API calls in minutes.

Quick Start Guide

1

Access Integration Dashboard

Log in to your dashboard and navigate to Integration > Mobile Apps. Here you will manage all your mobile app credentials.

2

Generate Credentials

Click "Generate New Credentials" to create a new API key/secret pair. Select your platform (iOS, Android, or All Platforms) and environment (Production, Staging, Development).

3

Configure Your Mobile App

Copy the API Key and API Secret to your mobile app configuration file. The Base URL should point to the API endpoint.

4

Initialize the SDK

Use the credentials to initialize the Selfimart SDK in your mobile app. The SDK handles authentication, token refresh, and API communication automatically.

5

Test the Connection

Make a test API call to verify the connection is working correctly. Check the Usage page in the dashboard to confirm requests are being logged.

JavaScript/React Native
// Initialize the Selfimart client
import SelfimartClient from '@selfimart/api-client';

const client = new SelfimartClient({
    apiKey: 'mobile_your_api_key_here',
    apiSecret: 'your_api_secret_here',
    baseUrl: 'https://selfimart.com/api/v1'
});

// User authentication
const login = async (email, password) => {
    const response = await client.login(email, password, 'mobile-app');
    // Token is automatically stored and used for subsequent requests
    return response;
};

// Browse products
const getProducts = async (categoryId) => {
    const response = await client.getProducts({
        category_id: categoryId,
        per_page: 20
    });
    return response.data;
};

// Add to cart
const addToCart = async (productId, quantity = 1) => {
    return await client.addToCart(productId, quantity);
};

// Place order
const placeOrder = async (orderData) => {
    return await client.createOrder({
        shipping_address_id: orderData.addressId,
        shipping_method: orderData.shippingMethod,
        payment_method: orderData.paymentMethod,
        notes: orderData.notes
    });
};

Sync Configuration

Offline Mode Support

The mobile SDK supports offline mode with automatic synchronization when connectivity is restored.

{
    "enable_offline_cache": true,
    "cache_expiry_hours": 24,
    "sync_on_reconnect": true,
    "conflict_resolution": "server_wins"
}

Push Notifications

Register for push notifications to receive order updates and promotional messages.

{
    "register_device_token": "\/api\/v1\/user\/device-token",
    "topics": [
        "orders",
        "promotions",
        "general"
    ]
}

Data Synchronization

Configure how data is synchronized between the mobile app and server.

{
    "sync_interval_seconds": 300,
    "sync_on_app_open": true,
    "sync_products": true,
    "sync_categories": true,
    "sync_user_data": true
}

Available API Endpoints

Products

Read
GET /api/v1/products
GET /api/v1/products/{id}
GET /api/v1/products/search

Cart

Read/Write
GET /api/v1/cart
POST /api/v1/cart/items
PUT /api/v1/cart/items/{id}

Orders

Read/Write
GET /api/v1/orders
GET /api/v1/orders/{id}
POST /api/v1/orders

Authentication

Auth
POST /api/v1/auth/login
POST /api/v1/auth/logout
POST /api/v1/auth/refresh

Ready to connect your mobile app?

Generate your API credentials and start integrating today.