Skip to main content

Notifications

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?
  • Suggested answer
    Marco Mels Profile Picture
    on at
    RE: Unable to create a customer payment with ODataV4 web service?

    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.

  • star lord Profile Picture
    25 on at
    RE: Unable to create a customer payment with ODataV4 web service?

    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
    JAngle Profile Picture
    95 on at
    RE: Unable to create a customer payment with ODataV4 web service?

    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": ""

    }

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,200

#2
YUN ZHU Profile Picture

YUN ZHU 1,006 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 864

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans