Get Credit Balance

Use a credit balance request to check your pre-paid balance with OpenMarket. This balance is per-brand.

The balance can go up as well as down. This is because OpenMarket deducts the value of the credit at the beginning of a transaction. If the credit to the end user fails, the balance is increased by the same amount.

Quick facts

Method

GET

Returns

Plain text

Available

United Kingdom

Prerequisites

You must have Crediting provisioned with OpenMarket.

More information

See Mobile Crediting Overview.

Try It Out

Once you're provisioned with an OpenMarket account, you can try out the operation using cURL.

Making a Request

Definition

GET https://credit.openmarket.com/credit/v1/remainingCredit?

Example with query parameter

https://credit.openmarket.com/credit/v1/remainingCredit?brand=acme

Query parameters

Parameters must be URL encoded.

Parameter

Description

brand

Pre-provisioned brand ID for accounts supporting multiple brands. Use this parameter to see the credit remaining for the specified brand.

Required: No

Default: The balance for your default brand is returned.

Header fields

You must provide your authentication details using Basic authentication in the header.

Example header

Authorization: Basic VXNlcm5hbWU6cGFzc3dvcmQ=

Field

Description

Authorization

Your account ID and password, separated by a colon, and then base64 encoded. Your account ID and password are case-sensitive. For help with Basic authentication see Authenticate with OpenMarket.

Response from OpenMarket

Accepted requests

OpenMarket responds to a successful request with an HTTP status code 200 and plain text in the response body. The format is:

currency,amount

In this response, currency is the three letter ISO 4217 currency code and amount is the current balance held, in thousandths of the specified currency.

In the following example, the balance is £10,000, 19 pence and 0.6 of a penny:

GBP,10000196

Rejected requests

If an error occurs, OpenMarket will return an 400-499 or 500-599 HTTP response code with a single line of text describing the error.

HTTP/1.1 403 Forbidden
Date: Fri, 20 May 2016 10:35:27 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
 
Invalid brand

See Response error messages below for a list of the possible error messages.

Testing your integration

OpenMarket provides an option for testing your integration with the production environment. See Testing Your Crediting Integration.

Troubleshooting

Unexpected characters in the response

If you receive unexpected characters in an HTTP response from OpenMarket, it may be because we are using "chunked" transfer coding, which is part of the HTTP 1.1 specification. These are normally stripped out by the browser or other transfer agent you are using. However, you may see these characters while connecting to OpenMarket via Telnet. You can ignore these characters if you see them.

Response error messages

When your system makes a request to OpenMarket, we indicates the outcome of the request in the HTTP response. The HTTP status code returned indicates the general outcome. If there is an issue with the request, then the body of the response will have a line of text describing the error.

HTTP status code

Description

500

Internal error

The request was accepted but a technical error occurred. Retry your request. If you continue to receive this response, then contact OpenMarket Support for further help.

403

Invalid brand