Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Sales Invoice API outstanding_amount not updated

(0) ShareShare
ReportReport
Posted on by 20

Hi,

I hope you can help me. We are using the sales invoice API to create a sales invoice. When we use the pull sales invoice API, the payload's outstanding_amount field is not being updated correctly. 

Here you can see the screenshots with the payloads information:

Response  after pushing invoice sales:

pastedimage1678721717138v1.png

Invoice Sales is correctly pulled and it shows the payment references the invoice:
pastedimage1678721764100v2.png

The invoice referenced by the payment is pulled but the remaining amount is untouched:

pastedimage1678721792761v3.png

pastedimage1678721806116v4.png

pastedimage1678721816852v5.png

  • ProductRa Profile Picture
    ProductRa 20 on at
    RE: Sales Invoice API outstanding_amount not updated

    Hey experts any help on here?

    Thanks!!

  • ProductRa Profile Picture
    ProductRa 20 on at
    RE: Sales Invoice API outstanding_amount not updated

    Thank you raibilalhaider ,

    I guess the question should be:

    Should the "remainingAmount" on the invoice decrease while the Invoice is till in status “open”, and partial payments are made?

    Yes, we have posted a Journal line. Note: the screenshots in the original post may not be the latest ones.

    Invoice Payment (partial) as Posted to MS Business Central

    {
        "_id" : "642b384010d194f4810133ee",
        "customerId" : "78ec536c-2756-ec11-bb7d-000d3aaa1396",
        "postingDate" : "2023-04-03",
        "amount" : 1000.0,
        "appliesToInvoiceId" : "301e3f21-d0a8-ed11-9a8a-000d3a9e93b2",
        "description" : "Invoice Payment: auxiliary",
        "comment" : "Invoice Payment: auxiliary",
        "documentNumber" : "C389217",
        "customerPaymentJournal" : {
            "code" : "PMT-566828",
            "balancingAccountId" : "53ec536c-2756-ec11-bb7d-000d3aaa1396",
            "displayName" : "Custom Cash Receipt Journal"
        },
        "createdAt" : "2023-04-03T20:34:07.477 0000",
        "updatedAt" : "2023-04-03T20:34:08.317 0000",
        "report_id" : "642b384010d194f4810133ed"
    }

    Invoice Payment as Pulled from MS Business Central

    {
          "@odata.etag": "W/\"JzIwOzE2MzIwMjYyMTk2NzAyNTg0MDIxMTswMDsn\"",
          "id": "0dd97ae4-5ed2-ed11-a7c7-0022482c9333",
          "code": "PMT-566828",
          "displayName": "Custom Cash Receipt Journal",
          "lastModifiedDateTime": "2023-04-03T20:34:13.35Z",
          "balancingAccountId": "53ec536c-2756-ec11-bb7d-000d3aaa1396",
          "balancingAccountNumber": "40100",
          "customerPayments": [
            {
              "@odata.etag": "W/\"JzIwOzE0MTQ2NTQxMzU5NjQ0MTEzNzA3MTswMDsn\"",
              "id": "0ed97ae4-5ed2-ed11-a7c7-0022482c9333",
              "journalId": "0dd97ae4-5ed2-ed11-a7c7-0022482c9333",
              "journalDisplayName": "PMT-566828",
              "lineNumber": 10000,
              "customerId": "78ec536c-2756-ec11-bb7d-000d3aaa1396",
              "customerNumber": "20000",
              "postingDate": "2023-04-03",
              "documentNumber": "C389217",
              "externalDocumentNumber": "",
              "amount": 1000,
              "appliesToInvoiceId": "301e3f21-d0a8-ed11-9a8a-000d3a9e93b2",
              "appliesToInvoiceNumber": "PS-INV103347",
              "description": "Invoice Payment: auxiliary",
              "comment": "Invoice Payment: auxiliary",
              "lastModifiedDateTime": "2023-04-03T20:34:15.757Z"
            }
          ]
        },

    Invoice as Pulled from MS Business Central (after the partial payment)

    • Actual Result: "remainingAmount": 5000
    • Expected Result: "remainingAmount": 4000

    {
          "@odata.etag": "W/\"JzE5OzY3Nzg0NTcyMDM4MDkxMDg3MDgxOzAwOyc=\"",
          "id": "301e3f21-d0a8-ed11-9a8a-000d3a9e93b2",
          "number": "PS-INV103347",
          "externalDocumentNumber": "",
          "invoiceDate": "2023-02-09",
          "postingDate": "2023-02-09",
          "dueDate": "2024-02-09",
          "customerPurchaseOrderReference": "",
          "customerId": "78ec536c-2756-ec11-bb7d-000d3aaa1396",
          "customerNumber": "20000",
          "customerName": "Trey Research",
          "billToName": "Trey Research",
          "billToCustomerId": "78ec536c-2756-ec11-bb7d-000d3aaa1396",
          "billToCustomerNumber": "20000",
          "shipToName": "Trey Research",
          "shipToContact": "Helen Ray",
          "sellToAddressLine1": "153 Thomas Drive",
          "sellToAddressLine2": "",
          "sellToCity": "Chicago",
          "sellToCountry": "US",
          "sellToState": "IL",
          "sellToPostCode": "61236",
          "billToAddressLine1": "153 Thomas Drive",
          "billToAddressLine2": "",
          "billToCity": "Chicago",
          "billToCountry": "US",
          "billToState": "IL",
          "billToPostCode": "61236",
          "shipToAddressLine1": "153 Thomas Drive",
          "shipToAddressLine2": "",
          "shipToCity": "Chicago",
          "shipToCountry": "US",
          "shipToState": "IL",
          "shipToPostCode": "61236",
          "currencyId": "00000000-0000-0000-0000-000000000000",
          "shortcutDimension1Code": "SALES",
          "shortcutDimension2Code": "MEDIUM",
          "currencyCode": "USD",
          "orderId": "00000000-0000-0000-0000-000000000000",
          "orderNumber": "",
          "paymentTermsId": "84eb536c-2756-ec11-bb7d-000d3aaa1396",
          "shipmentMethodId": "00000000-0000-0000-0000-000000000000",
          "salesperson": "JO",
          "pricesIncludeTax": false,
          "remainingAmount": 5000,
          "discountAmount": 0,
          "discountAppliedBeforeTax": true,
          "totalAmountExcludingTax": 5000,
          "totalTaxAmount": 0,
          "totalAmountIncludingTax": 5000,
          "status": "Open",
          "lastModifiedDateTime": "2023-02-09T23:19:03.077Z",
          "phoneNumber": "",
          "email": "helen.ray@contoso.com",
          "currency": null,
          "paymentTerm": {
            "@odata.etag": "W/\"JzE5OzQ5NDU4ODM0NTg2MTU4OTk5NDgxOzAwOyc=\"",
            "id": "84eb536c-2756-ec11-bb7d-000d3aaa1396",
            "code": "14 DAYS",
            "displayName": "Net 14 days",
            "dueDateCalculation": "14D",
            "discountDateCalculation": "",
            "discountPercent": 0,
            "calculateDiscountOnCreditMemos": false,
            "lastModifiedDateTime": "2021-12-06T00:00:17.883Z"
          },
          "salesInvoiceLines": [
            {
              "@odata.etag": "W/\"JzIwOzE4MjMwMjY4NzMyMzAxMzk2NTI4MTswMDsn\"",
              "id": "321e3f21-d0a8-ed11-9a8a-000d3a9e93b2",
              "documentId": "301e3f21-d0a8-ed11-9a8a-000d3a9e93b2",
              "sequence": 10000,
              "itemId": "00000000-0000-0000-0000-000000000000",
              "accountId": "53ec536c-2756-ec11-bb7d-000d3aaa1396",
              "lineType": "Account",
              "lineObjectNumber": "40100",
              "description": "Push Invoice: auxiliary",
              "unitOfMeasureId": "00000000-0000-0000-0000-000000000000",
              "unitOfMeasureCode": "",
              "unitPrice": 500,
              "quantity": 10,
              "discountAmount": 0,
              "discountPercent": 0,
              "discountAppliedBeforeTax": false,
              "amountExcludingTax": 5000,
              "taxCode": "NONTAXABLE",
              "taxPercent": 0,
              "totalTaxAmount": 0,
              "amountIncludingTax": 5000,
              "invoiceDiscountAllocation": 0,
              "netAmount": 5000,
              "netTaxAmount": 0,
              "netAmountIncludingTax": 5000,
              "shipmentDate": "2023-02-09",
              "itemVariantId": "00000000-0000-0000-0000-000000000000",
              "locationId": "22ec536c-2756-ec11-bb7d-000d3aaa1396"
            }
          ]
        },

  • Suggested answer
    Bilal Haider Profile Picture
    Bilal Haider 47 on at
    RE: Sales Invoice API outstanding_amount not updated

    Hi,

    Are you sure you have posted the Journal line? Because I can see the Invoice is still open, if payment is done then it should be paid.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans