A donation app using ECOMMPAY payment gatewaay.
Prerequisites
-
Node v0.12
-
Firebase account
-
Firebase database
Install
npm install
Create a .env
file with the contents:
ECOMMPAY_PROJECT_ID = "..."
ECOMMPAY_SECRET = "..."
COLLECTION = "test_payments"
NODE_ENV = "local"
SUCCESS_REDIRECT = "https://google.com"
FAILURE_REDIRECT = "https://google.com"
TELEGRAM_TOKEN = "..."
TELEGRAM_CHAT_ID = "..."
TELEGRAM_SERVER_ID = "my localhost test server"
Drop your Firebase service account .json file as secrets/firebase.json
.
Development
Run Express in development mode:
npm install -g nodemon
nodemon src/server.js
Test card details
4314220000000056 success
5413330000000019 success
4314220000000072 decline
5413330000000035 decline
4314220000000098 decline
5413330000000092 decline
Run
node src/server.js
On the production run Node in port 80/443.
To run and install with Let's Encrypt.
sudo apt-get update -y
sudo apt-get install -y certbot
certbot certonly
Then edit production .env
file:
COLLECTION = "payments"
HTTPS_DOMAIN = "donate.ignitecovid19response.com"
THANK_YOU_PAGE_URL = "https://ignitecovid19response.com/thank-you-for-the-payment"
Database backups
To get a backup for the Firebase Cloud Storage:
node src/backup.js > backup-`date +%Y-%m-%d`.json
ECOMMPay reference manual
https://developers.ecommpay.com/en/en_PP_method_Embedded.html