Zoho CRM Setup: Step-by-Step Guide
Try Zoho CRM setup with our step-by-step guide. Learn about configuration, customization, data migration, and automation to optimize your CRM for business success.
Well, We have to build a Web app in Node JS/Express JS, Mongo as DBMS and Ejs as template engine. In the app, we have to integrate Payment gateway so we choose PayUmoney but struggled in implementing it as the docs were not up to the mark and weren’t clear, so by researching and referring hectic docs it was successfully implemented , so I thought why not get hands dirty on my first article and not let others struggle.
To start with integration, first, you need to have an active PayUmoney account and you will be provided with Merchant Key and Salt once successfully created account and verified all the details required.
Note: Your account may take 2–3 working days for verification.
Payumoney has two types of checkout One is Bolt and another one is Redirect, but we will gonna focus on Redirect Checkout. Below is a screenshot of how it works.
Here, The most important part where mostly developers face problems is generating hash.
Above shown is the way of generating a hash. Here the parameters are to be hashed in the following sequence by using “|” after each parameter and provide all the details mentioned above. Here udf1, udf2 … are user-defined fields and these are optional and if you don’t use them you must replace it with empty spaces and use the above exact sequence.
Once hashstring is generated in proper sequence, now we need to hash it Using ‘SHA-512’ to generate final hashed value. Here, we will be using ‘jssha’ npm module for hashing it.
Then pass hashstring in the update function.
Now store hashed value:
After generating hashString, its time to use it in API. Here We will create POST route. Here express router is used to make a call to API. Payumoney provides testing credentials for implementing and testing purpose.
After switching to a production environment, remember to change it to a production URL
After calling an API to above route PayUmoney will return transaction data. There will be two transaction status fail and transaction success, as we had already provided [surl, furl] which means success URL and failure URL. If it fails it will redirect and send the transaction status to failure URL and if it’s a success then it will redirect and send the status to success URL, So remember to include SURL and FURL.
Now implement POST API for success and fail URL
For Client-Side, EJS is used as a Template Engine
Simply install EJS with npm command and set it as default engine for rendering.
Now we will call API from front-end, so let’s start
Do remember you don’t need to send KEY, SALT & txnid from Client-side for security reasons.
Make an EJS file e.g (payment.ejs) and make sure to include a service provider
Provide all the details mentioned above from client-side to API based on the response implement UI as per yourself.
Boom, you have successfully implemented a payment gateway in your application.
Get a detailed breakdown with cost & time estimations for any of your idea or project in 4 hours
We build user - centric software products that helps businesses grow at massive scale. Let's build together!
Contact usCheck out our carefully curated packages to build a high-quality product and get unparalleled support. Click on the button and find your match.
Explore our storeOptimize your tracking and analytics setup with our step-by-step Google Analytics and GTM Checklist. Perfect for business owners and marketers.
Get a detailed breakdown with cost & time estimations for any of your idea or project in 4 hours
Optimize your tracking and analytics setup with our step-by-step Google Analytics and GTM Checklist. Perfect for business owners and marketers.