@siamf/sslcommerz 1.0.0 → 1.0.3
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,3 +1,7 @@
|
|
|
1
|
+
<!-- sslcommerz-nodesdk -->
|
|
2
|
+
<!-- sslcommerz-js -->
|
|
3
|
+
<!-- @siamf/sslcommerz -->
|
|
4
|
+
|
|
1
5
|
<br/>
|
|
2
6
|
<picture>
|
|
3
7
|
<source media="(prefers-color-scheme: dark)" srcset="https://res.cloudinary.com/dub0dpenl/image/upload/v1731780157/Personal%20Logo/logo-white_e6fujz.png">
|
|
@@ -9,6 +13,10 @@
|
|
|
9
13
|
# @siamf/sslcommerz
|
|
10
14
|
A well-maintained, unofficial Node.js package for integrating SSLCommerz payments. Provides reliable support for initiating and handling transactions with minimal setup.
|
|
11
15
|
|
|
16
|
+
## This is 100% secure and build with official docs. It doesn't contain any unwanted activity code and the full code is open source.
|
|
17
|
+
|
|
18
|
+
### Note: `@siamf/sslcommerz`, `sslcommerz-js`, `sslcommerz-nodesdk` all published from a single codebase, so you can use any of this 3 package
|
|
19
|
+
|
|
12
20
|
# Installation
|
|
13
21
|
```javascript
|
|
14
22
|
npm i @siamf/sslcommerz
|
|
@@ -17,8 +25,10 @@ yarn add @siamf/sslcommerz
|
|
|
17
25
|
```
|
|
18
26
|
|
|
19
27
|
# Usage
|
|
28
|
+
|
|
29
|
+
### Initialize Package
|
|
20
30
|
```javascript
|
|
21
|
-
import { SslCommerz } from "
|
|
31
|
+
import { SslCommerz } from "@siamf/sslcommerz";
|
|
22
32
|
|
|
23
33
|
const store_id = "<store_id>"
|
|
24
34
|
const store_passwd = "<store_password>"
|
|
@@ -26,6 +36,7 @@ const is_live = false;
|
|
|
26
36
|
export const sslcz = new SslCommerz(store_id, store_passwd, is_live);
|
|
27
37
|
```
|
|
28
38
|
|
|
39
|
+
### Init the payment
|
|
29
40
|
```javascript
|
|
30
41
|
const data = {
|
|
31
42
|
total_amount: 100,
|
|
@@ -66,6 +77,7 @@ const data = {
|
|
|
66
77
|
const sslResponse = await sslcz.init(data);
|
|
67
78
|
```
|
|
68
79
|
|
|
80
|
+
### Validate the payment
|
|
69
81
|
```javascript
|
|
70
82
|
const data = {
|
|
71
83
|
val_id:ADGAHHGDAKJ456454 //that you go from sslcommerz response
|
|
@@ -74,6 +86,7 @@ const data = {
|
|
|
74
86
|
const sslResponse = await sslcz.validate(data)
|
|
75
87
|
```
|
|
76
88
|
|
|
89
|
+
### Initiate Refund
|
|
77
90
|
```javascript
|
|
78
91
|
const data = {
|
|
79
92
|
refund_amount:10,
|
|
@@ -85,6 +98,7 @@ const data = {
|
|
|
85
98
|
const sslResponse = await sslcz.initiateRefund(data)
|
|
86
99
|
```
|
|
87
100
|
|
|
101
|
+
### Query the refund
|
|
88
102
|
```javascript
|
|
89
103
|
const data = {
|
|
90
104
|
refund_ref_id: "SL4561445410"
|
|
@@ -93,6 +107,7 @@ const data = {
|
|
|
93
107
|
const sslResponse = await sslcz.refundQuery(data)
|
|
94
108
|
```
|
|
95
109
|
|
|
110
|
+
### Query transaction by session ID
|
|
96
111
|
```javascript
|
|
97
112
|
const data = {
|
|
98
113
|
sessionkey: "AKHLAKJS5456454"
|
|
@@ -101,6 +116,7 @@ const data = {
|
|
|
101
116
|
const sslResponse = await sslcz.transactionQueryBySessionId(data);
|
|
102
117
|
```
|
|
103
118
|
|
|
119
|
+
### Query transaction by transaction ID
|
|
104
120
|
```javascript
|
|
105
121
|
const data = {
|
|
106
122
|
tran_id: "AKHLAKJS5456454"
|
|
@@ -109,6 +125,8 @@ const data = {
|
|
|
109
125
|
const sslResponse = await sslcz.transactionQueryByTransactionId(data);
|
|
110
126
|
```
|
|
111
127
|
|
|
128
|
+
### Suggestions, improvements, and pull requests are always welcome.
|
|
129
|
+
|
|
112
130
|
# Stay in touch
|
|
113
131
|
- Author - [Siam Ahnaf](https://www.siamahnaf.com/)
|
|
114
132
|
- Website - [https://www.siamahnaf.com/](https://www.siamahnaf.com/)
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.httpCall = void 0;
|
|
13
13
|
const httpCall = (_a) => __awaiter(void 0, [_a], void 0, function* ({ url, method = "POST", data, }) {
|
|
14
14
|
const isBodyMethod = ["POST", "PUT", "PATCH"].includes(method);
|
|
15
|
-
console.log(data);
|
|
16
15
|
const response = yield fetch(url, Object.assign({ method, mode: "cors", cache: "no-cache", credentials: "same-origin", redirect: "follow" }, (isBodyMethod ? { body: data } : {})));
|
|
17
16
|
if (!response.ok) {
|
|
18
17
|
const errorBody = yield response.text().catch(() => "");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpCall.js","sourceRoot":"","sources":["../../../src/helpers/httpCall.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAO,MAAM,QAAQ,GAAG,KAAsI,EAAE,4CAAxH,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,GAA4E;IAC5I,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/D,
|
|
1
|
+
{"version":3,"file":"httpCall.js","sourceRoot":"","sources":["../../../src/helpers/httpCall.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAO,MAAM,QAAQ,GAAG,KAAsI,EAAE,4CAAxH,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,GAA4E;IAC5I,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,kBAC5B,MAAM,EACN,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,aAAa,EAC1B,QAAQ,EAAE,QAAQ,IACf,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACzC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;AACzC,CAAC,CAAA,CAAC;AAjBW,QAAA,QAAQ,YAiBnB"}
|
|
@@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
export const httpCall = (_a) => __awaiter(void 0, [_a], void 0, function* ({ url, method = "POST", data, }) {
|
|
11
11
|
const isBodyMethod = ["POST", "PUT", "PATCH"].includes(method);
|
|
12
|
-
console.log(data);
|
|
13
12
|
const response = yield fetch(url, Object.assign({ method, mode: "cors", cache: "no-cache", credentials: "same-origin", redirect: "follow" }, (isBodyMethod ? { body: data } : {})));
|
|
14
13
|
if (!response.ok) {
|
|
15
14
|
const errorBody = yield response.text().catch(() => "");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpCall.js","sourceRoot":"","sources":["../../../src/helpers/httpCall.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAsI,EAAE,4CAAxH,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,GAA4E;IAC5I,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/D,
|
|
1
|
+
{"version":3,"file":"httpCall.js","sourceRoot":"","sources":["../../../src/helpers/httpCall.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAsI,EAAE,4CAAxH,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,GAA4E;IAC5I,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,kBAC5B,MAAM,EACN,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,aAAa,EAC1B,QAAQ,EAAE,QAAQ,IACf,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACzC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;AACzC,CAAC,CAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siamf/sslcommerz",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A well-maintained, unofficial Node.js package for integrating SSLCommerz payments. Provides reliable support for initiating and handling transactions with minimal setup.",
|
|
5
5
|
"homepage": "https://github.com/siamahnaf/sslcommerz",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^24.0.15",
|
|
34
|
+
"rimraf": "^6.1.2",
|
|
34
35
|
"typescript": "^5.8.3"
|
|
35
36
|
}
|
|
36
|
-
}
|
|
37
|
+
}
|