Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

Xero-NetStandard-OAuth2 - CreateBatchPaymentAsync - NZ rules seem to apply

Started by Gerard D'Rozario -   in Wrapper libraries

I am confused. If I create a single invoice and payment it goes through fine. If I create the exact same invoice and payment process as a batch I get errors.

One of the them is ""You must specify an Account and Account ID".
The other is: "Batch deposits require a reference" and "Details cannot be set on batch deposits". Those seem to be the rules for NZ not Australia, according to the docs.

Can you point me to what I'm doing wrong if the bug is not in the API. Here is the full exception for the 2nd error (I have the exception details for the 1st one if required).:



{"Xero API 400 error calling CreateBatchPayment :{
"ErrorNumber": 10,
"Type": "ValidationException",
"Message": "A validation exception occurred",
"Elements": (
{
"Account": {
"AccountID": "13918178-849a-4823-9a31-57b7eac713d7",
"Code": "200",
"ValidationErrors": ()
},
"Details": "Notifyre Batch Payment",
"DateString": "2021-02-11T06:45:20",
"Payments": (
{
"Invoice": {
"Type": "ACCREC",
"InvoiceID": "c3cd08b9-06f0-4dc1-a551-8223d2cd7681",
"InvoiceNumber": "3a2f7553-d77f-480d-b200-c71977b302af-44",
"Reference": "Notifyre",
"Payments": (),
"CreditNotes": (),
"Prepayments": (),
"Overpayments": ()
,
"AmountDue": 728.32,
"AmountPaid": 0.00,
"SentToContact": false,
"CurrencyRate": 1.000000,
"IsDiscounted": false,
"HasErrors": false,
"Contact": {
"ContactID": "2d803b81-e72f-4827-b48b-82c0f88c38f7",
"ContactStatus": "ACTIVE",
"Name": "Rockee2 Racoona2",
}
--- etc ----
),
"UpdatedDateUTC": "\/Date(1613014569633)\/",
--- etc --
"ContactGroups": (),
"ValidationErrors": ()
},
"DateString": "2021-02-10T00:00:00",
"DueDate": "\/Date(1612915200000+0000)\/",
"Status": "AUTHORISED",
"LineAmountTypes": "Inclusive",
"LineItems": (
{
"ItemCode": "DevH",
"Description": "Notifyre Wallet Top Up",
"UnitAmount": 728.32,
"TaxType": "OUTPUT",
"TaxAmount": 66.21,
"LineAmount": 728.32,
"AccountCode": "200",
"Tracking": (
{
"Name": "Region",
"Option": "North",
"ValidationErrors": ()
}
),
"Quantity": 1.0000,
"LineItemID": "ec6671be-6200-42d9-b9fe-ef6a2c5e2ab1",
"ValidationErrors": ()
}
),
"SubTotal": 662.11,
"TotalTax": 66.21,
"Total": 728.32,
"UpdatedDateUTC": "Date(1613025918743)",
"CurrencyCode": "AUD",
"StatusAttributeString": "OK",
"ValidationErrors": ()
},
"Reference": "Notifyre Payment",
"Amount": 728.32,
"ValidationErrors": ()
},
{
"Invoice": {
"Type": "ACCREC",
"InvoiceID": "1d27f91d-bb0c-4859-934b-efc33e427c0c",
"InvoiceNumber": "3a2f7553-d77f-480d-b200-c71977b302af-45",
"Reference": "Notifyre",
"AmountDue": 728.32,
"HasErrors": false,
"Contact": {
"ContactID": "2d803b81-e72f-4827-b48b-82c0f88c38f7",
"ContactStatus": "ACTIVE",
"Name": "Rockee2 Racoona2",
---- etc -----
"HasValidationErrors": false,
"ValidationErrors": ()
},
"DateString": "2021-02-10T00:00:00",
"Date": "Date(1612915200000+0000)",
"Status": "AUTHORISED",
"LineAmountTypes": "Inclusive",
"LineItems": (
{
"ItemCode": "DevH",
"Description": "Notifyre Wallet Top Up",
"UnitAmount": 728.32,
"TaxType": "OUTPUT",
"TaxAmount": 66.21,
"LineAmount": 728.32,
"AccountCode": "200",
"Quantity": 1.0000,
"LineItemID": "813b4c0b-3819-447c-8a59-4b82df3fec38",
"ValidationErrors": ()
}
),
"SubTotal": 662.11,
"TotalTax": 66.21,
"Total": 728.32,
"CurrencyCode": "AUD",
"StatusAttributeString": "OK",
"ValidationErrors": ()
},
"Reference": "Notifyre Payment",
"Amount": 728.32,
"ValidationErrors": ()
}
),
"IsReconciled": false,
"ValidationErrors": (
{
"Message": "Batch deposits require a reference"
},
{
"Message": "Details cannot be set on batch deposits"
Still waiting for some word on this. Batch payments seem to work differently to normal payments. In many ways. One of them is that Batch Payments contradict the specs:

Particulars, Code, Reference (NZ Only) Optional references for the batch payment transaction.
 

Gerard D'Rozario