Digital Value Services API (1.0.0)

Download OpenAPI specification:Download

Overview

Welcome to the Digital Value Services (DVS) API reference.

This API serves as the primary gateway to facilitate digital value transfers through Prism.

The Digital Value Services API is organized according to REST principles, using JSON as format for data interchange, and provides the following services:

Versioning

Endpoints of the API are prefixed with a corresponding version number.

This is done to provide complete isolation between implementations and to ensure that subsequent major changes to the API will never affect existing integrations.

When a new version of the API is available and you are keen to upgrade, testing in the sandbox environment to ensure that everything works well with your implementation before switching to the production environment comes highly recommended.

Transactions

The main purpose of this API is to deliver value (e.g. mobile airtime top-up, data bundles, etc.) to a beneficiary. This is what we call a "transaction".

During the course of a transfer, a transaction undergoes various status changes (or transitions) as illustrated below.

transaction states

As changes in transaction status occur, updates are sent in real-time when a callback URL is provided. In conjunction, transaction status can be queried through one of two means: via the returned id or a provided external_id.

The latter serves as your unique reference and provides a utility to retrieve transaction details when exceptions occur, such as when the supposed API response was not received, as an example.

Balances

Transactions can be created through the platform as long as there is enough balance available in your account. A given balance is composed of the following:

Balance Description
Available Balance amount available for use
Holding Amount being held while transactions are being processed

As a given transaction goes through various changes in status as outlined here, corresponding balance movements will be made. The following table illustrates the relationship between transaction status and balance movements:

Transaction Status Balance Movement Description
CREATED Authorize Transfer wholesale price and fee from available to holding
CANCELLED, REJECTED, DECLINED Void Amount authorized in holding moves back to available
COMPLETED Capture Amount authorized in holding is captured, i.e. debited
REVERSED Reverse Debited amount is reversed back into available

Flow

As soon as a transaction is confirmed, the transfer order will be sent to the operator for immediate processing. During this time, the transaction will remain in a CONFIRMED status until the final status is received from the operator.

Callbacks

As a transaction is being processed, changes in status will be notified in real-time if a callback URL was provided.

This callback endpoint must be implemented by the sending partner, which should expect an HTTP POST request containing a transaction object represented in JSON.

Upon successful receipt of data, the callback endpoint should respond with an HTTP 2XX status. In the event that the platform did not receive a successful status, callback notifications will be retried several times, beyond which, the transaction status will have to be queried through the API.

Status and Errors

HTTP Status Codes

Standard HTTP response codes are used to indicate whether an API request was successful or not.

Status Description
200 OK
201 Created: Resource created
202 Accepted: Request has been accepted for processing
400 Bad Request: Request was malformed
401 Unauthorized: Credentials missing or invalid
404 Not Found: Resource doesn't exist
500 Server Error: Error occurred on Prism

API Error Codes

Code Description
1000400 Bad Request
1000401 Unauthorized
1000404 Resource not found
1003001 Product is not available in your account
1003002 Requested product amount is out of range
1003003 Requested product unit is invalid
1003101 Benefits not defined for available products
1003201 Promotion not found
1005003 Credit party mobile number is invalid
1005004 Service not found
1005005 Country not found
1005006 Operator not found
1005503 Sender mobile number is invalid
1006001 Insufficient balance
1006003 Debit party mobile number is invalid
1006009 Account balance not found
1006503 Beneficiary mobile number is invalid
1007001 Transaction external ID has already been used
1007002 Transaction has already been confirmed
1007004 Transaction can no longer be confirmed
1007005 Transaction has already been cancelled
1007007 Transaction can no longer be cancelled
1007500 Method not supported by operator
1008004 Transaction not found
1009001 Unexpected error, please contact our support team

Transaction Status

Class Status Description
CREATED CREATED Created
CONFIRMED CONFIRMED Confirmed
REJECTED REJECTED Rejected
REJECTED REJECTED-INVALID-CREDIT-PARTY Rejected - Credit party is invalid
REJECTED REJECTED-BARRED-CREDIT-PARTY Rejected - Credit party is barred
REJECTED REJECTED-INELIGIBLE-CREDIT-PARTY Rejected - Credit party is ineligible for chosen product
REJECTED REJECTED-INVALID-DEBIT-PARTY Rejected - Debit party is invalid
REJECTED REJECTED-BARRED-DEBIT-PARTY Rejected - Debit party is barred
REJECTED REJECTED-OPERATOR-CURRENTLY-UNAVAILABLE Rejected - Operator currently unavailable
REJECTED REJECTED-INSUFFICIENT-BALANCE Rejected - Insufficient balance
CANCELLED CANCELLED Cancelled
SUBMITTED SUBMITTED Submitted
COMPLETED COMPLETED Completed
REVERSED REVERSED Reversed
DECLINED DECLINED Declined (no additional information available)
DECLINED DECLINED-INVALID-CREDIT-PARTY Declined - Credit party is invalid
DECLINED DECLINED-BARRED-CREDIT-PARTY Declined - Credit party is barred
DECLINED DECLINED-INELIGIBLE-CREDIT-PARTY Declined - Credit party is ineligible for chosen product
DECLINED DECLINED-INVALID-DEBIT-PARTY Declined - Debit party is invalid
DECLINED DECLINED-BARRED-DEBIT-PARTY Declined - Debit party is barred
DECLINED DECLINED-DUPLICATED-TRANSACTION Declined - Duplicated transaction
DECLINED DECLINED-OPERATOR-CURRENTLY-UNAVAILABLE Declined - Operator currently unavailable

REJECTED and DECLINED status classes both denote unsuccessful transactions. The primary distinction between these two relates to the party that determined the failure:

  • REJECTED are issued by the DVS platform based on various business rules (e.g. insufficient balance, limitations, etc)
  • DECLINED are issued by the operators

Separately, it is recommended to define application logic based on classes, while additional distinction and/or insight are reflected on the actual status.

Pagination

API resources supporting bulk fetches via "list" API methods will be returned in a paginated fashion.

Input Parameters

Field Required Type Description
page No Integer Page number
per_page No Integer Number of results per page (default 50, max 100)

Output Headers

Field Description
X-Total Total number of records
X-Total-Pages Total number of pages
X-Per-Page Number of records per page
X-Page Current page number
X-Next-Page Next page number (if any)
X-Prev-Page Previous page number (if any)

Authentication

BasicAuth

The Digital Value Services API requires requests to be authenticated through individualized API keys.

Your API keys carry many privileges, so please keep them secure! Do not share your secret API keys in publicly-accessible areas such as GitHub, client-side code, and so forth.

Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username value and your API secret as your password.

Except when site-to-site VPN is set up, all API requests must be made over HTTPS with TLS 1.2.

On a side note, we strongly recommend securing your applications against common security flaws by employing best practices such as the OWASP Top 10.

Security Scheme Type HTTP
HTTP Authorization Scheme basic

Services

The Digital Value Services platform provides access to various products across several industries. Such industries are termed as "services" in the Digital Value Services platform.

Service Examples
Topups Airtime Top Ups
Plans Mobile Data Bundles

Retrieve list of services

Authorizations:
query Parameters
page
integer <int32> >= 1
Default: 1

Page number

per_page
integer <int32> [ 1 .. 100 ]
Default: 50

Number of records per page

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Retrieve service by ID

Authorizations:
path Parameters
service_id
required
integer <int32> (ServiceID) >= 1

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "string"
}

Countries

Products are available across various geographical boundaries. These endpoints provide the means to enumerate available countries, which can then be used to filter against the list of available products in your account.

Retrieve list of countries

Authorizations:
query Parameters
page
integer <int32> >= 1
Default: 1

Page number

per_page
integer <int32> [ 1 .. 100 ]
Default: 50

Number of records per page

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Retrieve country by ISO code

Authorizations:
path Parameters
country_iso_code
required
string (ISO-3166-1_Alpha-3) ^[A-Z]{3}$

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "iso_code": "string",
  • "regions": [
    ]
}

Operators

Products in the Digital Value Services Platform are associated to individual service providers, termed as "operators".

Retrieve list of operators

Authorizations:
query Parameters
page
integer <int32> >= 1
Default: 1

Page number

per_page
integer <int32> [ 1 .. 100 ]
Default: 50

Number of records per page

country_iso_code
string (ISO-3166-1_Alpha-3) ^[A-Z]{3}$

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Retrieve operator by ID

Authorizations:
path Parameters
operator_id
required
integer <int32> (OperatorID) >= 1

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "string",
  • "country": {
    },
  • "regions": [
    ]
}

Benefits

Products ultimately redeem into one or more underlying benefits. These endpoints provide the means to enumerate available benefits, which can then be used to filter against the list of available products in your account.

Benefit Type Examples
TALKTIME Talktime Minutes
DATA Mobile Data, Broadband Data
SMS SMS, MMS
CREDITS Prepaid Credits

Retrieve list of benefit types

Authorizations:
query Parameters
page
integer <int32> >= 1
Default: 1

Page number

per_page
integer <int32> [ 1 .. 100 ]
Default: 50

Number of records per page

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Promotions

Receiving operators are running seasonal promotions on selected products, this endpoint will provide visiblity on these promotions: start date, end date, terms and conditions, eligible products, ...

Retrieve list of promotions

Authorizations:
query Parameters
page
integer <int32> >= 1
Default: 1

Page number

per_page
integer <int32> [ 1 .. 100 ]
Default: 50

Number of records per page

country_iso_code
string (ISO-3166-1_Alpha-3) ^[A-Z]{3}$
operator_id
integer <int32> (OperatorID) >= 1
product_id
integer <int32> (ProductID) >= 1

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Retrieve promotion by ID

Authorizations:
path Parameters
promotion_id
required
integer <int32> (PromotionID) >= 1

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "title": "string",
  • "description": "string",
  • "terms": "string",
  • "start_date": "2019-08-24T14:15:22Z",
  • "end_date": "2019-08-24T14:15:22Z",
  • "operator": {
    },
  • "products": [
    ]
}

Products

Products form the actual digital values and/or products being transferred through the Digital Value Services platform.

Product Type Description
FIXED_VALUE_RECHARGE Fixed denomination recharge
RANGED_VALUE_RECHARGE Recharge against a range of value
FIXED_VALUE_PIN_PURCHASE Digital voucher storing a fixed value
RANGED_VALUE_PIN_PURCHASE Digital voucher with a range of possible values

Products are organized and subdivided into distinct types as each one has distinct characteristics and technical implications when transactions are performed. As such, each product type also carries a distinct schema.

Retrieve list of products

Authorizations:
query Parameters
type
string (ProductTypes)
Enum: "FIXED_VALUE_RECHARGE" "RANGED_VALUE_RECHARGE" "FIXED_VALUE_PIN_PURCHASE" "RANGED_VALUE_PIN_PURCHASE"
service_id
integer
tags
Array of strings (ProductTag) non-empty unique
country_iso_code
string (ISO-3166-1_Alpha-3) ^[A-Z]{3}$
operator_id
integer
region
string (X-ISO-3166-2) ^[A-Z]{2}-[A-Z0-9]{2,3}(?:-[A-Z]{2})?$
benefit_types
Array of strings (BenefitTypes) unique
Items Enum: "TALKTIME" "DATA" "SMS" "CREDITS"
page
integer <int32> >= 1
Default: 1

Page number

per_page
integer <int32> [ 1 .. 100 ]
Default: 50

Number of records per page

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Retrieve product by ID

Authorizations:
path Parameters
product_id
required
integer <int32> (ProductID) >= 1

Responses

Response samples

