Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Getting Started >

Applying payment for a credit note which actually not a credit note invoice

Started by Ahmet Sahin -   in Getting Started

Hi Guys,
When I'm applying payments for a credit note which actually not a credit note invoice but still applying the payments to the invoice instead of throwing an error message saying that "Credit note invoice does not exist".

I tried a sample in Xero previewer UI
This is my actual invoice
<Invoice>
<Contact>
<ContactID>8930949a-7254-4117-8de0-25deb108e523</ContactID>
<ContactNumber>Daily Sales</ContactNumber>
<ContactStatus>ACTIVE</ContactStatus>
<Name>Daily Sales</Name>
<IsCustomer>true</IsCustomer>
</Contact>
<Date>2019-07-25T00:00:00</Date>
<DueDate>2019-07-25T00:00:00</DueDate>
<Status>AUTHORISED</Status>
<LineItems>
XXX
</LineItems>
<SubTotal>328.19</SubTotal>
<TotalTax>-9.19</TotalTax>
<Total>319.00</Total>
<UpdatedDateUTC>2019-08-12T23:33:19.443</UpdatedDateUTC>
<CurrencyCode>AUD</CurrencyCode>
<Type>ACCREC</Type>
<InvoiceID>abb5e0be-6b47-49c5-a0d9-99cf604b648d</InvoiceID>
<InvoiceNumber>CP_DS_300190725</InvoiceNumber>

</Invoice>

End point : Payments /PUT request

<Payments>
<Payment>
<CreditNote>
<CreditNoteNumber>CP_DS_300190725</CreditNoteNumber>
</CreditNote>
<Account>
<Code>1011</Code>
</Account>
<Date>2019-08-12T00:00:00</Date>
<Reference>CHQ0009238</Reference>
<CurrencyRate>1.00</CurrencyRate>
<Amount>10</Amount>
</Payment>
</Payments>

Response:

Response Received: OK
<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Id>0a471bf0-2060-43e5-aa66-485b9ad772b4</Id>
<Status>OK</Status>
<ProviderName>Xero API Previewer</ProviderName>
<DateTimeUTC>2019-08-12T23:33:19.8255987Z</DateTimeUTC>
<Payments>
<Payment>
<PaymentID>179cdc40-f57e-4d94-96ae-57ed0c2420b1</PaymentID>
<Date>2019-08-12T00:00:00</Date>
<BankAmount>10.00</BankAmount>
<Amount>10.00</Amount>
<Reference>CHQ0009238</Reference>
<CurrencyRate>1.000000</CurrencyRate>
<PaymentType>ACCRECPAYMENT</PaymentType>
<Status>AUTHORISED</Status>
<Account>
<Code>1011</Code>
<Name>DEV Test Bank</Name>
<Status>ACTIVE</Status>
<Type>BANK</Type>
</Account>
<CreditNote>
<Contact>
<ContactID>8930949a-7254-4117-8de0-25deb108e523</ContactID>
<Name>Daily Sales</Name>
</Contact>
<Date>2019-07-25T00:00:00</Date>
<DueDate>2019-07-25T00:00:00</DueDate>
<Status>AUTHORISED</Status>
<SubTotal>328.19</SubTotal>
<TotalTax>-9.19</TotalTax>
<Total>319.00</Total>
<Type>ACCREC</Type>
<RemainingCredit>309.00</RemainingCredit>
<Payments>
<Payment>
<PaymentID>179cdc40-f57e-4d94-96ae-57ed0c2420b1</PaymentID>
<Date>2019-08-12T00:00:00</Date>
<Amount>10.00</Amount>
<Reference>CHQ0009238</Reference>
<CurrencyRate>1.000000</CurrencyRate>
</Payment>
</Payments>
<CreditNoteID>abb5e0be-6b47-49c5-a0d9-99cf604b648d</CreditNoteID>
<CreditNoteNumber>CP_DS_300190725</CreditNoteNumber>

<HasErrors>false</HasErrors>
</CreditNote>
</Payment>
</Payments>
</Response>

Actually credit note invoice "CP_DS_300190725" does not exist but still applying the payments.
Can you please help me with this issue.

Thanks,
Bhanu