+
+
+
# configure api_client for use with xero-python sdk client
+api_client = ApiClient(
+ Configuration(
+ debug=false,
+ oauth2_token=OAuth2Token(
+ client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
+ ),
+ ),
+ pool_threads=1,
+)
+
+api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")
+
+def accounting_create_pay_item():
+ api_instance = PayrollAuApi(api_client)
+ xero_tenant_id = 'xeroTenantId_example'
+
+ earnings_rate = EarningsRate(
+ name = "Ordinary Hours 123",
+ account_code = "477",
+ type_of_units = "Hours",
+ is_exempt_from_tax = true,
+ is_exempt_from_super = true,
+ earningsType = "OVERTIMEEARNINGS")
+
+ deduction_type = DeductionType(
+ name = "Union Fees",
+ account_code = "826",
+ reduces_tax = true,
+ reduces_super = true)
+
+ leave_type = LeaveType(
+ name = "Annual Leave",
+ type_of_units = "Hours",
+ is_paid_leave = true,
+ show_on_payslip = true)
+
+ reimbursement_type = ReimbursementType(
+ name = "Annual Leave",
+ account_code = "850")
+
+ earnings_rates = []
+ earnings_rates.append(earnings_rate,
+
+ deduction_types = []
+
+ leave_types = []
+ leave_types.append(leave_type)
+
+ reimbursement_types = []
+ reimbursement_types.append(reimbursement_type)
+
+ pay_item = PayItem(
+ earningsRates = earnings_rates,
+ deductionTypes = deduction_types,
+ leaveTypes = leave_types,
+ reimbursementTypes = reimbursement_types)
+
+ try:
+ api_response = api_instance.create_pay_item(xero_tenant_id, payItem)
+ print(api_response)
+ except AccountingBadRequestException as e:
+ print("Exception when calling PayrollAuApi->createPayItem: %s\n" % e)
+
+
+