Creator of QR code must also store data

Hi guys im really really stuck.

In my app I have a user that creates a QR code with some basic info (product, amount)
and another user that scans that QR code.
If the transaction is succesful the user that SCANS the QR code gets the transaction info stored in firebase, basic info (product, amount, date), (and gets that data shown on a listview, inside the app).

What I have no idea how to do is, if the transaction is succesful for the user the CREATED the QR code to also get the transaction data stored in the firebase database and to have the info shown ON HIS side of the app.

Ive tried it out with tinydb and cant seem to get it done…

Can anyone, please help me out with this???


What you are doing here is describing two different processes.
Creating a QR code is the first, done on person A device.
But if the scanning is done by your app installed in another user’s B device, then it is for this second process running in B to close the loop. Which means that your app has to send the information back in some way.
TonyDB is local, B would not send anything out. That means that you have the second part of your app send something out.

Basically, you would need to have the QR code to encode the basic info of product and amount, and ALSO to encode the instructions on where and how to send the successful info back to A. That would probably mean updating a specific Firebase file that belongs to A, but is allowed to be updated by your app running in B’s machine.

Is this what you wanted to clarify?

Thanks for the response Vincent!

Yes, thanks for putting in terms I can understand, this is exactly what I need to do.
So I would have to have the generated QR Code encode the instructions.

What I need device A user to be able to do is after that QR code is scanened to get some info:

  • If the transaction was succesful
    - get the user name of device B user
    - get the amount
    - get the product
    - get the date

(I guess I can get amount, product and date from side A, but from side B I would need to get the user name and if the transaction was succesful).

Ive been stuck for like 2 days on this.

Presumably, user B would have to have gotten his specifics in there. Suppose that B wants to order headphones. Evidently, B would have to put his name and address for it to be delivered, right?
So, when user B installs the application, the first run would have to request “please enter your name and address” so that information can be made available.
You can made it such that the app asks to confirm it (“please verify that your address is current” and shows what it presently has stored in TinyDB), and when the transaction is completed, the name and address is then packaged with the amount, product code, and time and then sent out to the Firebase database.

Vincent, thats the part thats not clear to me, I have user B data available, how can I send it to user A? How can I package it with the rest of the data? how do I request that data with the QR code encoded instructions?

Because user B transaction data, goes under his UserID, and user A transaction data needs to go under his UserID.

Thanks so much!

Your app running in user B’s device has to be the one sending it out.
That means your app has to prepare a record with all the information and save it in Firebase.

The QR code prepared by your app running in A’s device would have to include the Firebase ID of A’s store, so that B device would know where to send that record.

Thanks Vincent!

Its still a bit cloudy to me but i´ll try some things out, taking this concept into account.

I know its a lot, but if you ever get the chance, a quick, generic and very simple example with blocks could really help me understand better.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.