Node.js Express Cashfree Payment Gateway SDK Integration in Browser Using Javascript Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments

 

 

Getting Started

Clone the above repository and extract the nodejs subfolder from inside the pg-integration-kits folder. Place it in some specific directory (for example in linux – /home/sharoh/cf-nodejs/.

Pre-requisites

1) NodeJS 

How to start

You’ll first need to intall nodemon, it is as simple as running npm install -g nodemon on your machine.

Below we describe the NodeJS integration for Cashfree PG. You’ll need Cashfree credentials for this setup to work. You can access the credentials from the merchant dashboard (API access > credentials) here.

Step 1

  • Open the file app.js, and update the value of the variable mode to “TEST”(for testing) or “PROD”(for production) depending on your environment (line 36).
  • Update the variable secretKey with the correct value for the mode you have selected in the app.js file (line number 37 and 67).

Step 2

Once you’ve installed nodemon in your system and updated the file with the correct secretKey values. Run the following commands from the folder where you have the app.js file, this will start your server.

nodemon --exec npm start
Card Number : 4111 1111 1111 1111
CVV : 123

You can enter any name, month and year for card expiration. For more details around test cards, see Test Data.

See also  PHP 7 Script to Get Remote IP Address and MAC Address of Connected Client in Browser Full Project For Beginners

Step 3

  • Once you’ve entered the details you will be redirected to the Cashfree PG Simulator page. Here you can simulate either a failed or a successful transaction. You will then be redirected to the returnUrl(given in step 2) with the transaction details.

NOTE :

  • In the file app.js, please make sure that you are using the correct integration mode.
  • Give a valid returnUrl, since all the transaction details will be sent to this url.
  • It is imperative that you process the response correctly (by verifying the signature) to prevent any fraud on your website.

 

 

Just copy your appid and secret key from your respective account as shown below

See also  PHP 7 File Handling Script to Open,Read and Write Files on Server in Browser Full Project For Beginners

 

 

 

 

DOWNLOAD FULL SOURCE CODE

 

 

Leave a Reply