Luigi Payment System is a sub-module of Luigi project. It accepts coins and PayPal for payment. This repository includes the payment server, a mock client and Node-RED dashboard for interaction with customer.
The system requires both software and hardware elements. The payment system runs on Raspberry Pi, counts coins via a coin counter, polls PayPal e-mail to check whether payment received and communicates with other Luigi modules via ROS.
- Raspberry Pi 3B
- CH-926 Multi Coin Acceptor
- ROS Melodic
- Node-RED
- Roboy Communication
- Python packages
- To install required python packages please run
pip install -r requirements.txt
- To install required python packages please run
- Clone or download luigi_payment repository
git clone https://github.com/Roboy/luigi_payment.git
- Make sure that everything is connected according to circuit scheme, see below.
- Edit
luigi_payment/src/server.py
accordingly (See Payment Server). - Change
httpStatic
to local luigi_payment (See Setup httpStatic) to show image in user interface. - Import
luigi_payment/node-red-payment-ui/flows.json
and deploy it (See Import and Deploy Flow).
For very detailed information about how to setup please visit How to Set-up and Start Payment System page.
- Start ROS
roscore
- Start Node-RED
node-red
- Create
credentials.txt
inluigi_payment/src
folder and put your e-mail on the 1st line, your password on the 2nd line. - Start payment service
python luigi_payment/src/server.py
After these steps payment service should be up and running. Type rosservice list
and search for payment_server
.
You can see Node-RED interface from any device that is connected to the same network which Raspberry Pi is connected to. Open a browser and go to
RASPBERRY_PI_IP:1880/ui
.
In this section, you can find explanations of the scripts and other files.
luigi_payment/src/server.py
handles two payment methods which are coins and PayPal and it supports English and German for PayPal payments.
In order to run it, start roscore
, node-red
and then start server.py
via python luigi_payment/src/server.py
- The scripts expect
credentials.txt
file on the same folder which isluigi_payment/src
.- 1st line should be e-mail address.
- 2nd line should be your e-mail password.
- You can change the following lines in
luigi_payment/src/server.py
to fit your needs.
MAX_COIN_WAIT_TIME = 60 # in seconds
MAX_PAYPAL_WAIT_TIME = 120 # in secons
INPUT_PIN = 3 # Raspberry Pi GPIO pin to read coin counter output.
EXTRA_WAITING_TIME = 10 # in seconds
PRICE_CHECK_INTERVAL = 1 # in seconds
PAYPAL_ME_URL = 'https://www.paypal.me/roboyicecream/'
PAYPAL_LANGUAGE = 'DE' # DE or EN
PayPal URL should be paypal.me URL.
luigi_payment/src/client.py
is going to mock Luigi's payment service call indefinitely with changing payment options.
Payment interface can be shown from any device that is connected to the same network which Raspberry Pi is connected to.
You need to start Node-RED via node-red
and get device's IP to show it on other devices such as tablet.
Import flows.json
which is under luigi_payment/node-red-payment-ui
and deploy it after browsing to 127.0.0.1:1880
.
If there are other flows deployed on your system, consider deleting them.
To show image on tablet please change httpStatic
to point luigi_payment/images
folder. The file should be located in /home/pi/.node-red/settings.js
file.
E.g. httpStatic: 'LOCAL_PATH/luigi_payment/images/',
There must be comma at the end.
You can access the dashboard from any device on the same network by browing RASPBERRY_PI_IP:1880/ui
.
Default View | Coin Method | PayPal Method |
---|---|---|
![]() |
![]() |
![]() |