Content type
application/json
Example
{
  • "id": 0,
  • "name": "string",
  • "description": "string",
  • "tags": [
    ],
  • "service": {
    },
  • "operator": {
    },
  • "regions": [
    ],
  • "type": "FIXED_VALUE_RECHARGE",
  • "validity": {
    },
  • "required_debit_party_identifier_fields": [
    ],
  • "required_credit_party_identifier_fields": [
    ],
  • "required_sender_fields": [
    ],
  • "required_beneficiary_fields": [
    ],
  • "required_statement_identifier_fields": [
    ],
  • "availability_zones": [
    ],
  • "source": {
    },
  • "destination": {
    },
  • "prices": {
    },
  • "rates": {
    },
  • "benefits": [
    ],
  • "promotions": [
    ]
}

Transactions

Create a transaction

Create a transaction. Note that the auto_confirm flag can be set to simultaneously create and confirm a transaction in one step (i.e. HTTP request).

Authorizations:
Request Body schema: application/json
external_id
required
string [ 1 .. 40 ] characters \S
product_id
required
integer <int32> >= 1
calculation_mode
string Nullable
Enum: "SOURCE_AMOUNT" "DESTINATION_AMOUNT"

Required when product type is either RANGED_VALUE_RECHARGE, or RANGED_VALUE_PIN_PURCHASE

object Nullable

Required for ranged value products and when calculation_mode is set to SOURCE_AMOUNT

object Nullable

Required for ranged value products and when calculation_mode is set to DESTINATION_MODE

auto_confirm
boolean
Default: false
object Nullable
object Nullable
object Nullable
object
object
callback_url
string <uri>

Responses

Request samples

Content type
application/json
{
  • "external_id": "string",
  • "product_id": 1,
  • "calculation_mode": "SOURCE_AMOUNT",
  • "source": {
    },
  • "destination": {
    },
  • "auto_confirm": false,
  • "sender": {
    },
  • "beneficiary": {
    },
  • "debit_party_identifier": {
    },
  • "credit_party_identifier": {
    },
  • "statement_identifier": {
    },
  • "callback_url": "http://example.com"
}

Response samples

Content type
application/json
{
  • "id": 0,
  • "external_id": "string",
  • "creation_date": "2019-08-24T14:15:22Z",
  • "confirmation_expiration_date": "2019-08-24T14:15:22Z",
  • "confirmation_date": "2019-08-24T14:15:22Z",
  • "status": {
    },
  • "operator_reference": "string",
  • "pin": {
    },
  • "product": {
    },
  • "prices": {
    },
  • "rates": {
    },
  • "benefits": [
    ],
  • "promotions": [
    ],
  • "requested_values": {
    },
  • "adjusted_values": {
    },
  • "sender": {
    },
  • "beneficiary": {
    },
  • "debit_party_identifier": {
    },
  • "credit_party_identifier": {
    },
  • "statement_identifier": {
    }
}

Query a transaction by ID

This endpoint will return the details of the requested transaction.

Authorizations:
path Parameters
transaction_id
required
integer <int64> (TransactionID) >= 1

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "external_id": "string",
  • "creation_date": "2019-08-24T14:15:22Z",
  • "confirmation_expiration_date": "2019-08-24T14:15:22Z",
  • "confirmation_date": "2019-08-24T14:15:22Z",
  • "status": {
    },
  • "operator_reference": "string",
  • "pin": {
    },
  • "product": {
    },
  • "prices": {
    },
  • "rates": {
    },
  • "benefits": [
    ],
  • "promotions": [
    ],
  • "requested_values": {
    },
  • "adjusted_values": {
    },
  • "sender": {
    },
  • "beneficiary": {
    },
  • "debit_party_identifier": {
    },
  • "credit_party_identifier": {
    },
  • "statement_identifier": {
    },
  • "callback_url": "http://example.com"
}

Query list of transactions

This endpoint will return a list of transactions matching the search criteria. Please note that when this endpoint is called without any parameters and/or if neither date ranges (i.e. from_date, to_date) nor external_id are specified, transactions created within the last 24 hours will be returned by default.

