Forum Discussion

Sidath's avatar
Sidath
Contributing User
2 months ago

How to add the due date when posting an MYOB invoice from the API

We post sales invoices from third-party software to MYOB AccountRight. We can post invoices to MYOB but can't set the Invoice Due Date. Without Due Date, it works well and AccountRight Invoice is set as "Cash on delivery". What we need is to put it as "Due on this day" with the due date we sent.

 

  "Terms": {
    "PaymentIsDue": "Dueonthisday",
    "DueDate": "2024-07-26T00:00:00"
  },  

 

Invoice Terms have been sent as above (Full JSON file is attached here). But I get the validation valid error: "Unexpected value for 'Terms.PaymentIsDue': Cannot convert 'Dueonthisday' to a valid value."

 

Does anyone know how to post the due date? 

  • Sidath's avatar
    Sidath
    Contributing User

    I have figured it out. Thanks for the help guys.

     

    The balance due date is the number of days needed to calculate the due date.

     

    "PaymentIsDue": "InAGivenNumberOfDays",
     "BalanceDueDate": 2

     

  • Sidath's avatar
    Sidath
    Contributing User

    I'm still stuck on this. What I want to send the specific due date comes from a third-party system.

     

    I set the "PaymentIsDue" to "OnADayOfTheMonth" and "BalanceDueDate" to several days from the invoice date. 

     

    However, once it reached MYOB, the due date was calculated as the last day of the month on the invoice date and added to "BalanceDueDate" value.  

     

    "PaymentIsDue": "OnADayOfTheMonth",
     "BalanceDueDate": 2

     

    Can anyone help me?

  • JeremyF's avatar
    JeremyF
    Experienced User

    Mate you'll have to use the exact term with capitalisation as described in the API documentation. Try OnADayOfTheMonth with the date you want

     

    • Sidath's avatar
      Sidath
      Contributing User

      Thanks Mate,

       

      It is case-sensitive. Now I managed to post it with OnADayOfTheMonth. What I want is to set the due date that I provided. So which predefined term can be used to set the Due Date?    

      With this term, the due date is always set to the last day of the month. 

      • JeremyF's avatar
        JeremyF
        Experienced User

        Did you provide a date?

         

        "Terms": {
            "PaymentIsDue": "OnADayOfTheMonth",
            "DueDate": "2024-10-15T00:00:00"
          },  

  • Sidath's avatar
    Sidath
    Contributing User

    Hi Jeremy,

     

    Thanks for your reply. 

     

    Yes, that's what I'm trying to do.

     

    Refer to the below screenshot. These are the predefined terms available on our company file. So I tried to send "Due on this day" with the due date (see the JSON file). But it didn't work. It sent a validation fail message.  

    I have tried all these predefined terms but none of them worked. 

     

  • JeremyF's avatar
    JeremyF
    Experienced User

    https://developer.myob.com/api/myob-business-api/v2/sale/invoice/

     

    Sidath you may need to use the predefined terms. 

    • Default Terms of Payment definitions:
      CashOnDelivery
      PrePaid
      InAGivenNumberOfDays
      OnADayOfTheMonth
      NumberOfDaysAfterEOM
      DayOfMonthAfterEOM