Skip to content

Instantly share code, notes, and snippets.

@JH-Jitu
Last active April 22, 2021 15:16
For medium.com
const router = require('express').Router()
const paymentCtrl = require('../controllers/paymentCtrl')
const auth = require('../middleware/auth') // If you have individual author
const authAdmin = require('../middleware/authAdmin') // If you have an selected admin
// Get all payments in the admin panel AND After the going to success page it will send data to database
router.route('/payment')
.get(auth, authAdmin, paymentCtrl.getPayments)
.post(auth, paymentCtrl.SSLCommerz_payment_session_paid)
// SSL Payment Initiation
router.route('/ssl_payment')
.post(paymentCtrl.SSLCommerz_payment_init)
// Validation To get Notification and Success URL
router.route('/ssl_payment_complete')
.post(paymentCtrl.SSLCommerz_payment_valid)
// Getting the session key from front end. By this I can get the transaction status, transaction ID etc.
router.route('/ssl_payment_session')
.post(auth, paymentCtrl.SSLCommerz_payment_session)
// IPN controller to get the payment related issues from customer. (For future updated)
router.route('/ssl_payment_complete_Notify')
.post(paymentCtrl.SSLCommerz_payment_ipn_notify)
// Payment Fail Redirection
router.route('/ssl_payment_failed')
.post(paymentCtrl.SSLCommerz_payment_failed)
// Payment Cancel Redirection
router.route('/ssl_payment_cancelled')
.post(paymentCtrl.SSLCommerz_payment_cancelled)
module.exports = router
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment