I am creating a Payment/Prepayment through the Acumatica Contract-Based REST API and applying it to a Sales Order using the OrdersToApply detail.
The same API payload structure works for several Sales Orders, but it fails for some specific orders with the following error:
An error occurred during processing of the field Order Nbr.:
The order cannot be applied, the specified combination of the order type and order number cannot be found in the system.
Sample request structure:
{
"CashAccount": {
"value": "XXXXX"
},
"CurrencyID": {
"value": "USD"
},
"CustomerID": {
"value": "CXXXXXXXXXXX"
},
"Description": {
"value": "Shopify Payment XXXXX"
},
"Hold": {
"value": false
},
"OrdersToApply": [
{
"AppliedToOrder": {
"value": 69.08
},
"OrderNbr": {
"value": "ES88832"
},
"OrderType": {
"value": "ES"
}
}
],
"PaymentAmount": {
"value": 69.08
},
"PaymentMethod": {
"value": "SHOPPAY"
},
"PaymentRef": {
"value": "shopify_payments/XXXXX"
},
"ReferenceNbr": {
"value": "<NEW>"
},
"Type": {
"value": "Prepayment"
}
}
For the failing order, I checked the Sales Order screen and confirmed:
Order Type: ES
Order Nbr: ES88832
Status: Open
Customer: CXXXXXXXXXXX
Currency: USD
Order Total: 69.08
I also tried updating the CustomerID in the Payment payload to match the customer shown on the Sales Order, but the API still returns the same error.
What is confusing is that the same API request structure works for other Sales Orders, but fails only for some specific ones.
Could you please advise what conditions Acumatica checks when applying a Payment/Prepayment to a Sales Order through the OrdersToApply detail?
Specifically, what should I verify besides the following?
-
Sales Order exists with the same
OrderTypeandOrderNbr -
Payment
CustomerIDmatches the Sales Order customer -
Sales Order status is Open
-
Currency matches
Is there any additional setup or hidden condition that would make the order visible on the Sales Order screen but not selectable/applicable in the Payment OrdersToApply tab via API?
Any guidance would be appreciated.