xpay-redirect 1.1.0 → 1.2.0

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.
Files changed (3) hide show
  1. package/README.md +47 -25
  2. package/dist/index.js +24 -24
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,41 +1,63 @@
1
1
  ## Installation
2
2
 
3
- `<script src="https://cdn.jsdelivr.net/npm/xpay-redirect@1.1.0/dist/index.min.js"></script>`
3
+ XPay Redirection - used to show the payment gateway at the another page.
4
+
5
+ Use this script tag to get access to the xpay redirection.
6
+
7
+ `<script src="https://cdn.jsdelivr.net/npm/xpay-redirect@1.2.0/dist/index.min.js"></script>`
4
8
 
5
9
  ## Implementation
6
10
 
7
- 1. open new page and implement this package.
11
+ <b>Steps :-</b>
12
+
13
+ 1. Create two HTML files like `index.html` and `xpay.html`.
8
14
 
15
+ 2. Add a button or anchor tag at `index.html` to redirect to the `xpay.html` page.
16
+
17
+ ```html
18
+ <a href="./xpay.html">paynow</a>
9
19
  ```
20
+
21
+ 3. At `xpay.html`. Add a div tag with the id `xpay-ftb-web-redirect` at the body tag. It is used to display the xpay module with the help of this id.
22
+
23
+ ```html
10
24
  <div id="xpay-ftb-web-redirect"></div>
25
+ ```
26
+
27
+ 4. Add a Script tag to the head tag or body tag. And use the latest version.
11
28
 
12
- <script src="https://cdn.jsdelivr.net/npm/xpay-redirect@1.1.0/dist/index.min.js"></script>
29
+ ```html
30
+ <script src="https://cdn.jsdelivr.net/npm/xpay-redirect@1.2.0/dist/index.min.js"></script>
31
+ ```
13
32
 
33
+ 5. Next, add the script tag at a necessary place. But add below the source script.
34
+
35
+ ```html
14
36
  <script>
15
- const config = {
16
- baseurl:string,
17
- transactionDetails: {
18
- txid: number,
19
- amount: number,
20
- purchaseCurrency: string,
21
- purchaseAmount: number,
22
- expiryTime: string,
23
- },
24
- popupStatus: string, // if tx is PENDING send '' empty string or send tx status at popupStatus
25
- sessionid: string,
26
- paymenttokenid: string,
27
- merchantName: string,
28
- merchantUrl: string,
29
- onResponse: function(data){},
30
- onError: function(data){},
31
- onPopupClose: function(data){}
32
- };
33
-
34
- xpayftb.XpayRedirect(config);
37
+ const config = {
38
+ baseurl: string,
39
+ sessionid: string,
40
+ paymenttokenid: string,
41
+ expiryTime: number,
42
+ merchantName: string,
43
+ merchantUrl: string,
44
+ onResponse: function (data) {},
45
+ onError: function (data) {},
46
+ onPopupClose: function (data) {}
47
+ };
48
+
49
+ xpayftb.XpayRedirect(config);
35
50
  </script>
36
51
  ```
37
52
 
53
+ Here, the config variable is used to pass the data as an object to the xpayftb.
54
+ `xpayftb.XpayRedirect(config)`
55
+
38
56
  ## Note
39
57
 
40
- - if transaction is PENDING send '' empty string or send transaction status at popupStatus
41
- - onResponse, onError and onPopupClose are function. Pass one parameter and to get access of it.
58
+ - `baseurl` should pass as a string value. It is used as the base URL for API calls.
59
+ - `sessionid` and `paymenttokenid` should pass as a string value. It is used all over the xpay.
60
+ - `expiryTime` is used to display a countdown and to close the session. Try to send it in minutes and numerically (expected `3` or `5`).
61
+ - `merchantName` is used to display the merchant name at xpay. And pass it as a string value.
62
+ - `merchantUrl` should pass as a string value. It is used to return the merchant back to the checkout page or any URL.
63
+ - `onResponse`, `onError` and `onPopupClose` are functions. Try to pass one parameter and console it to observe and customize according to the result.