Receipts API - Permissions error with DELETE

Hey everyone!
Thanks to everyone in the community, I’ve been lurking for a while during my build! I’ve been working on a PHP Monzo API client on a raspberry pi, and I’ve got every single API endpoint working, including Adding and Getting a Receipt attached to a transaction, however I’m completely stuck with the Delete Receipt API.

For the same receipt that I can “Add” and “Get” with no problems, I cannot seem to delete it.

The closest issue I could find was on Receipt endpoints not functioning as intended? - Developers - Monzo Community and I’ve tried adding both an empty array to taxes, also tried adding tax info to each item but it still will add and get but not delete.

Here is my receipt that I have added

(
    [receipt] => Array
        (
            [id] => receipt_0000ABkSssSQg5INRrISpN
            [external_id] => rpi_monzo_receipt_1
            [transaction_id] => tx_0000ABiaHe9BKbvpcRxtaM
            [proof_of_purchase_id] => 
            [total] => 1199
            [currency] => GBP
            [merchant] => Array
                (
                    [name] => 
                    [online] => 
                    [phone] => 
                    [email] => 
                    [store_name] => 
                    [store_address] => 
                    [store_postcode] => 
                )

            [payments] => Array
                (
                )

            [taxes] => Array
                (
                )

            [items] => Array
                (
                    [0] => Array
                        (
                            [description] => RPi RF11 Breakout Board
                            [quantity] => 1
                            [amount] => 1199
                            [currency] => GBP
                            [tax] => 0
                            [sub_items] => Array
                                (
                                )

                        )

                )

            [barcode] => 
        )

)

The error I get is:

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

I had the same error the first time I tried to implement GET - none of my receipts would return using the GET api - this was to do with taxes, when I added an empty tax array they will suddenly return with the GET endpoint.

I’m really scratching my head.

The documentation is really excellent for the API and I’ve been able to follow it all up to this point.

Any help / pointers would be appreciated!

Thanks
Tom

Been doing the samein Python myself but not got to receipts as of yet. An absolute stab in the dark (and I may be completely incorrect) but what is the date on the transaction, is it possible it has gone beyond the 90 day period.

Not sure if attaching.deleting receipts are affected by the 90 day restriction if the token is over 5 minutes old.

Ah good shout, will re-create access token and try again within the five minutes, and report back!
Thanks!

I have returned to this project many years later. I never got it working with python, but am now able to GET receipts using node requests - PeteMcD you were very helpful with the tax:0 issue that prevents pulling receipts if each item doesn’t contain it.

I have now created a receipt which I am PUTTING with:

{
    "transaction_id": "tx_0000B1ulyaUybqWbnCWgZ2",
    "external_id": "receipt-tx_0000B1ulyaUybqWbnCWgZ2",
    "total": 3000,
    "currency": "GBP",
    "items": [
      {
        "description": "Some Charging",
        "quantity": 100,
        "unit": "kWh",
        "amount": 30,
        "currency": "GBP",
        "tax":0
      }
    ]
}

I can call GET and receive a payload that is accurate, and updating, however when I send a DELETE request, I get:

{

    "code": "forbidden.insufficient_permissions",

    "message": "Failed to authorize",

    "params": {

        "client_id": "xxx",

        "external_id": "receipt-tx_0000B1ulyaUybqWbnCWgZ2",

        "user_id": "xxx"

    },

    "retryable": {},

    "marshal_count": 3,

    "message_chain": [

        "Access forbidden due to insufficient permissions"

    ]

}

All keys are active and refreshed, and I get the same error with all DELETE receipt requests.

If anyone has successfully implemented DELETE I would be grateful for any help!

Thanks

1 Like

I have not played with the API for a while but looking at the README in my own code I have the comment “No, Functionality currently broken” in relation to deleting receipts which suggests I could not get it to work. I originally thought it was due to the tax issue as well but even after this it continued to fail, not entirely convinced the endpoint works properly but I could be wrong. Might have another play with it over the weekend. I keep meaning to integrate it into another project so will give me opportunity to mess around with it again

1 Like