Receipt endpoints not functioning as intended?

Hi folks,

Working on a receipts app (more info soon :eyes:), running into a couple issues though…

First off, can’t seem to GET /transaction-receipts:

GET https://api.monzo.com/transaction-receipts?external_id=xxxxxx

{
    "code": "bad_response.marshaling",
    "message": "Error marshaling: tax and amount currency mismatch (tax:  amount: GBP)",
    "params": {
        "amount_currency": "GBP",
        "tax_currency": ""
    }
}

also, can’t DELETE:

DELETE https://api.monzo.com/transaction-receipts?external_id=xxx

{
    "code": "forbidden.insufficient_permissions",
    "message": "Access forbidden due to insufficient permissions",
    "params": {
        "client_id": "xxxx",
        "user_id": "xxxx"
    }
}

Any idea?

(cc @Liam_W, running into the same issues as me)

1 Like

In addition, whilst working on an Uber implementation, I’ve found that float quantities and custom units don’t seem to be reflected in the iOS app - floats are rounded, and the units aren’t shown at all (the app displays an x as the quantity).

Just chiming in as a developer facing the same issues with the API, if anyone from Monzo could help out, that’d be mighty useful :wink:

1 Like

The first error looks like there might be a problem with the receipt you’ve sent us! (Obviously it shouldn’t be quite so unhelpful, but hopefully this helps a little.)

Can you share the receipt you sent us, to see if we can spot the problem?

Sure. Here’s what I’m sending -

{"transaction_id":"tx_00XXXXXXba","external_id":"tx_00XXXXXXba","total":400,"currency":"GBP","items":[{"description":"xxxxxx.","quantity":1,"unit":"x","amount":400,"currency":"GBP","sub_items":null}],"taxes":null}

to note: this was tried also without specifying any taxes & tried with taxes:[]

Same response -

{
    "code": "bad_response.marshaling",
    "message": "Error marshaling: tax and amount currency mismatch (tax:  amount: GBP)",
    "params": {
        "amount_currency": "GBP",
        "tax_currency": ""
    }
}

More than happy to share specific transaction IDs / my Monzo account email over DM if needed.

Surely if it was a problem with what was sent the API would reject it there and then & not apply it on the transaction? :slight_smile:

@tjvr Yeah, I was using the same data. @tbowditch might give you access to the application we’ve been creating so can you see clearly.

I’m also willing to provide any tx ID’s if you want to investigate further :+1:

Happy to provide whatever’s needed. :slight_smile:

Random thought: what happens if you don’t send taxes: null? Just omit any mention of taxes at all?

Same thing happens! :frowning:

Out of interest, can receipts work with currencies other than GBP? I can’t seem to get them to work either…

They should be able to. IIRC, there’s a currency field for line items?

There is indeed, and I have been setting them as per the documentation (I think):

{
  "transaction_id": "tx_",
  "external_id": "ex_",
  "currency": "USD",
  "items": [
    {
      "description": "Item 1",
      "quantity": 1,
      "amount": 999,
      "currency": "USD"
    },
    {
      "description": "Item 2",
      "quantity": 1,
      "amount": 999,
      "currency": "USD"
    }
  ],
  "taxes": [
    {
      "amount": 164,
      "currency": "USD",
      "description": "Sales Tax"
    }
  ],
  "total": 2162
}

EDIT: Could also be because I’m trying to add this receipt to a transaction made with the old prepaid card account, would be great to confirm :smile:

I would be surprised if that worked!

Rather than omitting taxes altogether, I send an empty object "taxes": [] which works well for my TFL integration.

It also appears that tax is actually required for the items (and presumably sub-items).

As mentioned I send an empty array (rather than omitting) and works well for what I do with it

For whatever reason I’m seeing:

  • Empty taxes array with tax: 0 in receipt, items and sub items - I can get the receipt back.

  • Empty taxes array with tax not in receipt, items and sub items - Error on getting the receipt back.

  • No taxes array and no tax in receipt, items and sub items - Error on getting the receipt back.

  • No taxes array with tax: 0 in receipt, items and sub items - I can get the receipt back.

    {
    “external_id”:"…",
    “transaction_id”:“tx_…”,
    “total”:2100,
    “currency”:“USD”,
    “items”:[
    {
    “description”:“agile-falls-12228 (Rob Bot)”,
    “amount”:0,
    “currency”:“USD”,
    “sub_items”:[
    {
    “description”:“Dyno [Bot]”,
    “amount”:0,
    “currency”:“USD”
    },
    … Some more sub items like the one above …
    ]},
    … Some more items like the one above …
    ],
    “payments”:[{“type”:“card”,“amount”:2100,“currency”:“USD”,“last_four”:"…"}],
    “merchant”:{“name”:“Heroku”,“online”:true}
    }