^Login

Creating Microkeeper Account via API


This guide will explain how to create a Microkeeper account via the API.


This is only for Resellers of Microkeeper that have been whitelisted.



Complete a Hello World API call


Before starting this tutorial make sure you have completed the Hello World tutorial.




Creating and updating a Microkeeper accounts via API


Reseller Access

Step 1

In this scenario the reselling is doing the billing of Microkeeper and they are provisioning the Microkeeper account.

The reseller must include links to our Terms of use and Privacy Policy as part of the account provisioning process, with a checkbox sign process included.

They will need to store the returned mk_biz_key if they wish to utilise other API endpoints.

There is a vetting process to becoming a reseller.


Required Variables

Step 2

Set the mk_action variable and mk_data variable:


mk_action create_account

HTTP Method POST

mk_data

{"business_id":"abc123","bus_name":"Business name Pty Ltd","email":"test@gmail.com","abn":"95149280320"}


Since there is no Microkeeper account yet, the mk_biz_key must be set to that of the developer.

The API will check that the integrator has reseller rights with Microkeeper, if not an error will be returned.


mk_data Payload

Step 3


Field NameRequiredDescriptionFormatExampleNotes
business_idYesThis is your ID, it must be unique to each account in your databaseAlphanumeric and some special character up to 64 characters wjf2Ns4kj6e78a9s90dhfkhAksIf not present in Microkeeper this is used to create the account
If present in Microkeeper this is used to update the account
bus_nameYesBusiness NameAlphanumericABC Engineering Pty LtdThis is used to generate the username
emailYesEmail AddressEmail formattest@gmail.comEmail address must be verified before passing
abnYesAustralian Business NumberABN validation51 824 753 556If ABN is invalid API call will fail and error message returned
phonenoNoFor all non mobile numbersNumeric1800 000 111
mobileNoMobile phone numbersNumeric starting with 040411 222 333
noemployeesNoNumber of employeesInteger10Helpful for our sales and support staff to recommend modules
branchNoSTP Business branch codeInt with 2 leading 0s001
activeNoMake the account active (1)0 = Inactive
1 = Active
2 = Suspended
1The first time the account is create this value is set to 0 once the user logs in for the first time it changes to 1
This field can be used to suspended an account due to: billing issues or inactivity
super_freqNoHow often the Business processes superpay = Each Payrun
mth = Monthly
qtr = Quarterly
qtr
accountingNo

Possible options
xero
myob
comp (Companion Software)

max 4 char lowercasexeroIf unknown leave blank or exclude

If known but not listed as an option, you can still pass through in the allowed format
starting_dayNoStarting day of the payrun weeklowercase day of the week
monday,tuesday,etc
mondayUsed to create the primary pay cycle

Eg if monday pay cycles will be monday to sunday

No impact on monthly pay cycles, if unknown set to monday
tradingNoTrading name if different from Business NameAlphanumericABC Engineering
firstnameNoPrimary Contact of BusinessStringJohn
lastnameNoPrimary Contact of BusinessStringSmith
addressNoAddress of HQ - Line 1AlphanumericUnit 10
address2NoAddress of HQ - Line 2Alphanumeric1 Main St
cityNoAddress suburbAlphanumericBelmont
stateNoAustralian StateVIC, ACT, NSW, NT, QLD, SA, TAS, WA, OTHVICIf outside of Australia set the value to OTH
postcodeNoAustralia Post CodeInt to 4 chars3216
countryNoCountry2 char country code, ISO formatAUhttps://www.iban.com/country-codes



API Response

Step 4

If successful Microkeeper will response with the following fields in the data object:

Field NameDescriptionFormatExample
usernameMicrokeeper will generate this username from the bus_name you provide, it will be unique for all Microkeeper accounts.
We use this internally to help with support.
lowercase and underscoreabc_engineering
mk_biz_keyThis is used to access the data within the account going forwards32 digit keytt50SukqohfGwcwlyyxtPWOF390UXdBv
business_idThe business_id that was passed in, this should be compared to the original ID to make sure they match
If they do not match and the same business_id is used again, we could end up with duplicates.
Alphanumeric and some special character up to 32 charactersabc123
update0 = New account created
1 = Existing account updated
Boolean1


Example

JSON response:

{"success":1,"authenticated":1,"message":"Registration Successful","data":{"username":"abc_engineering","mk_biz_key":"tt50SukqohfGwcwlyyxtPWOF390UXdBv","business_id":"abc123","update":1}}


Same response as an array:

Array
(
    [success] => 1
    [authenticated] => 1
    [message] => Registration Successful
    [data] => Array
        (
            [username] => abc_engineering
            [mk_biz_key] => tt50SukqohfGwcwlyyxtPWOF390UXdBv
            [business_id] => abc123
           [update] => 1
        )
)



Things to Test

Step 5

  1. Make sure if the same business_id is passed multiples times only one account is created.
    The username returned should always be the same and update should be set to 0 on the first API call and 1 for each API call after that.

  2. If success is set to 0 then message is an error message and best practice would be to return this to the user.
    Example "ABN is not valid"

  3. Test a business name with special characters to make sure they are encoded correctly and not breaking the JSON.
    Microkeeper will sanitise this data, so it's likely some characters will be removed, but still pass validation.
    Example ABC ~!@#$%^&*()_+`1{{}|[]\:",./?>< PTY LTD

  4. If compromised a mk_biz_key will need to be replaced, so it should be possible to run the provisioning process again.




Adding a Bank account Via API

When provisioning an account you can add the business bank account.

This step is optional, bank accounts can also be managed in Microkeeper.

The account holder will still need to go through a verification process for the primary bank account before paying super.


Business Logic

  1. The BSB and Account Number are used to uniquely ID an account, if found it will be updated if not found it will be inserted.
  2. The Bank Account Nickname must be unique.
  3. The BSB is validated against an official list, more details below


Required Variables

Step 1

Set the mk_action variable and mk_data variable:


mk_action add_bank_details

HTTP Method POST

mk_data

{"bank_title":"Account 44","bank_BSB":"63504","bank_account_no":"4444444","bank_nickname":"ANZ","GID":"@all","bank_code":"ANZ","bank_APCA":"0","bank_note":"Wages"}


mk_data Payload

Step 3

Field NameRequiredDescriptionFormat, OptionsExample
bank_titleYesBank account TitleAlphanumeric, some special characters will be removed if incompatible with the ABA file standardsBusiness ABC
bank_BSBYesBank account BSBxxx-xxx or xxxxxx
Leading 0s are adding if missing
Must be a valid BSB number
63504 or 063504 or 063-504
bank_account_noYesBank account NumberNumeric12345679
bank_nicknameYesNickname Alphanumeric Must be uniquePrimary
Optional



GIDNoGroup ID@ID
Default @all
We do not recommend including this
@all
bank_codeNoCode from the Bank3 char upper case
Recommend else ABA file will fail
Full list below
ANZ
bank_APCANoNumber provided by the bank6 digit number, default to 000000 as not required by many banks000000
bank_noteNoNote that will appear on the bank statement when paying staffString, default is "Wages" 12 Char maxWages


List of all BSBs

http://bsb.apca.com.au/

This list of BSB is maintained, it's recommended to update your application on a periodic basis.

Example monthly for high volume or annually for low volume.


bank_code list


ANZ has some inconsistency between ANZ products, so workarounds need to be in place when generating the ABA file, AN2 and AN3 are converted to ANZ when the ABA file is created


bank_codeBank Name
AMPAMP Bank
ANZANZ - Business
AN2ANZ - Transactive
AN3ANZ - Transactive Global
ARAArab Bank Australia
MPBAuswide Bank
BAUBank Australia
BALBank of America
BOCBank of China Australia
BCYBank of Cyprus Australia
BOMBank of Melbourne
BOQBank of Queensland
BSABankSA
BWABankWest
BBLBendigo Bank
BYBBeyond Bank Australia
CTICitibank
CBACommonwealth Bank of Australia
CUACredit Union Aust Ltd
SGEG and C Mutual Bank
GBSGreater Building Society
HBAHSBC Bank Australia
IMBIllawarra Mutual Building Society
CUSIndue Ltd
INGING Bank
MBLMacquarie Bank
MEBMembers Equity Bank
CRUMyState Bank
NABNational Australia Bank
PIBRabobank Australia Limited
QTMRACQ Bank
RBAReserve Bank of Australia
STGSt George Bank
SCUSummerland Credit Union
METSuncorp-Metway
MSLTyro Payments Limited
UOBUnited Overseas Bank
WB2Westpac - Balance Line
WBCWestpac - No Balance Line

 

Responses

If bank account is not present it will be added:

{"success":"1","authenticated":"1","message":"Bank Details successful","data":{"BDID":"362","update":0}}

If a bank account is already present it will be updated:

{"success":"1","authenticated":"1","message":"Bank Details successful","data":{"BDID":"362","update":1}}


Failed response

{ "success":"0", "authenticated":"1", "message":"BSB not found" }


BDID = Bank Details ID