Authorizations:
query Parameters
external_id
string non-empty
product_type
string (ProductTypes)
Enum: "FIXED_VALUE_RECHARGE" "RANGED_VALUE_RECHARGE" "FIXED_VALUE_PIN_PURCHASE" "RANGED_VALUE_PIN_PURCHASE"
service_id
integer
country_iso_code
string (ISO-3166-1_Alpha-3) ^[A-Z]{3}$
operator_id
integer
status_id
integer
credit_party_mobile_number
string (E.164) ^\+[1-9][0-9]{6,14}$
credit_party_account_number
string (AccountNumber) [ 1 .. 64 ] characters \S
from_date
string <date-time>

Starting date to filter transactions based on creation date, inclusive of the provided date. Please note that the window between from_date and to_date can not exceed 24 hours.

to_date
string <date-time>

Ending date to filter transactions based on creation date, inclusive of the provided date. Please note that the window between from_date and to_date can not exceed 24 hours.

page
integer <int32> >= 1
Default: 1

Page number

per_page
integer <int32> [ 1 .. 100 ]
Default: 50

Number of records per page

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Confirm a transaction

If a transaction was created without setting the auto_confirm flag, this endpoint will have to be called to confirm the transaction. Once successfully confirmed, the transfer order will be submitted to the operator to be processed.

Please note that only unexpired transactions can be confirmed, as denoted in the confirmation_expiration_date field of the transaction. Beyond this, the only allowed change is to cancel the transaction, so as to release the held balance.

Authorizations:
path Parameters
transaction_id
required
integer <int64> (TransactionID) >= 1

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "external_id": "string",
  • "creation_date": "2019-08-24T14:15:22Z",
  • "confirmation_expiration_date": "2019-08-24T14:15:22Z",
  • "confirmation_date": "2019-08-24T14:15:22Z",
  • "status": {
    },
  • "operator_reference": "string",
  • "pin": {
    },
  • "product": {
    },
  • "prices": {
    },
  • "rates": {
    },
  • "benefits": [
    ],
  • "promotions": [
    ],
  • "requested_values": {
    },
  • "adjusted_values": {
    },
  • "sender": {
    },
  • "beneficiary": {
    },
  • "debit_party_identifier": {
    },
  • "credit_party_identifier": {
    },
  • "statement_identifier": {
    }
}

Cancel a transaction

If a transaction is still in the CREATED state, it has not yet been submitted to the receiving operator for processing. You can thus request to cancel such transactions by calling this endpoint.

Authorizations:
path Parameters
transaction_id
required
integer <int64> (TransactionID) >= 1

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "external_id": "string",
  • "creation_date": "2019-08-24T14:15:22Z",
  • "confirmation_expiration_date": "2019-08-24T14:15:22Z",
  • "confirmation_date": "2019-08-24T14:15:22Z",
  • "status": {
    },
  • "operator_reference": "string",
  • "pin": {
    },
  • "product": {
    },
  • "prices": {
    },
  • "rates": {
    },
  • "benefits": [
    ],
  • "promotions": [
    ],
  • "requested_values": {
    },
  • "adjusted_values": {
    },
  • "sender": {
    },
  • "beneficiary": {
    },
  • "debit_party_identifier": {
    },
  • "credit_party_identifier": {
    },
  • "statement_identifier": {
    }
}

Balances

This endpoint can be used to retrieve the status of all your balances in real time.

Note that transactions will only be accepted if you have enough funds on your account so it's important to keep an eye on it.

Retrieve balances

Authorizations:
query Parameters
unit_type
string (UnitTypes)
Value: "CURRENCY"
unit
string
page
integer <int32> >= 1
Default: 1

Page number

per_page
integer <int32> [ 1 .. 100 ]
Default: 50

Number of records per page

Responses

Response samples

Content type
application/json
[
  • {
    }
]