Adding the PurchaseReference to the Create_Invoice API

Im struggling to get the API to create an invoice when sending the purchase reference over. If I remove the following <PurchaseReference>XXXXXXX</PurchaseReference> it goes through fine? Am I doing something wrong?

.........<Currency>GBP</Currency>
<TermDays>1</TermDays>
<Language>en</Language>
<SingleInvoiceData>
    <IssueDate>' . date('Y-m-d', time()) . '</IssueDate>
    <PurchaseReference>XXXXXXX</PurchaseReference>
</SingleInvoiceData>
<InvoiceLines>
     <ItemLines>.........

Try swapping the order around:

<SingleInvoiceData>
    <PurchaseReference>XXXXXXX</PurchaseReference>
    <IssueDate>' . date('Y-m-d', time()) . '</IssueDate>
</SingleInvoiceData>

According to the schema, it is expecting <PurchaseReference> to occur before <IssueDate>.

Hope that helps!

1 Like

Worked a treat! Thank you for the help!

1 Like