Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

How to create an authorized invoice via API?

Started by Aldrin dela Cruz -   in API Endpoints

Here's my code:

@invoice = @xero_client.Invoice.build({
:type => "ACCREC",
:due_date => 1.month.from_now,
:date => Date.today,
:status => "AUTHORISED"
})
@invoice.build_contact(:name => "ABC Limited")
@invoice.add_line_item({
:description => "Credit Sales for #{Date.today}",
:quantity => 1,
:unit_amount => @credit_total,
:account_code => "200"
})
@invoice.save

I can't seem to post this invoice. I really need this badly. Please take a look. Thank you.
@Aldrin - not sure if you're still having an issue with this? It would be useful if you could paste the response you're getting from the Xero API into your question so we can see what error you're getting.
 

Tony Rule (Xero Staff)  

I got this to work, but now i'm having problems posting "paid" invoices. Can you give some tips (minimum elements required, criteria, etc.) on how to? thanks!
 

Aldrin dela Cruz