Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Getting Started >

Simple POS posting

Started by Nick Williams -   in Getting Started

Hi community,

I have asked support about this and they referred me to the POS example, which I find a little unwieldy for our requirements.

Essentially we wish to push sales revenue and the corresponding payments into Xero, pretty simple.

We have lost some internal knowledge (due to devs leaving, etc.) but it appears that our legacy interface used to construct a (single) Invoice with sales and payments mixed together as line items(?) However this seems to be contrary to the advice to send the sales on an invoice and then the payments (cash, card, cheque, etc.) separately. Can anybody offer some advice here?

We're using the latest Xero Minimal API from NuGet and Authentication, etc. is all built and working. Just need to know how to post these simple entities.

FYI - Sales revenue will always equal payments.

Thanks in advance
Nick,

There is nothing wrong with the implementation you have. The only thing you can't do with it is create the payments against a bank account. But if you are OK with posting the payments to a non-bank clearing account then your method will work.

If you strip out the payments from the line items and add them as payments to a bank account they will then be available for matching in the bank reconciliation process.

Peter.
Xero-award winning Most Valuable Professional accountant serving NZ, Canada and US. Book a paid live remote Xero support session with me (no matter where you are) or use our self-paced Xero training.
 

Peter McCarroll  

Peter

Many thanks for the reply.
Just to clarify, when you say there nothing wrong, do you mean our implementation of sales and payments on one invoice?? Doing this wouldn't we have to send negative payment amounts to net the invoice to zero? Or am I wide of the mark?

Cheers
Nick
 

Nick Williams  

I am making assumptions here as you haven't shared any real data. I assumed that when you said "Invoice with sales and payments mixed together as line items" that the payments were negating the sales to a net NIL invoice. If you are not doing this, then there is something wrong. I would need to see what you are going to be able to comment further. Certainly, using payments to a bank account is the better solution.
 

Peter McCarroll  

Peter - sorry to pick up this thread after so long, we are still struggling with this.
Essentially we are now trying the following:

1) post sales revenue to an invoice
2) post cash, card, cheque payments to the Payment endpoint.

However, this doesn't work. The Payment endpoint expects an "Invoice" object and a "Contact" object (not just ID's) - when we specify the invoice created in step 1, it fails with a validation error "Invalid Invoice" (or similar)

Does anybody have any code examples of a similar situation do you think?

Many thanks
Nick
 

Nick Williams  

Nick, The invoice must be approved before a payment can be applied to it, and should have value (i.e., not a Zero balance). When posting a payment you only need the InvoiceID - you don't need a ContactID. You should NOT be sending an entire object, just the ID. See the documentation here. The Account/Code here is the bank account COA code number, or you can use the AccountID field instead for more precision.

Here is the XML content:
<Payments>
<Payment>
<Invoice>
<InvoiceID>96df0dff-43ec-4899-a7d9-e9d63ef12b19</InvoiceID>
</Invoice>
<Account>
<Code>001</Code>
</Account>
<Date>2009-09-08</Date>
<Amount>32.06</Amount>
</Payment>
</Payments>

Sorry - that's the best I can give you as I am not a developer.
 

Peter McCarroll  

Peter

Thats helpful, thanks for your time and assistance on this so far.
I'm using the Xero wrapper libraries in C#, not constructing XML, so I guess I need to post a new dev oriented question.

However if you say the invoice needs to be approved first, does that mean that our approach is incorrect as we really need to post revenue and payment data in one session for the integration to have any real value. Maybe I'm missing something here and perhaps overlooking something more fundamental.

Thanks again
 

Nick Williams  

Coding advice is above my skill level. But you should be able to create the invoice as approved (receive the invoice ID in the response) and then create the payment(s) immediately following that. The documentation on the Invoice endpoint explicitly states this.
 

Peter McCarroll  

Peter

The wrapper allows me to define an new Invoice ID (a GUID) which I have been doing – If I don’t specify it Xero doesn’t generate it is simply stays blank so there is nothign to pass to the Payment function. I’ve drawn a complete blank with this – any idea how I go about getting some support from Xero with the wrapper libraries as I believe they are provided by Xero directly ?

Many thanks again
Nick
 

Nick Williams  

Nick - you can email api @ xero.com and see if they will help. Sounds like you are using it wrong. You only supply an invoice ID with a GET or POST request. When you first create the invoice you use a PUT and Xero assigns the ID (I think I have the terms right here). Beyond my ability to help further here.
 

Peter McCarroll