Hello Team,
I found the following error with payments.
1. I have created a payment via API. The payment is being created successfully.
2. Then I use a payment to allocate with invoice or credit memo via API to pay it.
3. Send the payment with allocation to the invoice or credit memo to Acumatica via API.
Acumatica returns the following error message:
Payment update request returns the error message - "exceptionMessage": "An error occurred during processing of the field Reference Nbr.: Reference Nbr. 'AR.......' cannot be found in the system.\nPX.Data.PXOuterException: An error occurred during processing of the field Reference Nbr.: Reference Nbr. 'AR......' cannot be found in the system."
When I repeat the same Payment update request after a period of time (in 1,5,10,20 minutes), Acumatica creates a payment successfully.
Could you clarify what is the reason of this behavior?
Error during the payment updаte via API
Best answer by harutyungevorgyan
Hi
The ReferenceNbr in DocumentsToApply is a selector. It lists only documents that can be applied at that moment: open, released, with a balance, for that customer (or its related accounts when balances are consolidated), and of the DocType you send. "Cannot be found in the system" means the invoice wasn't on that list when the request ran.
The retry succeeding 1–20 minutes later points to one cause: the invoice's release hadn't finished. Releasing through REST (POST .../Invoice/ReleaseInvoice) returns 202 Accepted with a Location header, and the release keeps running in the background. Until it completes, the invoice is still Balanced, not Open, so the payment can't select it. Wait for the release before you apply using the Location value you received as a response. When the GET HTTP method with this URL returns 204 No Content, the operation is completed..
If the error happens every time (JohnKihiu's sandbox case), check the invoice directly with GET:
- Status must be Open, not On Hold or Balanced.
- CustomerID must match the payment's customer (CUST000003) or be a child account with a consolidated balance.
- The invoice's branch must belong to the same company as the payment's branch, and the API user must have access to that branch.
- DocType must match: "Invoice" vs "Debit Memo" vs "Credit Memo".
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.