Authentication and environments
| Header | Requirement | Value / meaning |
|---|---|---|
| X-Api-Token | Required | ${API_TOKEN}: environment-specific token issued by TMS |
| X-Client-Source | Required | ${PARTNER_CODE}: partner code paired with the token |
| Content-Type | With a JSON body | application/json |
| Accept | Required by source | application/json |
| Accept-Language | Optional | vn, en, my, km, lo |
Contact TMS technical support for separate token/partner-code pairs for sandbox and production. Do not mix environments. The portal locale is vi, but the declared Accept-Language value is vn; several source examples use vi, so confirm provider behavior. Khmer, Lao, and Burmese have translated interfaces; missing document translations disclose the actual page language and fallback.
export BASE_URL="https://dev-gw.metfone.com.kh/tms-partner/api/v1"
# API_TOKEN and PARTNER_CODE must be supplied by your private environment.
# Never put production secrets into examples or AI prompts.Integration journey
- Load provinces, then districts/villages; retain current IDs/codes.
- Find a post office if branch drop-off/collection is needed.
- Discover services for the route and goods.
- Calculate prices for selected service codes.
- Create the order, resend moneyCollection, compare cod, and save the response.
- Create a template, then retrieve HTML before expiry.
- Receive webhooks, look up status as needed; cancel only when eligible.
View source
flowchart LR
A["Addresses"] --> B["Services"]
A --> P["Optional post office"]
B --> C["Pricing"]
C --> D["Order and COD"]
D --> E["Label template"]
E --> F["Printable HTML"]
D --> G["Journey webhooks"]
D --> H["Status lookup"]Request sequence
View source
sequenceDiagram
participant P as Partner
participant T as TMS Partner
P->>T: GET address levels 1, 2, 3
T-->>P: IDs and codes
P->>T: POST pricing/get-service
T-->>P: Service codes and selection flags
P->>T: POST pricing/get-all
T-->>P: Pre-VAT fee breakdown
P->>T: POST order with moneyCollection
T-->>P: id, cod, full creation response
P->>T: POST order/label/presigned
T-->>P: securePath, exp
P->>T: GET order/label/securePath
T-->>P: text/html
T->>P: POST status webhook
P-->>T: HTTP 200 receipt acknowledgement