Skip to main content
Solved

creating payment for custom sales order cause error

  • January 16, 2025
  • 4 replies
  • 100 views

Forum|alt.badge.img

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.

Best answer by Django

Assuming that you’re using the Payment endpoint, OrdersToApply is looking for “OrderType” but you have “Type”.

I’m see that SO is your default order type so that’s why it might have worked for the SO type orders.

4 replies

Forum|alt.badge.img+7
  • Captain II
  • Answer
  • January 16, 2025

Assuming that you’re using the Payment endpoint, OrdersToApply is looking for “OrderType” but you have “Type”.

I’m see that SO is your default order type so that’s why it might have worked for the SO type orders.


Forum|alt.badge.img
  • Author
  • Varsity III
  • January 16, 2025

Thanks ​@Django  !
That’s correct , I fixed it by changing Type to OrderType 


nshah90
Freshman II
Forum|alt.badge.img
  • Freshman II
  • March 10, 2025

@safetynetweb how did you fix this?  I am facing this same issue.  Thanks.


Forum|alt.badge.img
  • Author
  • Varsity III
  • March 11, 2025

@nshah90 
Yes I got it fixed by changing 

 "Type" => ["value" => "CL"],

to 
 

 "OrderType" => ["value" => "CL"],

In my code, so final working is :
 

$data = [
"OrderType" => ["value" => "Payment"],
"CustomerID" => ["value" => "CUST001"],
"CashAccount" => ["value" => "MAIN"],
"PaymentMethod" => ["value" => "CHECK"],
"PaymentAmount" => ["value" => 100],
"OrdersToApply" => [
[
"Type" => ["value" => "CL"],
"OrderNbr" => ["value" => "CL00000001"],
"AppliedToOrder" => ["value" => 100]
]
]
];