InPay provides a REST Web Service Interface that allows two-way flow of information to external systems. This enables automated and efficient transfer of data to and from your other systems reducing effort and duplication.
If you wish to know the commercials or costs involved in using Web Services then please contact the Client Account Management team. If you would like to enable the use of Web Services please contact our Support team and an estimate will be raised. It will need to be enabled on your system and a set of credentials for accessing the service will be supplied.
The full technical https://inpay.es.rsmuk.com/WebServicesREST/Help
Scenarios and uses
This section describes various scenarios of how the Web Services can be used.
Authentication
Before you can call any other InPay Web Service method you must first call the authenticate() method. Providing valid credentials to this method will return an authentication token that must be provided with all other Web Service calls.
Data Retrieval (Read operations)
There are a number of methods that enable you to read back the full details of an entity. Examples are api/Person/{employeeNo} where providing the correct employee number will return the full Person object and api/Payment/{employeeNo} which will return all the permanent payments in the system for an employee
Data Creation (Write Operations)
It is now possible to create data in InPay via the Web Services. This includes the following the person entity and many of the entities related to the worker (for example pension and absence records)
C# Code
Authenticate
private string Authenticate() { string token = null; if (String.IsNullOrEmpty(username.Text) || String.IsNullOrEmpty(password.Text) || String.IsNullOrEmpty(companyID.Text)) { return "Credentials missing"; } FormUrlEncodedContent content = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("grant_type", "password"), }); var request = new HttpRequestMessage(HttpMethod.Post, restURL.Text + "token"); HttpResponseMessage response = client.PostAsync(restURL.Text + "token", content).Result; { Task<Object> res = response.Content.ReadAsAsync<Object>(); Newtonsoft.Json.Linq.JObject jObj = (Newtonsoft.Json.Linq.JObject)res.Result; } else { Console.WriteLine("Auth Was not successful: " + response.StatusCode); } response.Dispose(); } |
---|
Retrieve a Worker
private void GetPerson() try { if (String.IsNullOrEmpty(token)) { output.Text = output.Text + "\r\nAuthentication failed "; } else { output.Text = output.Text + "\r\nAuthenticated: " + token.ToString(); Object person = null; output.Text = output.Text + "\r\nDoing GET from URL: " + url; if (response2.IsSuccessStatusCode) { Task<Object> res2 = response2.Content.ReadAsAsync<Object>(); var results = JObject.Parse(res2.Result.ToString()); { Console.WriteLine("GET Person was not successful: " + results["message"]); } else { var personDetails = results.Value<JObject>("Person").Properties(); var addressDetails = results.Value<JObject>("AddressDetail").Properties(); var employmentDetails = results.Value<JObject>("EmploymentDetail").Properties(); var NIDetails = results.Value<JObject>("NIDetail").Properties(); { var paymentDetails = results.Value<JObject>("PaymentDetail").Properties(); } else { paymentDict = null; } Dictionary<string, string> starterStatementDict; { var starterStatmentDetails = results.Value<JObject>("StarterStatementDetail").Properties(); } else { starterStatementDict = null; } Dictionary<string, string> p45Dict; var p45Details = results.Value<JObject>("P45Detail").Properties(); } p45Dict = null; } var taxDetails = results.Value<JObject>("TaxDetail").Properties(); } taxDict = null; } if (personDict["EmployeeNumber"] != null) employeeNumber.Text = personDict["EmployeeNumber"]; if (Boolean.Parse(personDict["PayslipNotification"])) payslipNotification.CheckState = CheckState.Checked; } payslipNotification.CheckState = CheckState.Unchecked; } } if (Boolean.Parse(personDict["SMSPayslipNotification"])) smsPayslipNotification.CheckState = CheckState.Checked; } smsPayslipNotification.CheckState = CheckState.Unchecked; } } if (personDict["PostponeDate"] != null && personDict["PostponeDate"] != "") postponeDate.CustomFormat = "yyyy/MM/dd"; } postponeDate.CustomFormat = " "; }
} optOutDate.CustomFormat = " "; } addressDate.CustomFormat = "yyyy/MM/dd"; } addressDate.CustomFormat = " "; } if (addressDict["AddressLine1"] != null) addressLine1.Text = addressDict["AddressLine1"]; if (employmentDict["DateOfJoining"] != null) dateOfJoining.Text = employmentDict["DateOfJoining"]; if (Boolean.Parse(employmentDict["IrregularPayments"])) irregularPayments.CheckState = CheckState.Checked; } irregularPayments.CheckState = CheckState.Unchecked; } } if (Boolean.Parse(employmentDict["OffPayrollWorker"])) offPayrollWorker.CheckState = CheckState.Checked; } offPayrollWorker.CheckState = CheckState.Unchecked; } } if (employmentDict["Apprentice"] != null) if (Boolean.TryParse(employmentDict["Apprentice"], out bool apprentice)) if (apprentice) Apprentice.CheckState = CheckState.Checked; } else { Apprentice.CheckState = CheckState.Unchecked; } Apprentice.CheckState = CheckState.Unchecked; } } if (employmentDict["JobTitle"] != null) strtJobTitle.Text = employmentDict["JobTitle"]; if (employmentDict["ContractedHours"] != null) contractedHours.Text = employmentDict["ContractedHours"]; } contractedHours.Text = ""; } if (NIDict["NINumber"] != null) niNumber.Text = NIDict["NINumber"]; if (Boolean.Parse(NIDict["Director"])) { director.CheckState = CheckState.Checked; } director.CheckState = CheckState.Unchecked; } } if (Boolean.Parse(NIDict["NonCumulativeNI"])) nonCumulativeNI.CheckState = CheckState.Checked; } nonCumulativeNI.CheckState = CheckState.Unchecked; } } directorStartDate.CustomFormat = "yyyy/MM/dd"; } directorStartDate.CustomFormat = " "; } if (paymentDict != null) if (paymentDict["AccountName"] != null) accountName.Text = paymentDict["AccountName"]; } if (starterStatementDict != null) if (starterStatementDict["StarterStatement"] != null) starterStatement.Text = starterStatementDict["StarterStatement"]; } if (p45Dict != null) if (p45Dict["P45EmployersReference"] != null) p45EmployersReference.Text = p45Dict["P45EmployersReference"]; { p45LeavingDate.CustomFormat = "yyyy/MM/dd"; } p45LeavingDate.CustomFormat = " "; } if (p45Dict["P45PeriodNo"] != null) p45PeriodNo.Text = p45Dict["P45PeriodNo"]; { if (Boolean.Parse(p45Dict["P45Wk1Mth1"])) p45Wk1Mth1.CheckState = CheckState.Checked; } p45Wk1Mth1.CheckState = CheckState.Unchecked; } } if (p45Dict["P45TaxDistrictNo"] != null) p45TaxDistrictNo.Text = p45Dict["P45TaxDistrictNo"]; } if (taxDict != null) if (taxDict["StartDate"] != null) taxStartDate.Text = taxDict["StartDate"]; { if (Boolean.Parse(taxDict["TaxBasis"])) { taxTaxBasis.CheckState = CheckState.Checked; } taxTaxBasis.CheckState = CheckState.Unchecked; } } } } } Console.WriteLine("GET person was not successful: " + response2.StatusCode); } if (person == null) output.Text = output.Text + "\r\nGet Person returned null"; } Console.WriteLine("Get Person returned:" + person.ToString()); } } } Console.WriteLine("Exception in Get Person:" + ex); } |
---|
Add a Payment
private void btnAddPayment_Click(object sender, EventArgs e) try
} output.Text = output.Text + "\r\nAuthenticated: " + token.ToString(); Object result = null; //Load scheme details in to request body { new KeyValuePair<string, string>("PayElement", paymentPayElement.Text), }); var requestMessage = new HttpRequestMessage(HttpMethod.Put, url); HttpResponseMessage response2 = client.PutAsync(url, content).Result; { Task<Object> res2 = response2.Content.ReadAsAsync<Object>(); } else { Console.WriteLine("Add Payment was not successful: " + response2.StatusCode); } if (result == null) output.Text = output.Text + "\r\nAdd Payment returned null"; } else { Console.WriteLine("Add Payment returned:" + result.ToString()); } } } catch (Exception ex) { Console.WriteLine("Exception in Add Payment:" + ex); } } |
---|
Update a Payment
private void btnUpdatePayment_Click(object sender, EventArgs e) try { Console.WriteLine("Update Payment clicked"); if (String.IsNullOrEmpty(token)) output.Text = output.Text + "\r\nAuthentication failed "; } else { output.Text = output.Text + "\r\nAuthenticated: " + token.ToString(); Object result = null; //Load scheme details in to request body { new KeyValuePair<string, string>("PayElement", paymentPayElement.Text), } ); HttpResponseMessage response2 = client.PostAsync(url, content).Result; { Task<Object> res2 = response2.Content.ReadAsAsync<Object>(); } else { Console.WriteLine("Update was not successful: " + response2.StatusCode); } if (result == null) { output.Text = output.Text + "\r\nUpdate Payment returned null"; } else { Console.WriteLine("Update Payment returned:" + result.ToString()); } } } catch (Exception ex) { Console.WriteLine("Exception in Update Payment:" + ex); } } |
---|
Delete a Payment
private void btnDeletePayment_Click(object sender, EventArgs e) { try { Console.WriteLine("Delete Payment clicked"); if (String.IsNullOrEmpty(token)) { output.Text = output.Text + "\r\nAuthentication failed "; } else { output.Text = output.Text + "\r\nAuthenticated: " + token.ToString(); Object result = null; output.Text = output.Text + "\r\nDoing DELETE to URL: " + url; HttpResponseMessage response2 = client.DeleteAsync(url).Result; if (response2.IsSuccessStatusCode) { Task<Object> res2 = response2.Content.ReadAsAsync<Object>(); } else { Console.WriteLine("Delete was not successful: " + response2.StatusCode); } if (result == null) { output.Text = output.Text + "\r\nDelete Payment returned null"; } { Console.WriteLine("Delete Payment returned:" + result.ToString()); } } } catch (Exception ex) { Console.WriteLine("Exception in Delete Payment:" + ex); } } |
---|
Whilst using the InPay Web Services, some fields have expected values from a range of constants. These are detailed below.
Field | Constant | Comment | Notes |
---|---|---|---|
Person | |||
Method | CASH | Cash | This is the method of payment |
CHEQUE | Cheque | ||
BACS | Bacs or payment via other banking software | ||
HoursCategory | A | Up to 15.99 | Required for the FPS submission |
B | 24 - 29.99 | ||
C | 30 hrs or more | ||
D | Other | ||
E | 16 - 23.99 | ||
Worker Pay Type | 1 | Salaried | Not Mandatory |
2 | Grade | ||
3 | Hourly | ||
AbsenceDetail | |||
AbsenceType | 1 | Holiday | |
2 | Sickness | ||