List packages
Returns the one-time packages under a subscription service, with the price each will charge.
GET /api/sp/v1/dcb/purchase/packages?serviceId=<parent>
Why this endpoint exists
amount is prohibited on Issue OTP and
Verify and charge: the platform charges the package's own
tariff. So a price kept in your own configuration can show 300 and charge 500 the day a tariff
changes. The only safe price to put on a page is one read from here when the page loads.
Read it at page load, show it, never cache it. The value comes from the same field the charge reads, so what your page shows and what the subscriber pays cannot disagree unless something in between remembers an old number.
Request
| Parameter | Where | Notes |
|---|---|---|
serviceId | query | The parent subscription service. Your credential needs a grant on it. |
Grants are per service: a grant on the parent reads the menu; a grant on each package buys it.
Response
{
"requestId": "01JB2K9WQ4X7YH3M8N5P6R7T8V",
"code": "OK",
"data": {
"parentServiceId": 16,
"currency": "IQD",
"packages": [
{ "id": 20, "name": "LowFit Package 300", "tariff": 300, "currency": "IQD" },
{ "id": 21, "name": "LowFit Package 500", "tariff": 500, "currency": "IQD" }
]
}
}
| Field | Notes |
|---|---|
packages[].id | Use it as serviceId on Issue OTP and Verify. |
packages[].tariff | What Verify will charge. |
packages | Cheapest first. Empty when the parent has no approved, API-purchasable packages. |
What it does not tell you
Whether this subscriber may buy. The menu lists what exists; eligibility (an active subscription to the parent or to a service related to it, purchase limits) is decided when you issue the OTP, and again at verify. If the call fails, say prices are unavailable rather than showing an old list: a stale price shown confidently is worse than no price.
Standalone packages are not in this menu. A package can be configured with no parent service at all, which means anyone may buy it without holding any subscription. This endpoint lists the packages under a parent, so a standalone one appears under none. Use the service id you were given when the package was set up, or sell it by keyword.
Who may buy
| Package is configured with... | Who may buy it |
|---|---|
| a parent subscription service | anyone holding an active subscription to that parent, or to any service related to it |
| no parent | anyone |
"Related" means the services are grouped together in the platform, which is the same grouping that stops a subscriber holding two of them at once. So a subscriber who holds any one of a related set can buy a package configured against any other one: they were only ever allowed to hold one.