A PayTM checksum api in nodejs to provide backend for Mobile/Web apps
- PayTM developers account
- NodeJS
- Update
appConfig.js
with your merchant-id/key and hosturl - install dependencies
npm install
-for working of payments url change url in function/server/config/appConfig.js - run app
npm run start
V1 Base url pattern: http://<host>:<port>/api/v1/paytm/<endpoint>
http://localhost:3000/api/v1/paytm/healthcheck - To verify if API is running correctly
http://localhost:3000/api/v1/paytm/initiatePayment?order_id=123&customer_id=123&amount=10&email=abc@gmail.com - Will redirect to PayTM gateway for payments
http://localhost:3000/api/v1/paytm/callback - This endpoint is called from PayTM with payload about operation
- Create a new directory
- Navigate to it using console
- Install Firebase tools:
npm install -g firebase-tools
- Login to Firebase:
firebase login
--for working of payments url change url in function/server/config/appConfig.js - Initialize firebase project:
firebase init
- Select your project and Cloud Functions
- This will create firebase functions project
- Copy
server
folder from this repository toFunctions
folder - Copy dependencies from package.json (this repository) to that new packages.json (in Functions folder)
- Add below lines to
Functions/index.js
file
const app = require('./server/app');
exports.api = functions.https.onRequest(app);
- Cloud function is ready. You can now deploy it using
firebase deploy
- Check if it is deployed correctly
- Go to Firebase Cloud Functions
- Copy Function URL
- Navigate to: `https://<PROJECT_LOCATION>-<PROJECT_NAME>.cloudfunctions.net/api/api/v1/paytm/healthcheck
- You should see text:
working
-for working of payments url change url in function/server/config/appConfig.js