This can be used to assign a bank account when adding or updating an ABN or Pay Cycle.




Adding and updating an ABN via API

The ABN is used as a Primary key on a per account basis, if a record is found this will be updated if not found a new record will be inserted.


mk_action upsert_abn

HTTP Method POST

mk_data

{ "abn": "95149280320", "abn_name": "Business Pty Ltd", "abn_trading": "Trading Name", "abn_branch": "001", "abn_postcode": "2000", "abn_country": "Australia", "abn_email": "contact@business.com", "abn_phone": "0400111222", "abn_accounting": "xero", "hide": 0 } 


Field NameRequiredDescriptionFormatExampleDefault
abnYesThe Australian Business Number (ABN)
Validation will be performed on this field
This field is also the primary key
ABN95149280320NA
abn_nameNoThe name associated with the ABN50 Char StringBusiness Pty Ltd
abn_tradingNoThe trading name associated with the ABN50 Char StringTrading Name
abn_branchNoThe branch number of the ABN3 Char String001001
abn_postcodeNoThe postal code of the ABNPostcode2000
abn_countryNoThe country associated with the ABNStringAustraliaAustralia
abn_emailNoThe email associated with the ABN.Stringcontact@business.com
abn_phoneNoThe phone number associated with the ABN.String0400111222
abn_accountingNoThe accounting software used by the business for this ABNPossible options:
xero
myob
comp (Companion Software)
xero
abn_BDIDNoThe Bank Account ID used to process superKey ID of Microkeeper123450
hideNoA flag to hide or show the ABN recordBoolean
0 = not hidden
1 = hidden
00


Response Payload 

{"success":"1","authenticated":"1","message":"ABN added"}


Same response as an array

Array
(
    [success] => 1
    [authenticated] => 1
    [message] => ABN added
)


Logging

An API log entry is created for both "ABN updated" and "ABN added" events.




Update or insert a Pay Cycle via API

Action upsert_pay_cycle

HTTP Method POST

mk_data

{ "third_ID":"aaa111", "abn": "12345678901", "title":"Monthly", "wip": 12, "start_day": "monday", "arrears": 1, "access": 1, "hide": 0, "access_euser_ary": ["user1", "user2"], "euser_ary": ["user1", "user3"] } 


Business Logic


FieldTypeDescriptionChar LengthRequiredDefault ValueExample Value
Primary Key Options:





PCIDintPay Cycle ID11Yes, or third_ID
1001
third_IDstringExternal third-party ID32Yes, or
PCID

aaa111
Fields:





abnstringAustralian Business Number (ABN), validated.11Yes
12345678901
titlestringTitle of the pay cycle.10Yes
Monthly
wipintWeek In Period, Allowed:
1 = Weekly
2 = Fortnightly
12 = Monthly
24 = Semi-Monthly
2Yes
12
start_daystringDay the cycle starts. Onay affect weekly or fortnightly9Yes
monday
arrearsintIndicates if arrears apply Range:
-14 to +20
1No01
BDIDintThe Bank Account ID used to process staff wages
Key ID of Microkeeper
11No012345
accessintRestricts access
0 = All payroll officers can access
1 = Access required, requires Access List
Boolean No01
hideintHides the pay cycle (0 or 1).BooleanNo01
Access List Options:





access_euser_aryarrayArray of usernames for access control.
No
["user1", "user2"]
access_EID_listarrayArray of employee IDs for access control.
No
[1001,1002]
access_EmployeeID_listarrayArray of Employee IDs for access control, this is the third party system ID
No
[1,2,3]
User Staff List Options:





euser_aryarrayArray of staff IDs to add to the pay cycle.
No
["user1", "user2"]
EID_listarrayArray of employee IDs to add to the pay cycle.
No
[1001,2001]
EmployeeID_listarrayArray of Employee IDs to add to the pay cycle, this is the third party system ID 
No
[1,2,3]


Responses Payload

user_list 

access_user_list


{"data":{"access_user_list":["john_smith","alice_long"],"user_list":["john_smith","alice_long"],"PCID":"8","update":1},"success":"1","authenticated":"1","message":"Pay Cycle successful"} 


Same response as an array

Array
(
    [success] => 1
    [authenticated] => 1
    [message] => Pay Cycle successful
    [data] => Array
    (
        [access_user_list] => Array
        (
        [0] => john_smith
            [1] => alice_long
        )
        [user_list] => Array
        (
        [0] => john_smith
            [1] => alice_long
        )
        [PCID] => 8
        [update] => 1
    )
)


Logging

An API log entry is created for both "ABN updated" and "ABN added" events.