Skip to main content
POST
/
api
/
v1
/
auth
/
merchants
/
with-sub-merchants
Create master merchant and sub-merchants in one call
curl --request POST \
  --url https://crypto.westminister.tech/api/v1/auth/merchants/with-sub-merchants \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "merchant": {
    "email": "merchant2@gmail.com",
    "phone_number": "+254700000021",
    "first_name": "John",
    "last_name": "Merchant Two",
    "password": "secret",
    "kyc_status": "approved",
    "is_active": true,
    "pin": "123456"
  },
  "sub_merchants": [
    {
      "email": "merchant2.branch1@gmail.com",
      "phone_number": "+254700000022",
      "first_name": "Bob",
      "last_name": "Branch One",
      "password": "secret",
      "kyc_status": "approved",
      "is_active": true,
      "pin": "654321"
    },
    {
      "email": "merchant2.branch2@gmail.com",
      "phone_number": "+254700000023",
      "first_name": "Carol",
      "last_name": "Branch Two",
      "password": "secret",
      "kyc_status": "approved",
      "is_active": true
    }
  ]
}
'
{
  "message": "Merchant and sub-merchants created successfully",
  "merchant": {
    "id": "62704522-04c8-4db6-8cf1-1255e884bd1e",
    "email": "merchant2@gmail.com",
    "phone_number": "+254700000021",
    "first_name": "John",
    "last_name": "Merchant Two",
    "role": "vendor",
    "kyc_status": "approved",
    "is_active": true,
    "parent_vendor_id": null
  },
  "merchant_wallets": [
    {
      "id": "01a60e92-3793-45c6-a27a-afab2958b107",
      "network": "ethereum",
      "address": 5.6437659633536495e+47,
      "is_default": true,
      "wallet_type": "hot"
    },
    {
      "id": "e0220e37-3d56-4ac3-8549-cca565236242",
      "network": "tron",
      "address": "TTmhiFeU5qooGQ6JhY4ifGzsmMrkqt8HZV",
      "is_default": false,
      "wallet_type": "hot"
    }
  ],
  "sub_merchants": [
    {
      "merchant": {
        "id": "95b426cc-5580-4545-835f-4c4ac0c3b751",
        "email": "merchant2.branch1@gmail.com",
        "phone_number": "+254700000022",
        "first_name": "Bob",
        "last_name": "Branch One",
        "role": "vendor",
        "kyc_status": "approved",
        "is_active": true,
        "parent_vendor_id": "62704522-04c8-4db6-8cf1-1255e884bd1e"
      },
      "wallets": [
        {
          "id": "d5a200f8-287f-46d4-84f9-734da9fe31b9",
          "network": "ethereum",
          "address": 5.709907295736517e+47,
          "is_default": true,
          "wallet_type": "hot"
        },
        {
          "id": "5c364855-01ef-461c-9356-d92cae6cf09a",
          "network": "tron",
          "address": "TGTbSMSvYz23i8LafRr4PiXCr2BJjELBps",
          "is_default": false,
          "wallet_type": "hot"
        }
      ]
    },
    {
      "merchant": {
        "id": "d514129a-14c1-4cb7-bded-b5ed4e6e87c5",
        "email": "merchant2.branch2@gmail.com",
        "phone_number": "+254700000023",
        "first_name": "Carol",
        "last_name": "Branch Two",
        "role": "vendor",
        "kyc_status": "approved",
        "is_active": true,
        "parent_vendor_id": "62704522-04c8-4db6-8cf1-1255e884bd1e"
      },
      "wallets": [
        {
          "id": "b01c4541-569d-44c9-a5bb-98690ee6170a",
          "network": "ethereum",
          "address": 1.1323842145198482e+48,
          "is_default": true,
          "wallet_type": "hot"
        },
        {
          "id": "4c8873e4-44af-456d-a0cf-b5151d0c5427",
          "network": "tron",
          "address": "TLhjr7rh95vy2MYy7ZHWf7SpecrKE38LfG",
          "is_default": false,
          "wallet_type": "hot"
        }
      ]
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
merchant
object
required
sub_merchants
object[]

Response

201 - application/json

Merchant and sub-merchants created

message
string
merchant
any
merchant_wallets
any[]
sub_merchants
any[]