Create Sub-Merchant Under A Master Merchant
curl --request POST \
--url https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "merchant1.branch1@gmail.com",
"phone_number": "+254700000002",
"first_name": "Bob",
"last_name": "Branch",
"password": "secret",
"kyc_status": "pending",
"is_active": true,
"pin": "654321"
}
'import requests
url = "https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants"
payload = {
"email": "merchant1.branch1@gmail.com",
"phone_number": "+254700000002",
"first_name": "Bob",
"last_name": "Branch",
"password": "secret",
"kyc_status": "pending",
"is_active": True,
"pin": "654321"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'merchant1.branch1@gmail.com',
phone_number: '+254700000002',
first_name: 'Bob',
last_name: 'Branch',
password: 'secret',
kyc_status: 'pending',
is_active: true,
pin: '654321'
})
};
fetch('https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'merchant1.branch1@gmail.com',
'phone_number' => '+254700000002',
'first_name' => 'Bob',
'last_name' => 'Branch',
'password' => 'secret',
'kyc_status' => 'pending',
'is_active' => true,
'pin' => '654321'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants"
payload := strings.NewReader("{\n \"email\": \"merchant1.branch1@gmail.com\",\n \"phone_number\": \"+254700000002\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch\",\n \"password\": \"secret\",\n \"kyc_status\": \"pending\",\n \"is_active\": true,\n \"pin\": \"654321\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"merchant1.branch1@gmail.com\",\n \"phone_number\": \"+254700000002\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch\",\n \"password\": \"secret\",\n \"kyc_status\": \"pending\",\n \"is_active\": true,\n \"pin\": \"654321\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"merchant1.branch1@gmail.com\",\n \"phone_number\": \"+254700000002\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch\",\n \"password\": \"secret\",\n \"kyc_status\": \"pending\",\n \"is_active\": true,\n \"pin\": \"654321\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Sub-merchant created successfully with default wallets",
"sub_merchant": {
"id": "f004fba4-7b6c-423a-983b-fdc283f8a1ab",
"email": "merchant1.branch1@gmail.com",
"phone_number": "+254700000002",
"first_name": "Bob",
"last_name": "Branch",
"role": "subvendor",
"kyc_status": "pending",
"is_active": true,
"parent_vendor_id": "a2aeca1d-9686-4158-b4be-d0a3fd04760e"
},
"wallets": [
{
"id": "74b2bdea-8cf1-4fbf-9b28-5c48a56bda6b",
"network": "ethereum",
"address": 1.4545186821318902e+47,
"is_default": true,
"wallet_type": "hot"
},
{
"id": "2f7e7c32-9623-4ca4-8733-fd07449bd6b8",
"network": "tron",
"address": "TXpgi7XLZEQQgC7pR1iKuRsKyesskZkEqM",
"is_default": false,
"wallet_type": "hot"
},
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"network": "solana",
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"is_default": false,
"wallet_type": "hot"
}
]
}{
"error": "phone_number is already registered"
}Merchants
Create Sub-Merchant Under A Master Merchant
Creates a sub-merchant whose parent_vendor_id points to the given master merchant.
- Master merchant must be a vendor with
parent_vendor_id = null - Sub-merchant user role is
subvendor(notvendor) - Sub-merchants also receive default Ethereum, TRON, and Solana wallets (best-effort)
- Returns 409 when email or phone_number conflicts. No sub-merchant row and no wallets are created.
POST
/
api
/
v1
/
auth
/
merchants
/
{merchant_id}
/
sub-merchants
Create Sub-Merchant Under A Master Merchant
curl --request POST \
--url https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "merchant1.branch1@gmail.com",
"phone_number": "+254700000002",
"first_name": "Bob",
"last_name": "Branch",
"password": "secret",
"kyc_status": "pending",
"is_active": true,
"pin": "654321"
}
'import requests
url = "https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants"
payload = {
"email": "merchant1.branch1@gmail.com",
"phone_number": "+254700000002",
"first_name": "Bob",
"last_name": "Branch",
"password": "secret",
"kyc_status": "pending",
"is_active": True,
"pin": "654321"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'merchant1.branch1@gmail.com',
phone_number: '+254700000002',
first_name: 'Bob',
last_name: 'Branch',
password: 'secret',
kyc_status: 'pending',
is_active: true,
pin: '654321'
})
};
fetch('https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'merchant1.branch1@gmail.com',
'phone_number' => '+254700000002',
'first_name' => 'Bob',
'last_name' => 'Branch',
'password' => 'secret',
'kyc_status' => 'pending',
'is_active' => true,
'pin' => '654321'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants"
payload := strings.NewReader("{\n \"email\": \"merchant1.branch1@gmail.com\",\n \"phone_number\": \"+254700000002\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch\",\n \"password\": \"secret\",\n \"kyc_status\": \"pending\",\n \"is_active\": true,\n \"pin\": \"654321\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"merchant1.branch1@gmail.com\",\n \"phone_number\": \"+254700000002\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch\",\n \"password\": \"secret\",\n \"kyc_status\": \"pending\",\n \"is_active\": true,\n \"pin\": \"654321\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://crypto.westminister.tech/api/v1/auth/merchants/{merchant_id}/sub-merchants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"merchant1.branch1@gmail.com\",\n \"phone_number\": \"+254700000002\",\n \"first_name\": \"Bob\",\n \"last_name\": \"Branch\",\n \"password\": \"secret\",\n \"kyc_status\": \"pending\",\n \"is_active\": true,\n \"pin\": \"654321\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Sub-merchant created successfully with default wallets",
"sub_merchant": {
"id": "f004fba4-7b6c-423a-983b-fdc283f8a1ab",
"email": "merchant1.branch1@gmail.com",
"phone_number": "+254700000002",
"first_name": "Bob",
"last_name": "Branch",
"role": "subvendor",
"kyc_status": "pending",
"is_active": true,
"parent_vendor_id": "a2aeca1d-9686-4158-b4be-d0a3fd04760e"
},
"wallets": [
{
"id": "74b2bdea-8cf1-4fbf-9b28-5c48a56bda6b",
"network": "ethereum",
"address": 1.4545186821318902e+47,
"is_default": true,
"wallet_type": "hot"
},
{
"id": "2f7e7c32-9623-4ca4-8733-fd07449bd6b8",
"network": "tron",
"address": "TXpgi7XLZEQQgC7pR1iKuRsKyesskZkEqM",
"is_default": false,
"wallet_type": "hot"
},
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"network": "solana",
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"is_default": false,
"wallet_type": "hot"
}
]
}{
"error": "phone_number is already registered"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Master merchant ID.
Body
application/json
Response
Sub-merchant created
⌘I