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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Payments from API

(4) ShareShare
ReportReport
Posted on by 10
Hi all, 
 
This question has been asked before but I can't find the solution from those for my situation. 
 
I'm connecting to the API using PHP and I have a situation where I need to get the payment information for a specific 
date range with the linked documents (i.e. invoice numbers) as well as payments which have not been fully allocated yet.
 
I've tried the customerPayment and customerPaymentJournal API calls, but get no results, or just the: 
[
    {
        "id": "00000000-0000-0000-0000-000000000000",
        "code": "GENERAL",
        "displayName": "GENERAL",
        "lastModifiedDateTime": "2026-02-04T03:26:36.887Z",
        "balancingAccountId": "00000000-0000-0000-0000-00000000",
        "balancingAccountNumber": "2910",
        "customerPayments": []
    }
 
 
The screenshots is from my demo company, how would I get the payment information for G04002 and that it's applied to invoice 103299 using the API?
 
Example of the code which I use to generate the URL, I'll add the filter on dates once I can actually get some payment info out: 
 
$baseUrl = "https://api.businesscentral.dynamics.com/v2.0/" . $arrInfo['tenant_id'] . "/" . ENVIRONMENT . "/api/v2.0";
$endpoint = "/companies(" . rawurlencode($arrInfo['organisation_id']) . ")/customerPaymentJournals";    
$expand = "\$expand=customerPayments";
$fullUrl = $baseUrl . $endpoint ."?" . $expand;
 
Any help would be great. 
 
Thank you in advance :) 
 
 
Screenshot 2026-03-02 at 12.18.22.png
Screenshot 2026-03-02 at 12.19.14.png
I have the same question (0)
  • Zhilan Profile Picture
    164 on at
    Hello dear,

    you are calling a wrong table, you cannot directly call /customerPaymentJournals";     you will need to call /customerLedgerEntries to get specific payment and logs about a customer

    Regards
  • Verified answer
    Dhiren Nagar Profile Picture
    2,890 Super User 2026 Season 1 on at
    Hi,
     
    The standard API CustomerPayment is not used to fetch the payment details, however it is used to create payment entries in BC using API. It allows external system to create CustomerPayments in Business Central.
     
    The data which you are trying to fetch has complex AL logic behind it.
     
    What you can do?
     
    Create a Custom API page in business central which uses the same logic as Applied entries and creates and fetches a record in API page which you then can call from any system.
    The tables to use in Code are Customer Ledger entries and Detailed Customer Ledger entries.
     
    There is no standard API which can give you this details.
     

    ✅ Tick the checkbox below to mark the answer as verified, if it helped resolve your question.

    Regards,
    Dhiren.
     
  • Suggested answer
    YUN ZHU Profile Picture
    101,995 Super User 2026 Season 1 on at
    Hi, hope the following can give you some hints.
    Dynamics 365 Business Central: How to use standard customerPayment API to get customer payments (customerPayments/customerPaymentsJournals APIs returns empty records)
     
    Thanks.
    ZHU

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May 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,344 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,742 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,231

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans