API Tạo Công ty
API tạo công ty mới trong hệ thống Bank Hub. Cho phép tạo công ty với tên và trạng thái ban đầu.
API Endpoint
POST
https://bankhub-api-sandbox.sepay.vn/v1/company/createRequest Body
full_namestringrequired
Tên đầy đủ của công ty
statusenumrequired
Trạng thái ban đầu của công ty
Lưu ý
- API này yêu cầu Bearer Token trong header Authorization
- Tên công ty phải là duy nhất trong phạm vi merchant
- Status nên được set là
Activekhi tạo để công ty có thể sử dụng ngay - Công ty sau khi tạo sẽ nhận được một
xidduy nhất (UUID format)
Xử lý lỗi
401UnauthorizedAccess token không hợp lệ hoặc đã hết hạn
400Validation ErrorDữ liệu đầu vào không hợp lệ (tên công ty trống, status không đúng, v.v.)
503Service UnavailableLỗi database
API Response
Response 201 - Tạo thành công
{
"code": 201,
"message": "string",
"data": {
"xid": "string",
"full_name": "string"
}
}codeinteger
Mã trạng thái HTTP
messagestring
Thông báo kết quả
dataobject
Dữ liệu công ty đã tạo
Code mẫu
1
2
3
4
5
curl --request POST \--url https://bankhub-api-sandbox.sepay.vn/v1/company/create \--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \--header 'content-type: application/json' \--data '{"full_name":"string","status":"Active"}'
Ví dụ sử dụng
JSTạo công ty mới với trạng thái Active
1
2
3
4
5
6
7
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/company/create' \--header 'Content-Type: application/json' \--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \--data '{"full_name": "Công ty TNHH ABC","status": "Active"}'
JSTạo công ty với trạng thái Pending (chưa sử dụng)
1
2
3
4
5
6
7
curl --location 'https://bankhub-api-sandbox.sepay.vn/v1/company/create' \--header 'Content-Type: application/json' \--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \--data '{"full_name": "Công ty TNHH XYZ","status": "Pending"}'
Lưu ý quan trọng
- Có thể lưu trữ company ID: Sau khi tạo, hãy lưu
xidđể sử dụng cho các API khác