Skip to main content

Create Account

An account is a combination of a scheme and a company ID, and it is unique for every seller against each scheme they choose. When a seller installs an extension and subscribes to a scheme, this combination becomes an account. An account serves as a placeholder for the company ID, and all data related to serviceability, such as TAT, rate card, and capabilities, are stored against the scheme. For a given account, the DP needs to collect account credentials from the seller through the extension UI to verify and keep track of contracts, charges, and service usage by the seller.

The createCourierPartnerAccount FDK method creates a unique account for a seller against a specific scheme when the seller enables and configures an extension. This account is used to track contracts, service usage, and charges.

Get List of Created Schemes

Before creating an account, you need to retrieve the list of available schemes for the courier partner extension. The getCourierPartnerSchemes FDK method returns all schemes that have been created for a company, allowing developers to see which schemes are available before creating an account.

Request

The example below demonstrates how to retrieve all created schemes for a company.

basicRouter.get('/get_schemes', async function view(req, res, next) {
try {
const platformClient = await fdkExtension.getPlatformClient(companyId);
const response = await platformClient.serviceability.getCourierPartnerSchemes({
"companyId": 8948,
});
console.log(JSON.stringify(response))
res.json(response);
} catch (err) {
console.error(err);
console.log(JSON.stringify(err))
res.status(404).json({ success: false });
}
});

Response

The response returns a paginated list of schemes with their complete details, including scheme configuration, features, weight limits, transport type, region, delivery type, payment modes, and stage status.

{
"items": [
{
"extension_id": "6777d5612f3ce766efa51482",
"scheme_id": "Scheme_id_126",
"company_id": "8948",
"name": "Standard Delivery Scheme",
"weight": {
"gte": 0,
"lte": 5000
},
"volumetric_weight": {
"gte": 0,
"lte": 10000
},
"transport_type": "surface",
"region": "domestic",
"delivery_type": "standard",
"payment_mode": ["COD", "prepaid"],
"stage": "enabled",
"feature": {
"doorstep_qc": true,
"qr": true,
"ndr": true,
"ndr_attempts": 3,
"fragile_goods": true,
"doorstep_exchange": true,
"doorstep_return": true,
"openbox_delivery": true,
"status_updates": "real-time",
"ewaybill": true,
"qc_shipment_item_quantity": 5,
"non_qc_shipment_item_quantity": 10
},
"default_forward_pickup_cutoff": "18:00",
"default_reverse_pickup_cutoff": "16:00",
"default_cutoff_timezone": "Asia/Kolkata",
"default_tat": {
"enabled": true,
"tat": {
"min": 2,
"max": 5,
"unit": "days"
}
},
"created_by": {"id": "72ddedd773a2a3002223bf03"},
"created_on": "2025-01-03T12:17:37.147Z",
"modified_by": {"id": "72ddedd773a2a3002223bf03"},
"modified_on": "2025-01-09T05:58:18.765226"
}
],
"page": {
"item_total": 1,
"has_next": false,
"has_previous": false,
"current": 1,
"type": "number",
"size": 10,
"page_size": 10
}
}

Create Account

After retrieving the available schemes, you can create an account by selecting a specific scheme from the list. The account creation process links a company to a chosen scheme.

Request

In the example request below, an account is created for a seller (identified by companyId: 8948) linked to the specified scheme (scheme_id: Scheme_id_126). The account_id, a combination of the scheme and company ID, ensures the uniqueness of this seller-scheme pairing.

basicRouter.post('/create_seller_account', async function view(req, res, next) {
try {
const platformClient = await fdkExtension.getPlatformClient('66a0f176a257365a44f33d4c');
const response = await platformClient.serviceability.createCourierPartnerAccount({
"companyId": 8948,
"body": {
"extension_id": process.env.EXTENSION_API_KEY,
"account_id": "Scheme_id_126_company_id_8948",
"scheme_id": "Scheme_id_126",
"is_self_ship": false,
"stage": "enabled",
"is_own_account": true
}
});
console.log(JSON.stringify(response))
res.json(response);
} catch (err) {
console.error(err);
console.log(JSON.stringify(err))
res.status(404).json({ success: false });
}
});

Response

The response confirms the account creation by returning key details such as the account_id, scheme_id, and associated metadata like creation and modification timestamps. It also includes information about the developer who created and modified the account.

{
"extension_id": "6777d5612f3ce766efa51482",
"account_id": "Scheme_id_126_company_id_8948",
"scheme_id": "Scheme_id_126",
"is_self_ship": false,
"stage": "enabled",
"is_own_account": true,
}

Other useful APIs

Get Account List of a Company

This API is used to retrieve accounts of a company.

Update Account

This API is used to update account data.

Get Account Status of a Company

This API is used to retrieve account details of a company from the database.