Feasibility of my idea to be developed in motoko (pseudo-code for payment process)

Hi all

I started learning coding Motoko whilst working on my own idea.

I got the basics but now for some more advanced stuff I wanted to verify the feasibility of my thoughts before searching wild the right Motoko code

The pseudo-code goes like this:

  1. User logs in (connect with wallet) → [DAY 4 | LECTURE] Lecture: Identity & Authentication on the Internet Computer - YouTube

  2. User sees his ICP balance (like when you connect somewhere with your Ethereum wallet)

  3. User can check a product (e.g. which costs 1 ICP) including some input text and clicks the PAY button

  4. 1 ICP is transfered from the User wallet to the project (canister) wallet (e.g. company wallet1)

4.1. if the transfer of 1 ICP was a success, we save the information of UserID, UserWallet, Amount in ICP, and Timestamp in some data structure (to keep it for the books)

4.2. the product which he bought gets triggered after successful payment → in my case it should be a function that stores some input text data in an array → again we need to store UserId, InputText, timestamp

4.3 the user gets notified that the payment was successful and sees 1 ICP deducted from his wallet

  1. the user sees in a table that he has bought the product successfully and also the timestamp and text input

  2. if the payment was not successful no money is transfered from the user wallet to our company wallet1

  3. we provide money back: as an admin, I can select an order and the amount (e.g.) 1 ICP is sent back to the user who bought the product (this should be possible because we saved his wallet address in step 4.1.

I appreciate all kinds of help and feedback if the Ledger Canister gives me a solution to this. Also if you have seen somewhere some code snippet or example (code, youtube video, you name it) please don’t hesitate to flood me with this information.

I hope I am able to code these steps with the Motoko language.

Best, Gizzy