Skip to content

DineshikaSivapalaraja/Payment_Gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Payment Service – MERN + PayHere Sandbox

This project is a MERN stack payment gateway integration, using the PayHere sandbox for secure payment processing.

Features

  • Initiate payments via PayHere (sandbox)
  • Store payment records in MongoDB
  • Simple React frontend for payment form and status pages

Prerequisites

Setup Instructions

1. PayHere Sandbox Setup

  1. Create a PayHere Sandbox Account:

  2. To Get Merchant ID and Merchant Secret:

    • Go to Integrations → Add Domain/App

    • Set Domain/App: Domain

    • Set Domain Name: localhost (or 127.0.0.1)

    • Save and ensure the domain/app is active. image

    • Integration screen displays the Merchant ID, Merchant Secret image

    • Copy the generated Merchant ID and Merchant Secret to .env file.

2. Backend Setup

  1. Copy .env.example to .env in the Payment_Service_Backend/ directory and fill it with your actual credentials.

  2. Install dependencies:

    cd Payment_Service_Backend
    npm install
  3. Start the backend server:

    npm run dev

3. Frontend Setup

  1. Copy .env.example to .env in Payment_Service_Frontend/ and fill with your actual credentials.

  2. Install dependencies:

    cd Payment_Service_Frontend
    npm install
  3. Start the frontend:

    npm run dev

Testing Payments

  • Use the frontend payment form to initiate a payment.
  • You’ll be redirected to PayHere’s sandbox checkout.
  • Use a test card for transactions. Visit https://support.payhere.lk/sandbox-and-testing to get test card details.
    • Visa: 4123 4567 8912 3456
    • CVV: 123
    • Expiry: 12/25
  • On completion/cancel, you’ll be redirected to the appropriate status page.
  • Check MongoDB for payment records.

Notes

  • Sandbox transactions are free and use dummy data.
  • Keep your secrets in .env files (do not commit them).
  • For production, use live PayHere credentials and update URLs accordingly.

Support

About

Full-stack MERN application integrated with PayHere Sandbox for payment processing. Includes backend and frontend implementations with secure checkout flow.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors