node-paytmpg 5.3.0 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.MD CHANGED
@@ -1,245 +1,245 @@
1
- ## Node JS Payments Easy Integration
2
-
3
- [![NPM Publish](https://github.com/shiveshnavin/node_paytm/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/shiveshnavin/node_paytm/actions/workflows/npm-publish.yml)
4
- [![Node.js CI](https://github.com/shiveshnavin/node_paytm/actions/workflows/nodejs.yml/badge.svg)](https://github.com/shiveshnavin/node_paytm/actions/workflows/nodejs.yml)
5
-
6
- Support for :
7
- - Paytm
8
- - RazorPay
9
- - Open Money
10
-
11
- Does all the hardwork for you while integrating payments in any express app. Comes with inbuilt UI and REST APIs for lightning fast development and prototyping .
12
-
13
- ## Example
14
-
15
- Demo : https://node-paytm.herokuapp.com/_pay/init
16
-
17
- Use any Card Details or Net Banking
18
- username : test
19
- password : test
20
-
21
- Example App Sourcecode : https://github.com/shiveshnavin/payment-gateway-example
22
-
23
- ### Requirments
24
-
25
- 1. MongoDB / Firestore / SQlite
26
- 2. Your Merchant Credentials
27
- 3. Express . This only works with NodeJS express server
28
-
29
- You can get your paytm credentials here
30
- https://developer.paytm.com/docs
31
-
32
-
33
-
34
- ![Alt text](public/start.png "Start")
35
-
36
- ![Alt text](public/start2.png "Start")
37
-
38
- ![Alt text](public/pay.png "Start")
39
-
40
- ![Alt text](public/stat.png "Start")
41
-
42
-
43
- ### Install
44
-
45
- ```code
46
- npm install node-paytmpg --save
47
- ```
48
-
49
- In your main nodejs file set configuration in express app
50
-
51
-
52
- ### Paytm
53
- ```code
54
- host_url : Host URL of your server . This will be used to redirect user after payment
55
- view_path : Ignore and dont change unless you know what you are doing . This is the useful in case you want to modify payment init page UI from node_paytm_pg library
56
- paytm_url : For Test "https://securegw-stage.paytm.in" and for Production "https://securegw.paytm.in"
57
- MID : Your Paytm Merchant ID
58
- Website : "WEBSTAGING" for Test and for Production , the website you entered while activation
59
- KEY : Your Unique Key from Paytm used for hashing
60
- CHANNEL_ID : Know More at Paytm Docs
61
- INDUSTRY_TYPE_ID : Know More at Paytm Docs
62
- homepage : Homepage of your website where user can go after payment confirmation page
63
- path_prefix : All node_paytm_pg apis/pages will be available relative to this path prefix
64
- db_url : Your MongoDB url in case you want to use legacy mongodb connection . You can use multidborm to support MongoDB/Firestore/Sqlite
65
- id_length: Length of Order ID and User ID
66
-
67
- ```
68
-
69
- ### Razorpay
70
- In case you want to use razorpay , Use the below configuration
71
- ```
72
- host_url : Host URL of your server . This will be used to redirect user after payment
73
- view_path : Ignore and dont change unless you know what you are doing . This is the useful in case you want to modify payment init page UI from node_paytm_pg library
74
- razor_url : https://api.razorpay.com/
75
- MID : Your Paytm Merchant ID
76
- KEY : Your generated API Key
77
- SECRET : Your API Key secret
78
- homepage : Homepage of your website where user can go after payment confirmation page
79
- path_prefix : All node_paytm_pg apis/pages will be available relative to this path prefix
80
- db_url : Your MongoDB url in case you want to use legacy mongodb connection . You can use multidborm to support MongoDB/Firestore/Sqlite
81
- id_length: Length of Order ID and User ID
82
-
83
- ```
84
-
85
- ### For Open Money
86
- In case you want to use Open Money https://app.open.money/settings/developer-api/api . Use the below configuration
87
- ```
88
- host_url : Host URL of your server . This will be used to redirect user after payment
89
- view_path : Ignore and dont change unless you know what you are doing . This is the useful in case you want to modify payment init page UI from node_paytm_pg library
90
- open_money_url : SANDBOX https://sandbox-icp-api.bankopen.co/api OR LIVE https://icp-api.bankopen.co/api
91
- KEY : Your generated API Key
92
- SECRET : Your API secret
93
- homepage : Homepage of your website where user can go after payment confirmation page
94
- path_prefix : All node_paytm_pg apis/pages will be available relative to this path prefix
95
- db_url : Your MongoDB url in case you want to use legacy mongodb connection . You can use multidborm to support MongoDB/Firestore/Sqlite
96
- id_length: Length of Order ID and User ID (Optional)
97
-
98
- ```
99
-
100
-
101
- Place these 2 statements in your main nodejs file before calling app.listen(..)
102
-
103
- ```javascript
104
-
105
- /***
106
- * Uncomment in case you want to use multidborm to support
107
- * MongoDB / Firestore / SQlite
108
- * https://www.npmjs.com/package/multi-db-orm
109
- * Refer to example.js
110
-
111
- const { MultiDbORM, FireStoreDB, MongoDB, SQLiteDB, Sync } = require("multi-db-orm");
112
- var mongodb = new MongoDB(MONGOURL);
113
- app.multidborm = mongodb;
114
-
115
- */
116
-
117
- app.set('np_config', {
118
- "host_url":"http://127.0.0.1:5542",
119
- "view_path":"/../views/",
120
- "MID":"XXXXXXXXXXX",
121
- "WEBSITE":"WEBSTAGING",
122
- "KEY":"XXXXXXXXXXX",
123
- "CHANNEL_ID":"WEB",
124
- "INDUSTRY_TYPE_ID":"Retail",
125
- "homepage":"/_pay/home",
126
- "path_prefix":"_pay",
127
- "db_url":"mongodb://user:password123@db.host.com:5551/dbname_123", // Remove this property in case you want to use multidborm
128
- "id_length":10,
129
- "logo":"/favicon.ico",
130
- "theme_color":"#3399cc",
131
-
132
- "paytm_url":"https://securegw-stage.paytm.in", // Only For PayTm
133
-
134
- "razor_url":"https://api.razorpay.com/", // Only For RazorPay
135
- "SECRET":"XXXXXXXXXXX", //Only For RazorPay , Your razorpay api key secret
136
-
137
- });
138
-
139
- require('node-paytmpg')(app,express)
140
-
141
- ```
142
-
143
- ### Basic Usage
144
-
145
-
146
- #### Method 1 : Ask user to enter Details
147
- ```
148
- simply open page /_pay/init in browser
149
- ```
150
- #### Method 2 : Post these params to /_pay/init using browser form
151
- ```
152
- NAME
153
- EMAIL
154
- MOBILE_NO
155
- PRODUCT_NAME
156
- TXN_AMOUNT
157
- ```
158
-
159
- #### Method 3 : Using API . Useful for Integrating on Mobile App
160
- ```
161
- Create an Order by posting to URL /_pay/api/createTxn
162
-
163
- NAME
164
- EMAIL
165
- MOBILE_NO
166
- PRODUCT_NAME
167
- TXN_AMOUNT
168
-
169
- This will generate an `orderId` and `payurl` in response .
170
- Now Post to /_pay/init using browser form
171
-
172
- NAME
173
- EMAIL
174
- MOBILE_NO
175
- ORDER_ID
176
-
177
- OR
178
- Simply open `payurl` in your browser
179
-
180
- ```
181
- APIS
182
- ```
183
- For Checking Status
184
-
185
- method : POST
186
- path : /_pay/api/status
187
- Params:
188
- ORDER_ID
189
-
190
- ```
191
-
192
- ### Advanced
193
-
194
- You can use callbacks to sync node-paytmpg transactions with you own database using .
195
-
196
- ```
197
- var PayTMPG=require('node-paytmpg')(app,express,{
198
-
199
- onStart:function(orderid,data)
200
- {
201
- console.log("Payment has started \n",orderid,data)
202
- },
203
- onFinish:function(orderid,data)
204
- {
205
- console.log("Payment Has finished \n",orderid,data)
206
-
207
- }
208
-
209
- })
210
-
211
- var Transaction=PayTMPG.Transaction;
212
- var User=PayTMPG.User;
213
-
214
- Transaction.findOne({orderId:req.body.ORDERID},function(err,data){
215
-
216
- console.log(data)
217
-
218
- })
219
-
220
-
221
- ```
222
-
223
- ### Webhooks
224
-
225
- Webhooks can issued at at `/_pay/api/webhook` and are useful for payments captured late.
226
-
227
- #### For razorpay webhook
228
- Make sure to use the same secret in your webhook as the merchant secret.
229
- https://razorpay.com/docs/webhooks/
230
-
231
- #### For paytm
232
- Nothing extra needed
233
- https://developer.paytm.com/docs/callback-and-webhook/?ref=callbackWebhook
234
-
235
- #### For Open Money
236
- Nothing extra needed
237
- https://docs.bankopen.com/reference/webhook-url
238
-
239
-
240
- License : GPL
241
-
242
- Donate :
243
- [<img src="https://www.iconfinder.com/icons/379454/download/png/128">](https://www.instamojo.com/@shiveshnavin)
244
-
245
-
1
+ ## Node JS Payments Easy Integration
2
+
3
+ [![NPM Publish](https://github.com/shiveshnavin/node_paytm/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/shiveshnavin/node_paytm/actions/workflows/npm-publish.yml)
4
+ [![Node.js CI](https://github.com/shiveshnavin/node_paytm/actions/workflows/nodejs.yml/badge.svg)](https://github.com/shiveshnavin/node_paytm/actions/workflows/nodejs.yml)
5
+
6
+ Support for :
7
+ - Paytm
8
+ - RazorPay
9
+ - Open Money
10
+
11
+ Does all the hardwork for you while integrating payments in any express app. Comes with inbuilt UI and REST APIs for lightning fast development and prototyping .
12
+
13
+ ## Example
14
+
15
+ Demo : https://node-paytm.herokuapp.com/_pay/init
16
+
17
+ Use any Card Details or Net Banking
18
+ username : test
19
+ password : test
20
+
21
+ Example App Sourcecode : https://github.com/shiveshnavin/payment-gateway-example
22
+
23
+ ### Requirments
24
+
25
+ 1. MongoDB / Firestore / SQlite
26
+ 2. Your Merchant Credentials
27
+ 3. Express . This only works with NodeJS express server
28
+
29
+ You can get your paytm credentials here
30
+ https://developer.paytm.com/docs
31
+
32
+
33
+
34
+ ![Alt text](public/start.png "Start")
35
+
36
+ ![Alt text](public/start2.png "Start")
37
+
38
+ ![Alt text](public/pay.png "Start")
39
+
40
+ ![Alt text](public/stat.png "Start")
41
+
42
+
43
+ ### Install
44
+
45
+ ```code
46
+ npm install node-paytmpg --save
47
+ ```
48
+
49
+ In your main nodejs file set configuration in express app
50
+
51
+
52
+ ### Paytm
53
+ ```code
54
+ host_url : Host URL of your server . This will be used to redirect user after payment
55
+ view_path : Ignore and dont change unless you know what you are doing . This is the useful in case you want to modify payment init page UI from node_paytm_pg library
56
+ paytm_url : For Test "https://securegw-stage.paytm.in" and for Production "https://securegw.paytm.in"
57
+ MID : Your Paytm Merchant ID
58
+ Website : "WEBSTAGING" for Test and for Production , the website you entered while activation
59
+ KEY : Your Unique Key from Paytm used for hashing
60
+ CHANNEL_ID : Know More at Paytm Docs
61
+ INDUSTRY_TYPE_ID : Know More at Paytm Docs
62
+ homepage : Homepage of your website where user can go after payment confirmation page
63
+ path_prefix : All node_paytm_pg apis/pages will be available relative to this path prefix
64
+ db_url : Your MongoDB url in case you want to use legacy mongodb connection . You can use multidborm to support MongoDB/Firestore/Sqlite
65
+ id_length: Length of Order ID and User ID
66
+
67
+ ```
68
+
69
+ ### Razorpay
70
+ In case you want to use razorpay , Use the below configuration
71
+ ```
72
+ host_url : Host URL of your server . This will be used to redirect user after payment
73
+ view_path : Ignore and dont change unless you know what you are doing . This is the useful in case you want to modify payment init page UI from node_paytm_pg library
74
+ razor_url : https://api.razorpay.com/
75
+ MID : Your Paytm Merchant ID
76
+ KEY : Your generated API Key
77
+ SECRET : Your API Key secret
78
+ homepage : Homepage of your website where user can go after payment confirmation page
79
+ path_prefix : All node_paytm_pg apis/pages will be available relative to this path prefix
80
+ db_url : Your MongoDB url in case you want to use legacy mongodb connection . You can use multidborm to support MongoDB/Firestore/Sqlite
81
+ id_length: Length of Order ID and User ID
82
+
83
+ ```
84
+
85
+ ### For Open Money
86
+ In case you want to use Open Money https://app.open.money/settings/developer-api/api . Use the below configuration
87
+ ```
88
+ host_url : Host URL of your server . This will be used to redirect user after payment
89
+ view_path : Ignore and dont change unless you know what you are doing . This is the useful in case you want to modify payment init page UI from node_paytm_pg library
90
+ open_money_url : SANDBOX https://sandbox-icp-api.bankopen.co/api OR LIVE https://icp-api.bankopen.co/api
91
+ KEY : Your generated API Key
92
+ SECRET : Your API secret
93
+ homepage : Homepage of your website where user can go after payment confirmation page
94
+ path_prefix : All node_paytm_pg apis/pages will be available relative to this path prefix
95
+ db_url : Your MongoDB url in case you want to use legacy mongodb connection . You can use multidborm to support MongoDB/Firestore/Sqlite
96
+ id_length: Length of Order ID and User ID (Optional)
97
+
98
+ ```
99
+
100
+
101
+ Place these 2 statements in your main nodejs file before calling app.listen(..)
102
+
103
+ ```javascript
104
+
105
+ /***
106
+ * Uncomment in case you want to use multidborm to support
107
+ * MongoDB / Firestore / SQlite
108
+ * https://www.npmjs.com/package/multi-db-orm
109
+ * Refer to example.js
110
+
111
+ const { MultiDbORM, FireStoreDB, MongoDB, SQLiteDB, Sync } = require("multi-db-orm");
112
+ var mongodb = new MongoDB(MONGOURL);
113
+ app.multidborm = mongodb;
114
+
115
+ */
116
+
117
+ app.set('np_config', {
118
+ "host_url":"http://127.0.0.1:5542",
119
+ "view_path":"/../views/",
120
+ "MID":"XXXXXXXXXXX",
121
+ "WEBSITE":"WEBSTAGING",
122
+ "KEY":"XXXXXXXXXXX",
123
+ "CHANNEL_ID":"WEB",
124
+ "INDUSTRY_TYPE_ID":"Retail",
125
+ "homepage":"/_pay/home",
126
+ "path_prefix":"_pay",
127
+ "db_url":"mongodb://user:password123@db.host.com:5551/dbname_123", // Remove this property in case you want to use multidborm
128
+ "id_length":10,
129
+ "logo":"/favicon.ico",
130
+ "theme_color":"#3399cc",
131
+
132
+ "paytm_url":"https://securegw-stage.paytm.in", // Only For PayTm
133
+
134
+ "razor_url":"https://api.razorpay.com/", // Only For RazorPay
135
+ "SECRET":"XXXXXXXXXXX", //Only For RazorPay , Your razorpay api key secret
136
+
137
+ });
138
+
139
+ require('node-paytmpg')(app,express)
140
+
141
+ ```
142
+
143
+ ### Basic Usage
144
+
145
+
146
+ #### Method 1 : Ask user to enter Details
147
+ ```
148
+ simply open page /_pay/init in browser
149
+ ```
150
+ #### Method 2 : Post these params to /_pay/init using browser form
151
+ ```
152
+ NAME
153
+ EMAIL
154
+ MOBILE_NO
155
+ PRODUCT_NAME
156
+ TXN_AMOUNT
157
+ ```
158
+
159
+ #### Method 3 : Using API . Useful for Integrating on Mobile App
160
+ ```
161
+ Create an Order by posting to URL /_pay/api/createTxn
162
+
163
+ NAME
164
+ EMAIL
165
+ MOBILE_NO
166
+ PRODUCT_NAME
167
+ TXN_AMOUNT
168
+
169
+ This will generate an `orderId` and `payurl` in response .
170
+ Now Post to /_pay/init using browser form
171
+
172
+ NAME
173
+ EMAIL
174
+ MOBILE_NO
175
+ ORDER_ID
176
+
177
+ OR
178
+ Simply open `payurl` in your browser
179
+
180
+ ```
181
+ APIS
182
+ ```
183
+ For Checking Status
184
+
185
+ method : POST
186
+ path : /_pay/api/status
187
+ Params:
188
+ ORDER_ID
189
+
190
+ ```
191
+
192
+ ### Advanced
193
+
194
+ You can use callbacks to sync node-paytmpg transactions with you own database using .
195
+
196
+ ```
197
+ var PayTMPG=require('node-paytmpg')(app,express,{
198
+
199
+ onStart:function(orderid,data)
200
+ {
201
+ console.log("Payment has started \n",orderid,data)
202
+ },
203
+ onFinish:function(orderid,data)
204
+ {
205
+ console.log("Payment Has finished \n",orderid,data)
206
+
207
+ }
208
+
209
+ })
210
+
211
+ var Transaction=PayTMPG.Transaction;
212
+ var User=PayTMPG.User;
213
+
214
+ Transaction.findOne({orderId:req.body.ORDERID},function(err,data){
215
+
216
+ console.log(data)
217
+
218
+ })
219
+
220
+
221
+ ```
222
+
223
+ ### Webhooks
224
+
225
+ Webhooks can issued at at `/_pay/api/webhook` and are useful for payments captured late.
226
+
227
+ #### For razorpay webhook
228
+ Make sure to use the same secret in your webhook as the merchant secret.
229
+ https://razorpay.com/docs/webhooks/
230
+
231
+ #### For paytm
232
+ Nothing extra needed
233
+ https://developer.paytm.com/docs/callback-and-webhook/?ref=callbackWebhook
234
+
235
+ #### For Open Money
236
+ Nothing extra needed
237
+ https://docs.bankopen.com/reference/webhook-url
238
+
239
+
240
+ License : GPL
241
+
242
+ Donate :
243
+ [<img src="https://www.iconfinder.com/icons/379454/download/png/128">](https://www.instamojo.com/@shiveshnavin)
244
+
245
+