Data Types
In this section we describe the data types and formats generally used by the Send Payments API.
JSON data types
Generally, when the Send Payments API requires a body
parameter within a request or when it returns a body
parameter in a response or Webhook outbound request, then the body is a JSON
object.
For requests (to Send, and from Send Webhooks to your Endpoints), when the Content-Type parameter is set to application/json and for responses to GET requests, the body parameter conforms to ECMA standard JSON which is limited to the JSON data types:
- string
- number
- JSON object
- array
- true
- false
Underlying data types
In addition to the JSON
data types, we provide the underlying data types that are contained within the JSON
data type, and formats for each JSON
object. In some cases, these aren’t data types in the strict sense but are descriptions of common formats.
e.g. we describe our unique identifiers as UUID
.
Where we have included a defined data type, e.g. String, then we have included the language (usually JavaScript) so you know the correct definition.
Where the specific key value has a length or format requirement that is different from the basic data types below, then we will provide this in the endpoint description.
Although not strictly enforced, the table below is a guide to the minimum and maximum sizes and formats that the data within the body parameter of a request or response is likely to take.
e.g. The JSON key named birthDate
is a string, but it has a generic underlying data type representing a date and is in the format “YYYY-MM-DD”.
"birthDate" : "1984-08-04"
JSON data type | Underlying data type | Min size | Max size | Format | Example |
---|---|---|---|---|---|
string | String (JavaScript) | 0 characters | 256 characters | Key value specific | "firstName" : "John" |
number | Integer64 (JavaScript) | 64 bit integer | Money is expressed in integers representing the lowest denomination of the currency. | 11 = $0.11 (11 cents), 111 = $1.11 (111 cents) | |
number | Number64 (JavaScript) | 64 bit double precision floating point | Key value specific | "rate" : 11.11111 | |
true or false | Boolean | Either the value “true” or the value “false” without quotes | "termsAndConditionsAccepted" : true | ||
string | Date (String) (JavaScript) | 10 characters | 10 characters | ISO - ISO 8601 — Date and time format YYYY-MM-DD | "birthDate" : "2017-07-21" |
string | Date-Time (String) (JavaScript) | 24 characters | 24 characters | ISO - ISO 8601 — Date and time format YYYY-MM-DDThh:mm:ss.sssZ Note the “.” separator indicating a fractional part for seconds i.e. milliseconds. We usually express Date-Times in UTC time, indicated by the “Z” character on the end of the format string. | "createdAt" : 2017-07-21T17:32:28.878Z |
string | UUID (String) (JavaScript) | 36 characters | 36 characters | The UUID format that we use is 36 characters in length and made up of 5 groups of hexadecimals with the following lengths: 8-4-4-4-12 RFC 4122 | 5e505642-9024-474d-9434-e5a44f505cc |
string | Enum (String) (JavaScript) | 1 character | 50 characters | Enum name: “EnumIdentityType” Enum allowed values: “drivers_license” “passport” "identityType" : "drivers_license" | |
string | Email (String) (JavaScript) | 3 characters | 254 characters | See RFC 3696 with errata rfc3696 | a@b |
string | Country codes (String) (JavaScript) | 2 characters | 2 characters | ISO - ISO 3166 — Country Codes | AU = Australia |
string | Currency codes (String) (JavaScript) | 3 characters | 3 characters | ISO - ISO 4217 — Currency codes | AUD = Australian Dollar |
string | Country calling codes (String) (JavaScript) | 2 characters | 5 characters | “+” character followed by up to 4 digits +xxxx LIST OF ITU-T RECOMMENDATION E.164 ASSIGNED COUNTRY CODES | +61 = Australia +64 = New Zealand |
string | Phone numbers (String) (JavaScript) | 3 characters | 15 characters | Up to 15 digits E.164 : The international public telecommunication numbering plan Sec 6.1 | 0295643823 |
Amount key value pairs
Denoting amounts in international currencies can be tricky because many have varying denominations f.e cents and dollars, or pennies and pounds. To ensure consistency throughout the API, amounts are always defined by a currencies lowest value denomination as a 64 bit integer.
Floating point data types are not used for amounts as some mathematical operations on floats can result in a loss of accuracy.
Note: floating point numbers are used for some key values such as rates, but not for currency amounts.
For dollar currencies (like $AUD), $110 and $0.15 would be represented as follows:
"amount": 11000,
"amount": 15
Some currencies (Like ¥JPY) have only one denomination. ¥110 would be represented as follows:
"amount": 110
Enumerations (Enums)
Some JSON objects must take one of a specific set of values exactly. We will tell you when a key value is an Enum so you'll know which values must be used. e.g. The JSON object named “identityType” is a JSON string, but it has an underlying data type which must be a value from a specific set of values i.e. it is an enumerated type or Enum.
Enum name: “EnumIdentityType”
Enum allowed values: “drivers_license”
, “passport”
You might use it like this:
{"identityType" : "drivers_license"}
or
{"identityType" : "passport"}
but any other value would cause and error (not the space character)
{"identityType" : "drivers license"}
Lists
In the Send Payments API documentation, Lists are reference data, similar to Enums. When we talk about Lists we mean it in the way you would use it in everyday English, we do not mean an ordered list of values as in the computer science definition. Some JSON objects must take one of a specific list of values exactly. We will tell you when a key value must be from a List.
Send Payments API Lists require key values to come from a specified list of values, however they differ from Enums in that they:
-
Are more likely to change over time.
- new values added, existing values removed.
- values activated or deactivated temporarily.
- e.g. Send Payments does not offer payments in certain currencies, however, Send Payments may at its discretion, enable or disable a currency in the future.
-
May be limited by agreement with a customer. The details of your agreement with Send Payments may mean that certain options are unavailable or are irrelevant to you.
- e.g. You may require access to certain currencies but not others.
-
Changes do not necessarily require a new version of the API.
Agreement level lists are shared with your organization as part of your agreement with Send Payments.
Not Seeing What You're Looking For?
We are always looking to improve our API documentation to ensure Sends systems are easy to understand and quick to build against. If you're struggling to find the answer to a question we either haven't made it easy enough to find the relevant docs or we haven't had a chance to write something up for it yet.
Either way we want to hear from you!
Head over to our Discussion Board and leave us a note. We keep a close eye on this and want to ensure we make these docs as useful as they can be so will jump on any posts quickly.
Updated 6 months ago