We are using end point to create payment for our sales order, the default Sales Order Type is “SO”, when creating payment record it works and get added correctly.
We added a new Sales Order type “CL” with a separate sequence. But when sending the payment to it it returns this 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
Although in the request the order NBr is correct and OrderTYpe, here is the payload of the payment creation request:
$data = [
"Type" => ["value" => "Payment"],
"CustomerID" => ["value" => "CUST001"],
"CashAccount" => ["value" => "MAIN"],
"PaymentMethod" => ["value" => "CHECK"],
"PaymentAmount" => ["value" => 100],
"OrdersToApply" => [
[
"Type" => ["value" => "CL"],
"OrderNbr" => ["value" => "CL00000001"],
"AppliedToOrder" => ["value" => 100]
]
]
];
When doing the same call for sales orders of the type “SO” and orderNbr with the sequence of SO it works and payment get created.