Subscription Lifecycle
A Subscription represents a plan linked to a SIM profile. Below are all the possible states for a Subscriptions and an example request/response to the subscriptions endpoint to consult that state.
Status | Description |
---|---|
PENDING | not active yet, usually because the activation date was defined in the future |
PENDING_USAGE | not active yet, meaning its a first usage activation that hasn't had any consumption yet |
ACTIVE | currently active, meaning with remaining allowance and not expired yet |
DEPLETED | no remaining allowance in the subscription |
EXPIRED | subscription passed its expiration date |
Example Request​
curl -X GET \
https://services.truphone.com/connect-api/v2/subscriptions?iccid=8944474600000109251/ \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-H 'X-Correlation-ID: unique-id-from-requester-123'
Example Response​
{
"data": [
{
"id": "__bPIjtY8e5xdjn36DwUCwslKkZABh1D2HzyaZdpdTg=",
"name": "5GB 30-Day Data Bundle",
"sim_id": "8944474600000109251",
"product_id": "TKC_FxWr_7x8_pJ588uNZFmFYl4e0766ATK41klpw_gO4=",
"created_date": "2020-12-04T17:20:38Z",
"activation_date": "2020-12-04T17:22:38Z",
"expiry_date": "2021-12-04T17:20:38Z",
"status": "ACTIVE",
"initial_balance": 1073741824,
"current_balance": 1073741824,
"spend_balance": 0,
"balance_units": "Bytes",
"_metadata": {
"links": {
"_activate": "{BASE_URL}/v2/subscriptions/__bPIjtY8e5xdjn36DwUCwslKkZABh1D2HzyaZdpdTg=/activate",
"_sim": "{BASE_URL}/v2/sims/8944474600000109251",
"_self": "{BASE_URL}/v2/subscriptions/__bPIjtY8e5xdjn36DwUCwslKkZABh1D2HzyaZdpdTg=",
"_product": "{BASE_URL}/v2/products/TKC_FxWr_7x8_pJ588uNZFmFYl4e0766ATK41klpw_gO4="
}
}
}
],
"_metadata": {
"page": 1,
"page_size": 1,
"page_count": 1,
"links": {
"_self": "/v2/subscriptions?page=1&page_size=1",
"_next": "/v2/subscriptions?page=2&page_size=1"
}
}
}