Top up a subscriber’s plan

This PUT operation tops up a subscriber’s plan by passing the unit type and amount in a JSON request. If successful, you receive an HTTP response code of 200.

See HTTP response codes for other response codes.

PUT /pcc/spcm/subscribers/<msisdn>/plans/<planId>/topup + JSON request payload


HEADER INFO

tenant: <tenantName>

authorisation: HTTP Basic Auth

content-type: application/json

permissions: SPCM_PLAN_UPDATE_PERMISSION

URL parameters

There are two mandatory parameters.

Parameter Type Description

msisdn

string

The subscriber’s MSISDN in international format.

planId

string

The unique plan identifier.

JSON request payload

The following example tops ups a plan by 25MB (JSON in bytes).

{
    "type": "volume",
    "amount": 250000000
}

Plan type descriptions

Field Type Description

planDefinition

integer

The plan definition information for the plan.

See plan definition type information more details on what to expect within the plan definition information you receive.

maxOccurenceCount

integer

Specifies the maximum number of times this plan can recur.

options
  • 0 = no limit

  • 1 = does not auto-renew

Any value from 2 and higher specifies the number of times the plan will recur.

id

string

The unique identifier for the plan.

state

enum

The current state of the plan in its lifecycle.

options
  • available = unit metering type is available for the plan

  • consumed = unit meter type is consumed for this plan

purchaseTimestamp

dateTime

The time at which the plan was purchased.

Format is ISO 8601.

activationTimestamp

dateTime

The time at which the plan was activated.

Format is ISO 8601.

expiryTimestamp

dateTime

The time at which the plan will expire.

Format is ISO 8601.

updateTimestamp

dateTime

The time at which the plan was updated.

Format is ISO 8601.

cancelled

boolean

Flag that indicates if the plan has been cancelled.

options
  • true = cancelled

  • false = not cancelled

usage

long

The plan’s current usage. The unit type is defined in unitMeteringType in the plan definition.

deactivationCount

short

The number of times the plan has been deactivated.

purchaseSource

string

Identifies the source of the plan purchase such as PMI.

allowedUnitAmount

string

The current allowed plan amount (taken into account rollover, accumulation, and pro-rated data/validity).

occurrenceCount

integer

The number of times the plan recurred.

usageState

enum

The current usage state of the plan.

options
  • available = unit metering type is available for the plan

  • consumed = unit meter type is consumed for this plan

parkedTimestamp

dateTime

The time when the plan was parked for the first time during the current renewal.

Format is ISO 8601.

parkedNextRetryTimestamp

dateTime

The time when the next retry will be made.

Format is ISO 8601.

boosterVolumeCount

short

The number of times the plan used the volume booster.

boosterValidityCount

short

The number of times the plan used the validity booster.

recipientPlan

boolean

Specifies if the plan was added to the subscriber (as a recipient) as part of a donation.

  • true = the plan was added as part of a donation

  • false = the plan was not added as part of a donation

Plan definition type descriptions

Field Type Description

id

integer

The unique identifier for the plan. This is assigned by the server upon creating a plan definition.

mandatory when updating a plan definition.

name

string (255)

The name of the plan definition.

mandatory when creating a plan definition.

unitAmount

string (255)

This tells you the number of units a plan definition provides. The unit type is defined in unitMeteringType.

mandatory when creating a plan definition.

unitMeteringType

enum

Defines the unit type. This can be time (seconds), volume (bytes), or credits (currency’s lowest denomination; for example a cent so 100 units equals $1).

mandatory when creating a plan definition.

cost

integer

The cost or purchasing the plan. Like unitMeteringType, the cost is in the lowest denomination of the currency (i.e., 1 cent so 100 units equals $1).

mandatory when creating a plan definition.

validityPeriod.validityPeriod

string (255)

A formatted string that displays for how long a plan definition exists. An example is 2days3hours2minutes.

mandatory when creating a plan definition.

validityPeriod.absoluteExpiryTime

string

Denotes the hour, minute, and second at which the plan will expire or renew.

NOTE: If not set, the plan will expire or renew relative to the purchase timestamp (timestamp + validity period). This format is hh:mm:ss.

precedence

integer

The precedence of the plan over other plans purchased by the subscriber where 0 is the highest precedence.

mandatory when creating a plan definition.

recurring

boolean

Denotes whether a plan is recurring or not where true is recurring and false is not.

mandatory when creating a plan definition.

core

boolean

Indicates if this plan is the core plan for the subscriber where true is the core plan and false is not.

mandatory when creating a plan definition.

summary

string (2048 char)

A brief summary describing the plan.

maxDeactivationCount

integer

The amount of times a plan definition can be deactivated.

maxOccurenceCount

integer

The maximum number of times a recurring plan can recur.

recycleRollOverLimit

integer

The maximum amount of unused data usage that can be carried forward when a plan is renewed.

mandatory when creating a plan definition.

accumulationPermitted

boolean

Indicates if accumulation is permitted where true is permitted and false is not.

mandatory when creating a plan definition.

dpsEnabled

boolean

Indicates whether DPS is enabled where true means DPS is enabled and false means it is not.

mandatory when creating a plan definition.

activateOnPurchase

boolean

Indicates if a plan is activated upon purchase where true means the plan is activated on purchase and false means it is not.

mandatory when creating a plan definition.

shared

boolean

Indicates if a plan is shared where true means it is shared and false means it is not shared.

mandatory when creating a plan definition.

version

integer

Denotes the version of the plan

mandatory when creating a plan definition.

shareQuotaMaxRecipients

integer

Specifies the maximum number of recipients with whom quota can be shared.

This is an optional field.

grantedAmount

integer

The chunk size that is granted to a data session. The session reports usage after using the granted amount.

The grantedAmount can be credit, volume, or time. This is determined by what is set in the unitMeteringType.

renewPlanOnConsumption

boolean

Specifies if the subscriber plan should renew on consumption

.options * true = plans renews on consumption * false = plan does not renew on consumption

HTTP response codes

Code Description

201/204

success!

If you receive a 204 code, you will not see a JSON response.

207

Multistatus response

Check out HTTP statuses for more details.
This is not applicable to all operations.

400

malformed request

401

unauthorised; bad username or password

403

forbidden; user does not have appropriate privileges

404

plan not found

409

conflict with target resource

This often occurs if the item already exists, such as a plan, group, or name.
This is not applicable to all operations.

412

failed validation; this typically means that a property was not set or a value is out of range.

example
HTTP 412
{
  "errors" : [
        {
          "field" : "name",
          "description" : "name is mandatory"
        }
    ]
}

422

failed processing (after passing validation).

example
HTTP 422
{
    "message": "Subscriber max plan count exceeded",
    "errorCode": 1
}

500

internal error

503

request rejected due to overload