Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

Can't able to Get Customer Payment through API v2.0

Posted on by 20
I can't able to find customer payment through this api :
https:/api.businesscentral.dynamics.com/v2.0/{{TeantID}}/{{env_name}}/api/v2.0/companies({{company_id}})/customerPayments


giving me value empty :
{

    /@odata.context/: https:/api.businesscentral.dynamics.com/v2.0/{tenant} /{env}/api/v2.0/$metadata#companies({com-id})/customerPayments/,
    /value/: []
}

But see i have 2 records there.
How can i get those 2 records using API v2.0?


  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 63,463 Super User on at
    Can't able to Get Customer Payment through API v2.0
    As far as I know, it's not possible with the standard API.
    There are generally two ways to do this:
    1. Let the API return the results you need: As of now, the standard API is not extensible
    2. Find the records in the posted table: There are two tables to look at. But neither has a standard API.
     
    Hope this helps.
    Thanks.
    ZHU
  • Kanta Profile Picture
    Kanta 20 on at
    Can't able to Get Customer Payment through API v2.0
    Thanks a lot YUN ZHU,
    can you do me one more favor please.

    when i'm posting cash recipt journal record my webhook give me response like this.
    But as the line is posted, it got delete from customerPayments, so i can't get the relevent information about the customerPayment. i need to know which customer has paid on which invoice. 
    how can i get the information?
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 63,463 Super User on at
    Can't able to Get Customer Payment through API v2.0
    Hi, Sorry, it looks like you are doing it right. However, Microsoft has filtered the results. The following three conditions must be met to obtain them from the standard API.
     
    Two Examples:
    https://api.businesscentral.dynamics.com/v2.0/c8558e71-6ad8-4fcd-9f29-3ca165b41bbe/Sandbox241/api/v2.0/companies(938320db-e10b-ef11-9f8d-6045bdacaf36)/customerPaymentJournals?$expand=customerPayments
     
    https://api.businesscentral.dynamics.com/v2.0/c8558e71-6ad8-4fcd-9f29-3ca165b41bbe/Sandbox241/api/v2.0/companies(938320db-e10b-ef11-9f8d-6045bdacaf36)/customerPayments?$filter=journalId eq 587cf070-a414-ef11-9f88-000d3a50c332 and id eq f7afd139-4621-ef11-9f88-00224868ce08
     
    PS: When taking values ​​directly, you must add at least one filter.
     
    Hope this helps.
    Thanks.
    ZHU
  • Kanta Profile Picture
    Kanta 20 on at
    Can't able to Get Customer Payment through API v2.0
    Thank you for your guide, Mr. YUN ZHU.
    I actually tried putting system id in URL like this /customerPayments({systemId})
    but I am getting error resource not found.
    I'm not getting it, why I can't get those record, or how should I approach to get those records?


  • YUN ZHU Profile Picture
    YUN ZHU 63,463 Super User on at
    Can't able to Get Customer Payment through API v2.0
    Hi, Try adding SystemId?
     
     
    Hope this can give you some hints.
    Thanks.
    ZHU
     

Helpful resources

Quick Links

First Dynamics 365 Community Call (CRM Edition)

Don't miss the first D365 Community Call on 7/10!

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 285,557 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,484 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans