Forum Discussion

The_Doc's avatar
The_Doc
Ultimate Cover User
2 days ago

AR 2025 converting Order to Invoice via API

Hi Folks

I have just, yesterday, been asked to add another component to my integrator  (web - integrator - myob file ). 

 

I think I know the answer i.e. the API doesn't permit patch updates but there might be a component I haven't forseen.

 

My integrator takes Orders from a web cart - processes them and sends them to MYOB as a double component.

  1. Sales order - either on an account or paid for by a guest account by credit card.
  2. An order which uses the components from the inventory system ( an in house admin component) - if there aren't enough inventory it will create a B Order - and will check inventory before each new orders to see if any B Orders can be filled - if so it DELETES the B Order and lodges a Sales invoice for the in house - component use. ( complex - but it works beautifully)

This was all set in place because human admin staff were dropping the ball in the factory and Orders/BOrders/inventory was a shambles.

 

The latest ask - is again because human staff majorly DROPPING THE BALL.

 

When an order is completed - the SALES ORDER for the client - which are mostly account customers - needs to be converted to an invoice and sent out to the customer - last month $170,000 of completed work NOT invoiced - yep!!!!

 

I have been asked to add feature to do this.

 

Questions

  1. I don't think there is a simple way via an API endpoint to convert an order to an invoice - I think I need to DELETE the ORDER and resend as an INVOICE ?? - no matter - I do this for a B Order anyway.
  2. You cannot DELETE an Order if a payment has been applied to that Order - ?? (MYOB has an awful way of applying a payment to an order that completely jams it so even if you delete the payment you cannot delete the order - the only way around this appears to be NEVER APPLY A PAYMENT to an ORDER - ( have done this successfully for another client this method)  - you put the monies into a liability account ( or asset - doesn't matter - naming it correctly so it can be traced)  - when an order is filled you convert the Order to a Sale - THEN apply payment as the ORDER has a NB: line - payment has been received etc.

Thoughts, ideas?

 

The Doc

  • JeremyF's avatar
    JeremyF
    Experienced User

    Hi Doc,

     

    You should be able to post the order UID to the /Sale/Invoice/{UID} end point. That will create your invoice/bill. The Order isn't deleted in MYOB. 

    see Item

     

    This will create an invoice for the sales order.

    AS for payments these can be created using /Sale/CustomerPayment

    see CustomerPayment

     

    We use these two endpoints in a similar way to you. 

     

    Cheers

    Jeremy

     

    • The_Doc's avatar
      The_Doc
      Ultimate Cover User

      Thanks Jeremy

       

      My point was it seems you have to 'resend' the Order to the /Sale/Invoice/ endpoint - i.e. there is no way to magically trip the order to a sale as you can in the front end with the SALE button.

      No matter - have already started building ORDER saving in the integrator so I don't have to rebuild the Invoice.

       

      DELETING the ORDER is easy - works for my B Order system where I have to delete the existing B Order and regenerate if B Order can't be filled in-full and post a part invoice.

       

      As for payments - if a customer pays for an order - the staff apply a payment to that ORDER - locking it - and locking the payment to that ORDER - so posting an Invoice for this ORDER then creates an orphan payment - a very messy affair in MYOB  to unscramble.

       

      Ask, will be to stop admin staff doing this - however, instead of customer payment ( which is only a guest - not really a customer - my intention is to just add a sales invoice line - called 'payment' to the invoice which credits the deposit acct in liability or assets.

       

      The Doc