Skip to content

Subcompanies

Working with Subcompanies

We use subcompanies to allow aggregators to make transfers on behalf of their customers. When a subcompany is used, the subcompany's logo and name are displayed in the recipient's transaction history within the Djamo mobile app. You can create as many subcompanies as necessary, but only active ones can be used for transactions.

Here's how the transfer flow works with a subcompany:

  1. Create a subcompany.
  2. Use the subcompany's ID when submitting your transfer request.
  3. Done!

Managing subcompanies

Creating a subcompany

POST /v1/sub-companies

Parameters

Parameter Type Description
name String Subcompany name
logoUrl String Subcompany logo URL

Example

curl \
-X POST \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-type: application/json' \
-d '{
    "name": "Chocolate Factory",
    "logoUrl": "https://myapp.com/assets/chocolate-factory-logo.png"
}' \
<BASE_URL>/v1/sub-companies
{
"id": "subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231",
"createdAt": "2020-11-24T17:43:15.970Z",
"updatedAt": "2020-11-24T17:43:15.970Z",
"name": "Chocolate Factory",
"logoUrl": "https://myapp.com/assets/chocolate-factory-logo.png",
"isActive": true
}

Retrieving details about a subcompany

GET /v1/sub-companies/<id>

Example

curl \
-X GET \
-H 'Authorization: Bearer <API_KEY>' \
<BASE_URL>/v1/sub-companies/subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231
{
"id": "subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231",
"createdAt": "2020-11-24T17:43:15.970Z",
"updatedAt": "2020-11-24T17:43:15.970Z",
"name": "Chocolate Factory",
"logoUrl": "https://myapp.com/assets/chocolate-factory-logo.png",
"isActive": true
}

Retrieving the list of your subcompanies

GET /v1/sub-companies

Example

curl \
-X GET \
-H 'Authorization: Bearer <API_KEY>' \
<BASE_URL>/v1/sub-companies
{
    "count": 1,
    "limit": 15,
    "cursor": {
        "prev": null,
        "next": "bmV4dF9fXzE2Nzg4OTg4MzA2MjA="
    },
    "data": [
        {
          "id": "subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231",
          "createdAt": "2020-11-24T17:43:15.970Z",
          "updatedAt": "2020-11-24T17:43:15.970Z",
          "name": "Chocolate Factory",
          "logoUrl": "https://myapp.com/assets/chocolate-factory-logo.png",
          "isActive": true
        }
    ]
}

Updating a subcompany

PUT /v1/sub-companies/<id>

Note: You don't have to specify all the parameters when updating a subcompany, this endpoint effectively acts like a PATCH request.

Parameters

Parameter Type Description
name String Subcompany name
logoUrl String Subcompany logo URL
isActive Boolean Is this subcompany active or not?

Example

curl \
-X PUT \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-type: application/json' \
-d '{
    "name": "Swiss Chocolate Factory",
    "isActive": false
}' \
<BASE_URL>/v1/sub-companies/subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231
{
"id": "subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231",
"createdAt": "2020-11-24T17:43:15.970Z",
"updatedAt": "2020-11-24T17:43:15.970Z",
"name": "Chocolate Factory",
"logoUrl": "https://myapp.com/assets/chocolate-factory-logo.png",
"isActive": true
}

Deleting a subcompanies

You cannot delete a subcompany but you can deactivate it by updating the isActive parameter to false.

Making transactions on behalf of a subcompany

Sending money to one Djamo client on behalf of a subcompany

POST /v1/transactions

Parameter Type Description
amount Amount The amount charged for the transaction. Should be in the range of 5.000 - 500.000
msisdn Phone Number The msisdn of the Djamo client
reference String A reference that you indicate. Can be your internal ID for exemple.
type String The type of the transaction. At the moment, the only type allowed is transfer.
subCompanyId String The ID of subcompany to use for this transaction
curl \
-XPOST \
-H "Content-type: application/json" \
-H 'Authorization: Bearer <API_KEY>' \
-d '{
      "subCompanyId": "subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231",
      "msisdn": "+22507XXXXXX00",
      "amount": 50000,
      "reference": "17f99xApUe472A",
      "description": "Salaire de juin",
      "type": "transfer"
    }' \
<BASE_URL>/v1/transactions
{
  "id": "txn_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231",
  "createdAt": "2023-05-25T17:43:15.970Z",
  "updatedAt": "2023-05-25T17:43:15.970Z",
  "amount": 500000,
  "fee": 5000,
  "totalAmount": 505000,
  "status": "pending",
  "msisdn": "+22507XXXXXX00",
  "reference": "17f99xApUe472A",
  "description": "Prime de juin",
  "type": "transfer",
  "subCompanyId": "subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231"
}

Sending money to multiple Djamo clients on behalf of a subcompany

POST /v1/transactions/batch

Parameter Type Description
transactions Array A list of transaction parameters objects used in the endpoint to create a single transaction. See example below
subCompanyId String The ID of subcompany to use for this transaction

Example

curl \
-XPOST \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer <API_KEY>' \
-d '{
      "subCompanyId": "subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231",
      "transactions": [
        {
          "msisdn": "+22507XXXXXX00",
          "amount": 500000,
          "reference": "17f99xApUe472A",
          "description": "Prime de juin"
        },
        {
          "msisdn": "+22507XXXXXX01",
          "amount": 550000,
          "reference": "12E94bDeOP209T",
          "description": "Prime de juin"
        }
      ]
    }' \
<BASE_URL>/v1/transactions/batch
{
  "id": "bat_27fb25f4-3246-44c9-9f30-f0df3d9188cf",
  "createdAt": "2023-03-16T22:01:11.070Z",
  "updatedAt": "2023-03-16T22:01:11.269Z",
  "totalAmount": 8300,
  "status": "processing",
  "totalFee": 5,
  "subCompanyId": "subco_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231",
  "transactions": [
      {
        "id": "txn_2cdc8ab1-6d50-49cc-ba14-54e4ac7ec231",
        "createdAt": "2023-11-24T17:43:15.970Z",
        "updatedAt": "2023-11-24T17:43:15.970Z",
        "amount": 500000,
        "fee": 5000,
        "totalAmount": 505000,
        "status": "pending",
        "msisdn": "+22507XXXXXX00",
        "reference": "17f99xApUe472A",
        "description": "Prime de juin",
        "type": "transfer"
      },
      {
        "id": "txn_ae189ba6-0dc9-492a-9bde-ffdcf0decb0b",
        "createdAt": "2023-11-24T17:44:15.970Z",
        "updatedAt": "2023-11-24T17:44:15.970Z",
        "amount": 430000,
        "fee": 4300,
        "totalAmount": 434300,
        "status": "pending",
        "msisdn": "+22507XXXXXX01",
        "reference": "2E94bDeOP209T",
        "description": "Prime de juin",
        "type": "transfer"
      }
  ]
}