web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Find out if a sale order is paid via the API

(0) ShareShare
ReportReport
Posted on by 5

Hello experts !

I am trying to figure out how to know if a Sales order (ref. https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_salesorder_get) has been paid or not. For other documents, it is easy via the status Paid, however on a Sales order there is no such status.

For now, I can get all the Sales shipment related to an order (via ordernumber), but here neither I cannot know if the shipment has been paid. I see that there is reference to an invoiceId in Customer payment, but can this ID also reference a Sales shipment ? The documentation is not very clear about the link between Customer payment and invoices.

Thank you very much for your help,

Julien

I have the same question (0)
  • Jason Nicolaou @ Sikich Profile Picture
    120 on at

    It looks like your API is connecting to the Sales ORDER which is NEVER paid inside of BC.  Sales Invoices will have the cash applied to them.  This is going to make your integration more difficult.  When a sales order has been fully shipped and invoiced there is a job queue that removes it from the list of sales orders.  You may want to look in that area for a way to trigger the "status change" that you are pursuing.  I am not a developer so you will have to lean on the community for detailed programming advice.  

  • Julien Dms Profile Picture
    5 on at

    Ok got it, thank you for your answer ! What I still do not understand is that in BC, you create a Sales order INSTEAD of an invoice when you can fulfill (and invoice) partially an order. In that case, from what I understand from the documentation the invoice will be represented by the Sales shipment. Is a Sale shipment a type of invoice (and thus you can register a payment on them) ? Or do you create an invoice from the sale shipment ?

    It's not at all clear because I see no explicit link between Sales invoice and Sales shipment.

  • Verified answer
    Jason Nicolaou @ Sikich Profile Picture
    120 on at

    The overall design separates the sales shipments from the sales invoices.  Multiple shipments, derived from multiple sales orders, can be consolidated onto 1 invoice.  Also, multiple shipments from the same sales order can be included in 1 sales invoice.  This is all possible by the posting option on the Sales Order that separates shipping and invoicing.  Cash is never applied to a shipment, it is applied to the invoice.  The dots are connected in that you can trace back from any of the documents back to the original sales order(s).  The condition of the lines being fully shipped and invoiced removes the sales order from the sales order list.  Payment application to a posted sales invoice that satisfies the full amount removes that from the list of sales invoices and from AR.  Once again, I am not a developer, but I will say that in order for your "status" to be updated for the sales order you will need to tie in more than the sales order alone.  This API has some complexity around it.  

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    I suggest you to create a custom API for this. You can check the Invoiced Quantity of the Sales Lines (but Invoiced is not equal to Paid) or implemento your logic in the API itself to determine if the order is paid. Despite the business rules, a custom API is required.

  • Julien Dms Profile Picture
    5 on at

    Thank you all for your help, I can see where to look at, I think I have enough info to tackle this !

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans