PFB one sample payload.
Request
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Invoice xmlns="http://schema.intuit.com/finance/v3">
<Line>
<Amount>15</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef name="Hours">2</ItemRef>
</SalesItemLineDetail>
</Line>
<CustomerRef name="Hours">2</CustomerRef>
</Invoice>
Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-04-30T07:35:49.705-07:00">
<Invoice domain="QBO" sparse="false">
<Id>16</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-04-30T07:35:49-07:00</CreateTime>
<LastUpdatedTime>2014-04-30T07:35:49-07:00</LastUpdatedTime>
</MetaData>
<DocNumber>1003</DocNumber>
<TxnDate>2014-04-30</TxnDate>
<CurrencyRef name="Australian Dollar">AUD</CurrencyRef>
<Line>
<Id>1</Id>
<LineNum>1</LineNum>
<Amount>15.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef name="Hours">2</ItemRef>
</SalesItemLineDetail>
</Line>
<Line>
<Amount>15.00</Amount>
<DetailType>SubTotalLineDetail</DetailType>
<SubTotalLineDetail/>
</Line>
<CustomerRef name="abc">2</CustomerRef>
<DueDate>2014-05-30</DueDate>
<GlobalTaxCalculation>NotApplicable</GlobalTaxCalculation>
<TotalAmt>15.00</TotalAmt>
<PrintStatus>NeedToPrint</PrintStatus>
<EmailStatus>NotSet</EmailStatus>
<Balance>15.00</Balance>
<Deposit>0</Deposit>
<AllowIPNPayment>false</AllowIPNPayment>
<AllowOnlinePayment>false</AllowOnlinePayment>
<AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment>
<AllowOnlineACHPayment>false</AllowOnlineACHPayment>
</Invoice>
</IntuitResponse>
You can use the above setter using java sdk. It will create a valid Invoice. Please use IDs of valid referenced objects (Item and Customer)
Update
void createInvoice() {
try {
Invoice invoice = new Invoice();
ReferenceType customerReferenceType = new ReferenceType();
customerReferenceType.setName("abc");
customerReferenceType.setValue("2");
invoice.setCustomerRef(customerReferenceType);
Line line = new Line();
line.setAmount(new BigDecimal(15));
line.setDetailType(LineDetailTypeEnum.SALES_ITEM_LINE_DETAIL);
SalesItemLineDetail salesItemLineDetail = new SalesItemLineDetail();
ReferenceType referenceType = customerReferenceType;
referenceType.setName("Hours");
referenceType.setValue("2");
salesItemLineDetail.setItemRef(referenceType);
line.setSalesItemLineDetail(salesItemLineDetail);
List linesList = new ArrayList<Line>();
linesList.add(line);
invoice.setLine(linesList);
this.service.add(invoice);
} catch (FMSException e) {
e.printStackTrace();
}
Thanks