I am trying to create a credit note via the api. I can do this successfully and i can see the response it creates the record. How ever this does not appear in the business under invoices but i can see it under the contact. How can i fix this so it appears under the business on invoices
I am coding in PhP
$creditNote = new CreditNote();
$creditNote->setType(CreditNote::TYPE_ACCPAYCREDIT);
$creditNote->setContact($contact);
$creditNote->setDate($model->created_at);
$creditNote->setDueDate($model->created_at);
$creditNote->setLineItems($lineItems);
$creditNote->setCreditNoteNumber('GF-'.$model->number);
$creditNote->setCurrencyCode($currencyCode);
$creditNotes = new CreditNotes();
$arr_credit_notes = [];
array_push($arr_credit_notes, $creditNote);
$creditNotes->setCreditNotes($arr_credit_notes);
try {
return $this->accountingApi->createCreditNotes(
$this->xero_account->tenantId,
$creditNotes,
$summarizeErrors,
$unitdp
);
} catch (Exception $e) {
$this->logger->debug($e);
$this->logger->debug($e->getMessage());
throw new CustomException(
'Exception when calling AccountingApi->updateOrCreateCreditNotes: ' .
$e->getMessage(),
422
);
}
If I create a manual credit note in xero it appears in the business->invoices
in contact this is how it looks. Grren ones from api and the blue one i created in xero