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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

How to post multiple Payments for multiple clients using API ?

(5) ShareShare
ReportReport
Posted on by 176
I have a context where we are trying to use Business Central APIs to process multiple payments for multiple sales invoices simultaneously (Ecomm sales).
 
To apply a payment to a sale invoice (and make visible that invoice is paid to the customer), my understanding is that we need to do theses actions:
 
1- Add the receipt to a payment journal
2- Post the payment journal.
 
When we tried to process these actions in a load context, we quickly get processing errors:
 
"error": {
"code": "Internal_ServerError",
"message": "The activity was deadlocked with another user who was modifying the Cust. Ledger Entry table. Please retry the activity. CorrelationId: d45ded75-24b0-403b-9a7a-47c76cf11c92."
}
 
Any ideas on how to post payments to invoices in this context?
I have the same question (0)
  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,803 Super User 2026 Season 1 on at
    Hello,
     
    You can use the "Register Customer Payment" Functionality of Business Central to Post the Multiple Receipts of Customer.
     
     
     
    And For the "Deadlock Error", Any Other User is trying to Post Something in Customer Ledger Entry like Post the Sales Invoice Or Post the Credit Memo Or Receipt of Payment. You can do after sometime then the error will not come.
     
    Thank you
  • Suggested answer
    Holly Huffman Profile Picture
    6,554 Super User 2026 Season 1 on at
    Hi there! Good morning, evening, or afternoon - depending on where you are :) Hope you are well today! 
     
    The error you're encountering, specifically the deadlock on the Cust. Ledger Entry table, typically occurs when multiple processes or users are trying to modify the same data simultaneously. This is common in high-load scenarios like processing multiple payments for sales invoices. Here are some strategies to address and resolve this issue:
     
    1. Optimize API Calls
    • Batch Processing: Instead of processing all payments in a single batch, divide them into smaller batches. This reduces the likelihood of deadlocks.
    • Sequential Processing: Ensure that API calls are processed sequentially rather than in parallel, especially when they target the same table (e.g., Cust. Ledger Entry).
    2. Use the Payment Reconciliation Journal
    • The Payment Reconciliation Journal in Business Central is designed for bulk payment processing. It automatically matches payments to invoices and posts them efficiently.
    • You can use the API for Payment Reconciliation Journal to streamline this process and reduce contention on the Cust. Ledger Entry table.
    3. Implement Retry Logic
    • Add retry logic to your API integration. If a deadlock occurs, the system should wait for a short period and then retry the operation.
    • Example: Use exponential backoff to gradually increase the wait time between retries.
    4. Review Table Locking
    • Analyze the locking behavior of the Cust. Ledger Entry table during payment posting. You can use the Performance Profiler in Business Central to identify bottlenecks.
    • If necessary, consult with a developer to optimize the locking mechanism or adjust the transaction scope.
    5. Schedule Payment Processing During Off-Peak Hours
    • If your system experiences high concurrent usage, schedule bulk payment processing during off-peak hours to minimize contention.
    6. Use Background Sessions
    • Consider using background sessions in Business Central for payment processing. This allows the system to handle operations asynchronously, reducing the risk of deadlocks.
    7. Monitor and Optimize Database Performance
    • Ensure that your database is optimized for high-load scenarios. For example:
      • Index the Cust. Ledger Entry table appropriately.
      • Monitor database performance using tools like SQL Profiler.
    8. Consult Microsoft Documentation
    • Refer to Microsoft's API documentation for Business Central to ensure you're following best practices for bulk payment processing.
  • Ramesh Kumar Profile Picture
    7,547 Super User 2026 Season 1 on at
    Hi,
     
    Only solutions which I think is creating payment journal batch and exposing the field or other option is register customer payment.
     
     
    Thanks,
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
  • Suggested answer
    YUN ZHU Profile Picture
    99,086 Super User 2026 Season 1 on at
    If you only post one, will this error occur? It seems to be a problem with the code processing.
    Hope the following can give you some hints.
     
     
    Thanks.
    ZHU
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,130 Super User 2026 Season 1 on at
  • Vahid Ghafarpour Profile Picture
    12,228 Super User 2026 Season 1 on at
    If any of the responses helped resolve your issue, please take a moment to mark the best answer. This helps others in the community quickly find solutions to similar problems.

    To do this, simply click the "Does this answer your question?" button on the most helpful response and like the helpful posts. If your issue is still unresolved, feel free to provide more details so the community can assist further!

    Thanks for being an active part of the Dynamics 365 Community! 😊

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,005 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,148 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 557 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans