Countries
The country model : home country vs service country, and the public country catalogue.
OuiPay scopes every account and every operation to countries. Two distinct concepts exist, and conflating them is the most common integration bug:
| Concept | Set by | Decides |
|---|---|---|
| Home country | Account registration; locked | Default currency, jurisdiction, limits, home service catalogue |
| Service country | country / country_code per request | The catalogue, operators, plans, and rail a purchase runs on |
Home country is the customer's residency: it comes from the authenticated identity, never from request input. Service country is a per-transaction choice: the destination market for a service purchase.
Home services, cross-border by capability
The home catalogue (GET /v1/services?country=<home>) is always the
customer's home country. Cross-border purchase is an intentional, per-service
action gated by platform configuration and eligibility: a Benin account can
buy Nigerian airtime when airtime is enabled for cross-country use, without
the account becoming a Nigerian account.
Two error codes keep the distinction honest:
error.code | HTTP | Meaning |
|---|---|---|
SERVICE_COUNTRY_NOT_ELIGIBLE | 403 | This account may not buy services in the requested country |
SERVICE_UNAVAILABLE | 422 | The country is eligible but does not offer that service |
The country_context selector
Service definitions and
/availability return country_context: the server-resolved answer to "can
this customer pick another country for this service, and which ones".
{
"country_context": {
"home_country": { "code": "BJ", "name": "Benin" },
"selection": {
"mode": "selectable",
"can_select_other_country": true,
"enabled": true
},
"available_countries": [
{ "code": "BJ", "name": "Benin", "is_home_country": true },
{ "code": "NG", "name": "Nigeria", "is_home_country": false }
]
}
}| Field | Type | Notes |
|---|---|---|
selection.mode | string | home_country (locked) or selectable |
selection.can_select_other_country | boolean | Render a country picker only when true |
available_countries | array | The only countries this service accepts |
Branch on can_select_other_country, never on a capability flag. When the
mode is home_country, pass the home code as country on catalogue, quote,
and order calls.
The public country catalogue
The countries endpoints are unauthenticated and safe to call at boot: they carry the display and capability metadata clients need to render locale, currency, and feature surfaces.
| Method | Path | Description |
|---|---|---|
| GET | /v1/countries | Enabled countries |
| GET | /v1/countries/{code}/context | Boot context for one country |