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

Marking invoices as paid when shipped and posted via API

(6) ShareShare
ReportReport
Posted on by 27
Hi,
 
I have created an app to sync sales from our woocommerce store to BC. The final step is to ship and invoice the order as I am only syncing completed orders for now. However these are all marked as unpaid and it looks like the api won’t let me mark them as paid and remove the outstanding balance for a customer. 
 
Is there any easy workaround for this? I mark all customers from Woocommerce with unique payment terms but once the order is synced it is already paid.
 
many thanks in advance! 
I have the same question (0)
  • Suggested answer
    Ramesh Kumar Profile Picture
    7,527 Super User 2025 Season 2 on at
    I would suggest checking with WOOcommerce Dev team as they should have something in place for Cash receipts/ledger
     
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
  • Verified answer
    Jeffrey Bulanadi Profile Picture
    8,760 on at

    Hi,

    BC doesn’t allow you to directly mark a posted sales invoice as “Paid” via the standard API. The invoice status is determined by ledger application, not a field toggle. But there’s a clean workaround using the Customer Payment API and a custom journal posting routine.

    Here’s how to approach it:

    • Use the Customer Payment API to create a payment entry for the invoice. This simulates a cash receipt journal line and links the payment to the posted invoice.
    • To actually apply the payment and close the invoice, you’ll need to post the journal entry. Unfortunately, BC doesn’t expose a direct API for posting journals, so you’ll need to:
      • Create a custom Codeunit that posts the journal line
      • Expose it via OData or a custom API endpoint
      • Trigger it from your app once the payment is created


    This approach ensures the invoice is marked as paid and the customer ledger reflects the correct balance.

    Optional enhancements:

    • Set a unique Payment Method Code (e.g., WOOCOM) for WooCommerce customers to simplify filtering and reconciliation
    • Use Power Automate to trigger the journal posting after payment creation if you prefer low-code orchestration


    Helpful References:
    Customer Payment API – Microsoft Learn
    GitHub – Journal Line Posting Codeunit
    Invoice Sales – Microsoft Learn
    Power Automate Integration – Microsoft Docs


    If you find this helpful, feel free to mark this as the suggested or verified answer.

    Cheers
    Jeffrey

  • Suggested answer
    Sohail Ahmed Profile Picture
    11,136 Super User 2025 Season 2 on at
    To mark invoices as paid when syncing completed orders from WooCommerce via API, you’ll need to post a payment entry separately after invoicing. Business Central doesn't allow direct marking of an invoice as paid through the Sales Invoice API.
     
    Workaround:
     
    Use the "Customer Payment Journal" API to create and post a payment entry for the corresponding invoice.
     
    Match the payment to the invoice using the "Applies-to Doc. No." field to clear the balance.
     
     
    This simulates the real BC process and ensures the customer ledger stays accurate.
     
    ✅ Mark this answer as verified if it helps you.
     
     
  • JI-22070805-0 Profile Picture
    27 on at
    @Jeffrey Bulanadi Thank you for you reply, 
     
    Just a few questions. I'm struggling to get the Custom API deployed. Is it possible to deploy a customAPI to a production enviroment?
     
    The power automate solution sounds good but it can reconcile without having a custom API?
     
     

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