How to retrieve receipt for a transaction?


(Radek Simko) #1

I played with the new receipts API and I thought I’d just explore how the receipt data from Flux is formatted behind the scenes, just so I can see a real example that’s actually being rendered in the app.

What I can’t figure out is how to retrieve a receipt based on a transaction. It seems that it’s only possible to retrieve receipts by their external IDs, which presumably Flux (or the given integrator who submitted the receipt originally) knows, but nobody else?

The app has a way to show receipt when tapping on a transaction, so the relationship must be stored somewhere and exposed via API, which the app uses, if I’m not mistaken, so where is it hiding? :ghost:

:thinking:


(Kieran McHugh) #2

You can’t retrieve or edit receipts submitted by other developers, only your own at the moment.


(Radek Simko) #3

So what I hear you saying is “we don’t expose that through the public API (yet)”, am I right? :stuck_out_tongue_winking_eye:

i.e. there isn’t parity between the API used by Monzo apps and the one exposed & documented at https://docs.monzo.com/ which explains why the app is able to display receipts.


(Kieran McHugh) #4

They are entirely different APIs.

The API used by the app is the Transaction Widgets API, where one possible widget is the Receipt. Data for the receipt widget is obtained from the Receipts service. Data can be added to the Receipts service using the Receipts API.

In other words, the Receipts API is an ingress API. The Transaction Widgets API is a projection of this data used by the apps to power the transaction details screen.

I did a talk on how this works yesterday:


(Radek Simko) #5

Thanks for clarifying this. It makes a lot sense from scalability perspective. :+1:

I actually saw your talk yesterday and remember mentions of widgets, but somehow didn’t realize or forgot that this reflects the API structure too.

I assume that Transaction Widgets API is not public yet, but will become at some point when there’s more integrators (other than just Flux) and when you feel safe to commit to a stable-ish interface?


(Jolin) #6

Does this mean there are plans to allow us to retrieve receipts from other developers in the future? :grin::pray:


(Michael) #7

On the Receipts API, if you specify a quantity for one of the “sub_items” it’s not actually displayed at all in the receipt? Is this deliberate?

Was looking to do split out a meal into drinks/food, and so each sub item of “drinks” might be “beer”: 3 @ £5 each or something… so would be quantity 3, with amount of “300”

Thoughts?


(Dan) #8

I get an error when trying to make a receipt…

{
“code”: “forbidden.insufficient_permissions”,
“message”: “Access forbidden due to insufficient permissions”,
“params”: {
“client_id”: “xx”,
“user_id”: “xx”
}
}


(Michael) #9

Is the transaction ID correct?


(Dan) #10

Nope :rofl::rofl: I got it working thanks!

This is so cool! Someone needs to make an app so people can add their own :stuck_out_tongue: