Options

What exactly is the the `anchor` account in a `MoneyTransaction`?

nigelwheelernigelwheeler Member Posts: 20

Hi,
I'm experimenting with the MoneyTransactionCreateInput mutation in the API. It 'nearly works' but can't figure out what the "anchor" is about (MoneyTransactionCreateAnchorInput).

For my test, my assumption is that this is the Asset account the transaction relates to, so I've use the id for the "Cash on Hand" account, with direction "WITHDRAWAL".

My transaction lines are a CREDIT to this account and a matching DEBIT to the id of a random expense account (accounting fees).

The runtime inputError I'm getting is:

"code": "UNKNOWN",
          "message": "This value is invalid. MULTIPLE_POSSIBLE_ANCHORS",
          "path": null

Query & Variable syntax otherwise all seems OK, Full thing:

mutation ($inputMoneyTransactionCreate: MoneyTransactionCreateInput!) {
  moneyTransactionCreate(input: $inputMoneyTransactionCreate) {
    didSucceed
    inputErrors {
      code
      message
      path
    }
  }
}
{
  "inputMoneyTransactionCreate":{
    "businessId":   "QnVzaW5lc3M6ZTMzMzVjMDQtMDg1Mi00OTIxLWE2NTktZjM1YjgxYjQwMTU2",
        "externalId":   "MyExternalID", 
        "date": "2019-11-22",
        "description":  "MyDescription some accounting fees",
        "notes":    "blah blah blah",
        "anchor": {
      "accountId":"QWNjb3VudDo2MzE2MzcyNjEzMTM2ODY4NTU7QnVzaW5lc3M6ZTMzMzVjMDQtMDg1Mi00OTIxLWE2NTktZjM1YjgxYjQwMTU2",
        "amount": 1.99,
      "direction": "WITHDRAWAL"
    },
        "lineItems":    [{
      "accountId":"QWNjb3VudDo2MzE2MzcyNjM2NjI0OTcxNjU7QnVzaW5lc3M6ZTMzMzVjMDQtMDg1Mi00OTIxLWE2NTktZjM1YjgxYjQwMTU2",
        "amount": 1.99,
      "balance": "DEBIT",
      "taxes": []
    },
      {
      "accountId":"QWNjb3VudDo2MzE2MzcyNjEzMTM2ODY4NTU7QnVzaW5lc3M6ZTMzMzVjMDQtMDg1Mi00OTIxLWE2NTktZjM1YjgxYjQwMTU2",
        "amount": 1.99,
      "balance": "CREDIT",
      "taxes": []
      }
    ]
    }
}

Comments

  • Options
    dshatzdshatz Member Posts: 1

    Having the same issue

  • Options
    PaulCPaulC Member Posts: 186 ✭✭✭

    Hi @nigelwheeler,

    As you say - you're close!

    The best way to think about this is to keep in mind what a categorized transaction looks like in Wave:

    • A deposit or withdrawal to a bank or credit card account
    • One or more lines of categorization (which could be 'uncategorized income' or 'uncategorized expense' in a default state.

    The MoneyTransacationCreate mutation has the same shape. The bank/credit card account from which the transaction takes place is the Anchor; the line items are the categorizations. Therefore, in your example, you do not need to repeat the Cash on Hand account in the line items; you should have just one line item, which is your accounting fees expense account.

    A separate point to note is that you appear to be confusing DEBIT and CREDIT direction. If it were correct to have 2 line items, you should actually be CREDITING cash on hand and DEBITING accounting fees expense. If you would like to fully understand Debits and Credits, please refer to Accounting Coffee Break #5 in Fearless Accounting with Wave, which explains this topic. More simply, use the convenience directions INCREASE and DECREASE, which work out when to Debit and when to Credit for you.

    In summary:

    • WITHDRAW from your anchor account
    • categorize as an INCREASE of accounting fees expense in your line items.

    Hope that helps. Paul

    cc @dshatz

  • Options
    nigelwheelernigelwheeler Member Posts: 20

    @PaulC Thanks for your help.

    So just to clarify, the anchor account is an asset (cash or bank/credit card) account which payment is being made to or from, the line items are the balancing entries/splits (expenses, income etc.) on the other side of the transaction.

    I think this was my original assumption but when I got an error (from using wrong account code, see below) I started to explore the idea that the line items should themselves be in balance.

    Perhaps the docs could be enhanced a bit to clarify?

    p.s. If you look very very closely you'll see I was trying CR the same account in the lines as my anchor account, mistakenly thinking this was the node id for Cash in hand when it wasn't, caused by using copypasta with horribly similar strings in graphiql editor rather than getting account codes programmatically.

  • Options
    PaulCPaulC Member Posts: 186 ✭✭✭

    Correct, yes.

    Although, to be strict, the anchor account is an asset (cash and bank) or liability (credit card / LoC) account. In either case, WITHDRAWAL means you are spending money; DEPOSIT means you are receiving it (in the case of a credit card, therefore, paying down your debt).

    Agreed, IDs are not exactly human-readable!

  • Options
    bluetonguedigitalbluetonguedigital Member Posts: 3

    Hi there,

    I have been trying to set up an API call to create a transaction on an account, but I was just hoping for some clarification on the 'anchor' and 'line item' schemas.

    My understanding is that the anchor account is a bank account/credit card and the line items for each transaction must have a credit & debit for the transaction, and an expenses/income account that is attached to the anchor account. Is that correct?

    In terms of the anchor account, how am I able to see the ID of each account in my Wave business? Is this the ID that is set when a new account is created, or is it found somewhere else?

    Thanks for your help!

    Daniel

  • Options
    AlexLAlexL Member Posts: 2,869 ✭✭✭

    Hey @bluetonguedigital . I merged your thread into this one as it should have all the answers you need. Don't hesitate to reach back out if you find that you still have unanswered questions.

    edited January 16, 2020
  • Options
    bluetonguedigitalbluetonguedigital Member Posts: 3

    Hi @AlexL - thanks for that, definitely clears up a few questions!

    The main thing I'm still wondering is how I'm able to get the ID for the anchor account? Is there a GraphQL query I can find it in, or is this the ID that is set when a new account is created?

    Thanks!

  • Options
    nigelwheelernigelwheeler Member Posts: 20

    @bluetonguedigital - There's an example for getting account ids filtered by type here -

    Change the BUSINESS ID query variable for your own.
    In the main query, substitute the accounts(types: [INCOME]) filter value for appropriate AccountTypeValue(s) i.e. [ASSET] for your bank accounts/cash etc. [LIABILITY] for your credit cards (or you could use [ASSET, LIABILITY] to get both types)

    Once you've identified the correct account in the results then yes, use the id value for that as the accountId in the query variables your moneyTransactionCreate

    Hope that helps!

    edited January 17, 2020
  • Options
    bluetonguedigitalbluetonguedigital Member Posts: 3

    @nigelwheeler That's perfect, thank you so much for the detailed explanation! Really appreciate it :smile:

  • Options
    chklffchklff Member Posts: 5

    @PaulC
    How to distinguish income accounts?
    Here is an example:

    In some accounts, this will lead to:

    Thank you in advance!

  • Options
    PaulCPaulC Member Posts: 186 ✭✭✭

    Hi @chklff,

    To isolate Income Accounts, the best starting point would be to filter your query only to accounts whose type is INCOME. There's an example of how to do this in the docs.

    I'm not sure from your question what you are trying to achieve. If you want to only select the kinds of account that a business would actually earn its main revenue in, then I would suggest you filter on subtype, which in this case should also be INCOME. (Other subtypes of the INCOME type are used for incidental income such as bank interest, etc - i.e. not core business revenue.)

    Please note in the unfiltered list that you copied, the System Receivable Invoice accounts would only very rarely be useful to you. These are internal system accounts used by Wave for tracking invoices payments, and each Account relates to a single Invoice only.

    Hope that helps!

    edited April 9, 2020
  • Options
    prasad_mohanprasad_mohan Member Posts: 3

    I would really appreciate it if someone could help me on this. Is it possible to pass the invoice ID through the API to be marked as paid.

    From the above screenshot, I have the ability to select the invoice(Payment Received for an Invoice in Wave) at the frontend, Is it possible through the API. I could only see account ID can be passed. I even tried passing the invoice ID with an error

    Thanks

    edited June 25, 2020
  • Options
    RobVGRobVG Member Posts: 53 admin

    Hi @prasad_mohan,

    We recently started the work to record a manual payment on an invoice via the API. This would likely address your question. We hope to have it available by the middle of July. It would mirror this functionality:

  • Options
    prasad_mohanprasad_mohan Member Posts: 3

    Thank you @RobVG

  • Options
    prasad_mohanprasad_mohan Member Posts: 3

    Hello @RobVG ,

    Can you please let me know whether this feature has been rolled out? Have been waiting for this to be integrated in my project.

    Thanks

  • Options
    MilanMilan Member Posts: 14

    Hi @RobVG @PaulC @AlexL
    I am trying to create a transaction to mark one of the invoices paid.
    Like @chklff I have got the list of all RECEIVABLE_INVOICES accounts

    query {
    business(id: "XXX") {
        name
        accounts(subtypes: [RECEIVABLE_INVOICES], page: 1, pageSize: 45) {
        edges {
            node {
              id
    
               }
            }
        }
        }
    }
    

    There is (it seems) one account for each invoice I've created.

    What I am wondering is how to identify accountId for the invoice for which I am creating transaction?

    I've asked the same question here :grimace:https://community.waveapps.com/discussion/8859/how-to-find-which-account-receivable-invoice-corresponds-to-invoice#latest

    edited August 5, 2020
  • Options
    teabagteabag Member Posts: 3

    Can journal transactions be made using the moneycreatetransaction command on the API?

  • Options
    PaulCPaulC Member Posts: 186 ✭✭✭

    Hi @teabag ,

    Great question.

    No, the MoneyTransactionCreate mutation creates only 'anchor' type transactions - i.e. those where there is a deposit or withdrawal from a bank/credit type account, categorized with 1 or more line items.

    A more general TransactionCreate mutation is something we are thinking about, to allow you to also create Journal transactions.

  • Options
    teabagteabag Member Posts: 3

    @PaulC said:
    Hi @teabag ,

    Great question.

    No, the MoneyTransactionCreate mutation creates only 'anchor' type transactions - i.e. those where there is a deposit or withdrawal from a bank/credit type account, categorized with 1 or more line items.

    A more general TransactionCreate mutation is something we are thinking about, to allow you to also create Journal transactions.


    That would be amazing, actually.
    I much prefer accrual-based accounting and would like accruals to accumulate in real time as I obtain sales (to account for royalties and the like).

  • Options
    MilanMilan Member Posts: 14

    @RobVG do you know when we can expect API to record a manual payment on an invoice.
    Or alternatively can do you know the answer to my question above?

    Thanks

  • Options
    RobVGRobVG Member Posts: 53 admin

    Hi @Milan,

    We are aiming for end of August to have the manual invoice payment work completed. We had some other unexpected priorities come up that pushed this work back a bit, sorry for the delay from what I previously communicated.

    There is no discoverable way currently to link a specific Account to an Invoice. I would recommend using the invoice payment functionality when it becomes available.

    Regards

  • Options
    MilanMilan Member Posts: 14

    @RobVG Hi Any updates on this?

  • Options
    MilanMilan Member Posts: 14

    Hi @RobVG Any update on this :smile:

  • Options
    Linda_ByrneLinda_Byrne Member Posts: 13 admin

    Hi @Milan ,

    We are currently testing this functionality internally and will add it to the public api soon, thanks for your patience.

    Best regards,
    Linda

  • Options
    MilanMilan Member Posts: 14

    Hi @Linda_Byrne @RobVG and the team, is there any update on this?

Sign In or Register to comment.