Client library for Accounts API
npm install --save @datafire/whapi_accounts
let whapi_accounts = require('@datafire/whapi_accounts').create();
.then(data => {
console.log(data);
});
The Accounts API is a collection of methods used to query a customer account. It allows the developer to retrieve account-related data such as the user account balance. It should be noted that regional variations may exist - so some fields may not be returned for certain territories.
Retrieves a limited set of customer account details. For security purposes, only a subset is supplied, which does not include fields such as security questions and answers.
whapi_accounts.getDetails({
"apiKey": "",
"apiSecret": "",
"apiTicket": ""
}, context)
- input
object
- apiKey required
string
: A unique identifier of your application that is generated by the API portal. - apiSecret required
string
: Another unique identifier for your application. - apiTicket required
string
: Ticket Granting Ticket obtained from a previous request - fields
array
: Specify an absolute field list to return (Comma-Separated List) - include
array
: Specify fields in addition to the default to return (Comma-Separated List) - exclude
array
: Specify fields from the default to exclude (Comma-Separated List) - territory
string
: Territory from which request originates - languageAsPerTerritory
string
: Defines response field name language, true (default) returns in language defined by territory, false returns in English
- apiKey required
- output accounts
This method can be used to retrieve the customer’s account balance in UK Sterling.
whapi_accounts.getBalance({
"apiKey": "",
"apiSecret": "",
"apiTicket": ""
}, context)
- input
object
- apiKey required
string
: A unique identifier of your application that is generated by the API portal. - apiSecret required
string
: Another unique identifier for your application. - apiTicket required
string
: Ticket Granting Ticket obtained from a previous request - fields
array
: Specify an absolute field list to return (Comma-Separated List) - include
array
: Specify fields in addition to the default to return (Comma-Separated List) - exclude
array
: Specify fields from the default to exclude (Comma-Separated List) - territory
string
: Territory from which request originates - languageAsPerTerritory
string
: Defines response field name language, true (default) returns in language defined by territory, false returns in English
- apiKey required
- output accountBalance
Sets a flag based on name to value provided for the user.
whapi_accounts.setAccountFlags({
"apiKey": "",
"apiSecret": "",
"apiTicket": "",
"flags": []
}, context)
- input
object
- apiKey required
string
: A unique identifier of your application that is generated by the API portal. - apiSecret required
string
: Another unique identifier for your application. - apiTicket required
string
: Ticket Granting Ticket obtained from a previous request - apiCountryCode
string
: A two-character ISO 3166-1-Alpha-2 code representing the country API to use. - territory
string
: Territory from which request originates - languageAsPerTerritory
string
: Defines response field name language, true (default) returns in language defined by territory, false returns in English - flags required flags
- apiKey required
- output accountFlagsSet
Retrieves the customer’s account payments in UK Sterling.
whapi_accounts.getPayments({
"apiKey": "",
"apiSecret": "",
"apiTicket": ""
}, context)
- input
object
- apiKey required
string
: A unique identifier of your application that is generated by the API portal. - apiSecret required
string
: Another unique identifier for your application. - apiTicket required
string
: Ticket Granting Ticket obtained from a previous request - page
number
: The page number to return (Used with pageSize) - pageSize
number
: Specify the number of results to return per page. - dateFrom
string
: The FROM datetime from payments to be returned. (yyyy-MM-ddTHH:mm:ss) - dateTo
string
: The TO datetime for payments to be returned. (yyyy-MM-ddTHH:mm:ss) - sort
string
: The order the response will be retuned by. i.e. date,desc - transactionType
string
: Allows the user to select with they want to see withdrawls or deposits. If it is omitted from the query both types will be returned - fields
array
: Specify an absolute field list to return (Comma-Separated List) - include
array
: Specify fields in addition to the default to return (Comma-Separated List) - exclude
array
: Specify fields from the default to exclude (Comma-Separated List) - territory
string
: Territory from which request originates - languageAsPerTerritory
string
: Defines response field name language, true (default) returns in language defined by territory, false returns in English
- apiKey required
- output getPayments
Gets a customer's plus card details if they exist.
whapi_accounts.getPlusCardDetails({
"apiKey": "",
"apiSecret": "",
"apiTicket": ""
}, context)
- input
object
- apiKey required
string
: A unique identifier of your application that is generated by the API portal. - apiSecret required
string
: Another unique identifier for your application. - apiTicket required
string
: Ticket Granting Ticket obtained from a previous request - fields
array
: Specify an absolute field list to return (Comma-Separated List) - include
array
: Specify fields in addition to the default to return (Comma-Separated List) - exclude
array
: Specify fields from the default to exclude (Comma-Separated List)
- apiKey required
- output plusCardDetails
Sets a customer's plus card as Lost/Stolen
whapi_accounts.setLostStolen({
"apiKey": "",
"apiSecret": "",
"apiTicket": ""
}, context)
- input
object
- apiKey required
string
: A unique identifier of your application that is generated by the API portal. - apiSecret required
string
: Another unique identifier for your application. - apiTicket required
string
: Ticket Granting Ticket obtained from a previous request
- apiKey required
Output schema unknown
Sets a customer's plus card phone number
whapi_accounts.setPhoneNumber({
"apiKey": "",
"apiSecret": "",
"apiTicket": "",
"oldPhoneNumber": "",
"phoneNumber": {}
}, context)
- input
object
- apiKey required
string
: A unique identifier of your application that is generated by the API portal. - apiSecret required
string
: Another unique identifier for your application. - apiTicket required
string
: Ticket Granting Ticket obtained from a previous request - oldPhoneNumber required
string
: Old phone number to replace - phoneNumber required phone
- apiKey required
Output schema unknown
Sets a customer's plus card pin
whapi_accounts.setPin({
"apiKey": "",
"apiSecret": "",
"apiTicket": "",
"pin": 0
}, context)
- input
object
- apiKey required
string
: A unique identifier of your application that is generated by the API portal. - apiSecret required
string
: Another unique identifier for your application. - apiTicket required
string
: Ticket Granting Ticket obtained from a previous request - pin required pin
- apiKey required
Output schema unknown
Updates a customer's plus card pin
whapi_accounts.updatePin({
"apiKey": "",
"apiSecret": "",
"apiTicket": "",
"pin": 0
}, context)
- input
object
- apiKey required
string
: A unique identifier of your application that is generated by the API portal. - apiSecret required
string
: Another unique identifier for your application. - apiTicket required
string
: Ticket Granting Ticket obtained from a previous request - pin required pin
- apiKey required
Output schema unknown
- accountBalance
object
- availableFunds
number
: Current available funds in this account - balance required
number
: Current balance of account - currencyCode required
string
: A three-character ISO4217 currency code. This will be the currency that the user registered in - withdrawableFunds
number
: Current withdrawable balance of this account
- availableFunds
- accountErrors
object
- errors
array
- items error
- errors
- accountFlagsSet
object
- token
string
- token
- accounts
object
- accountId
string
: Account ID - accountNum required
string
: Account number - city
string
: The city of the customer's address - contactable
boolean
: Is it okay for the bookmaker to contact the customer with marketing information - country
string
: The country of the customer's address - countryCode
string
: A two-character ISO 3166-1-Alpha-2 code representing the customer's country of registration - county
string
: The county of the customer's address - currencyCode
string
: A three-character ISO4217 currency code. This will be the currency that the customer registered in - customerId
string
: Customer ID - email
string
: The primary email address of the customer with that account. Must be unique. - firstName required
string
: The first name of the customer with that account - flags flags
- lastName required
string
: The last name of the customer with that account - mobile
string
: The mobile number of the customer with that account - partnerContactable
boolean
: Is it okay for the bookmaker to give the user's contact details to companies with which it has partnerships - postcode
string
: The postCode of the customer's address - status required
string
: Account status - street1
string
: Line number 1 of the customer's street address written out in full - street2
string
: Line number 2 of the customer's street address written out in full - street3
string
: Line number 3 of the customer's street address written out in full - title
string
: The title of the name of the customer with that account
- accountId
- error
object
- code
string
: A unique William Hill identifier for the error - field
string
: To help pinpoint the exact parameter where a request has failed - message
string
: A unique William Hill text string to enable you to identify the error (in English only)
- code
- flags
array
- items
object
- flagName required
string
: Name of the flag to set. - flagReason
string
: The reason that the flag has been set. - flagValue required
string
: Value to set the flag to.
- flagName required
- items
- getPayments
object
- payments
array
- items payment
- payments
- onlineAccount
object
: Online Account- name
string
- onlineAccountNumber
string
- name
- payment
object
- action required
string
: Action of the payment (D = Deposit, W = withdrawal) - amount required
number
: The amount of the payment - channel
string
: The channel through which the payment was made - commision
number
: The commision for the payment - id required
string
: ID of the payment - ipAddress
string
: The IP address from which the payment was made - methodId
string
: ID of the payment method - paymentDateTime required
string
: The date and time when the payment was made - status required
string
: The status of the payment - type
string
: Type of the payment
- action required
- phone
object
: Phone Number- phoneNumber
string
- phoneNumber
- pin
number
- pinStatus
object
: PIN object - if this object is not returned in plusCardDetails object then it has not been set.- attemptsRemaining
number
- blocked
boolean
- attemptsRemaining
- plusCard
object
: Plus Card- blocked
boolean
- cardNumber
string
- blocked
- plusCardDetails
object
: Plus Card Details and linked accounts- card plusCard
- onlineAccount onlineAccount
- phone phone
- pin pinStatus
- retailAccount retailAccount
- retailAccount
object
: Retail Account- selfExcluded
boolean
- selfExcluded