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...
Suggested Answer

Unable to create a customer payment with ODataV4 web service?

(0) ShareShare
ReportReport
Posted on by 25

I'm trying to GET/POST a customer payment by exposing a web service in business central.

With the already available REST API endpoint (https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/api/dynamics_create_customerpayment) for creating customer Payments, it requires customerPaymentJournalId like below and works as expected.

POST businesscentralPrefix/companies({id})/customerPaymentJournals({id})/customerPayment


But I want to achieve the same with web services, to be precise.

The service I exposed is "customerPayments" and the URL looks like below:

GET https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Sandbox/ODataV4/Company('{companyId}')/customerPayments


which throws the below error:

{

"error": {

"code": "Application_DialogException",

"message": "You must specify a journal batch ID or a journal ID to get a journal line. CorrelationId: xxxxx-xxxx-xxxx-xxxx-xxxx."

}
}


 How can I perform both GET & POST operations for this customerPayments page web service?
I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    159 on at

    You need a payload which uses the primary key of the underlying table. In this case it’s the general journal line table. Something like this would do the trick:

    {

       "Journal_Template_Name": "GENERAL",

       "Journal_Batch_Name": "DEFAULT",

       "Posting_Date": "2019-07-31",

       "Document_Type": "Payment”,

       "External_Document_No": "",

       "Account_Type": "Customer",

       "Account_No": "110-49",

       "Amount": 2000,

       "Bal_Account_Type": "Bank Account”,

       "Bal_Account_No": "962-05",

       "Comment": "Web serivce posting",

       "Shortcut_Dimension_1_Code": "PROPERTY",

       "Shortcut_Dimension_2_Code": "21-01-001",

       "ShortcutDimCode3": "80-50-025",

       "ShortcutDimCode4": "",

       "ShortcutDimCode5": "",

       "ShortcutDimCode6": "",

       "ShortcutDimCode7": "",

       "ShortcutDimCode8": ""

    }

  • star lord Profile Picture
    25 on at

    I tried the above

    POST https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Sandbox/ODataV4/Company('{compnayId}')/customerPayments

    Body:

    {
      "Journal_Template_Name": "CASHRCPT",
      "Journal_Batch_Name": "GENERAL",
      "Document_Type": "Payment",
      "Account_Type": "Customer",
      "Account_No": "20000",
      "Amount": 2000,
      "Bal_Account_Type": "G/L Account",
      "Bal_Account_No": "10200",
      "Comment": "Web service posting"
    }

    Resulting in error:

    {
       "error": {
           "code": "BadRequest",
           "message": "Does not support untyped value in non-open type.  CorrelationId:  xxxx."
       }
    }

    How can we retrieve (GET) payments then?
    I could achieve to get a payment(s) by using $filter but that is not an option for me currently

    Also, can you tell me where to look for information regarding primary keys of tables?

    Thanks
  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

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 1,496 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 961 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 870 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans