boxpay-checkout-web-sdk 1.0.0-beta.0 โ 1.0.0-beta.1
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 +34 -26
- package/dist/boxpay.esm.js +2 -0
- package/dist/boxpay.esm.js.LICENSE.txt +1 -0
- package/package.json +4 -2
- package/dist/assets/americanExpress.svg +0 -16
- package/dist/assets/back-btn.svg +0 -7
- package/dist/assets/bankCard.svg +0 -11
- package/dist/assets/card.svg +0 -4
- package/dist/assets/diner.svg +0 -6
- package/dist/assets/discover.svg +0 -6
- package/dist/assets/jcb.svg +0 -21
- package/dist/assets/loader.png +0 -0
- package/dist/assets/maestro.svg +0 -6
- package/dist/assets/mastercard.svg +0 -6
- package/dist/assets/right-arrow.svg +0 -4
- package/dist/assets/rupay.svg +0 -5
- package/dist/assets/uatp.svg +0 -13
- package/dist/assets/visa.svg +0 -3
- package/dist/boxpay-checkout-js-sdk.js +0 -1866
- package/dist/cardPaymentTemplate.html +0 -41
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A lightweight, secure, and customizable checkout experience for payments โ built to embed directly inside merchant websites or open in a standalone checkout window.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
6
|
|
|
7
7
|
## ๐ Features
|
|
8
8
|
|
|
@@ -13,20 +13,23 @@ A lightweight, secure, and customizable checkout experience for payments โ bui
|
|
|
13
13
|
* Event handlers for full control
|
|
14
14
|
* Lightweight and dependency-free
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
---
|
|
17
17
|
|
|
18
18
|
## ๐ฆ Installation
|
|
19
19
|
|
|
20
20
|
### Via CDN
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
```html
|
|
23
|
+
<script src="https://cdn.jsdelivr.net/npm/boxpay-checkout-js-sdk@1.0.0-beta.1/dist/boxpay-checkout-js-sdk.min.js"></script>
|
|
24
|
+
```
|
|
24
25
|
|
|
25
26
|
### Local Script
|
|
26
27
|
|
|
28
|
+
```html
|
|
27
29
|
<script src="path-to/boxpay-checkout-js-sdk.js"></script>
|
|
30
|
+
```
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
---
|
|
30
33
|
|
|
31
34
|
## โ Usage Overview
|
|
32
35
|
|
|
@@ -35,7 +38,7 @@ You can use the SDK in **two ways**:
|
|
|
35
38
|
1. **Embedded checkout UI inside your page (`elements`)**
|
|
36
39
|
2. **Popup/Iframe full-screen checkout (`open`)**
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
---
|
|
39
42
|
|
|
40
43
|
# 1๏ธโฃ Embedded Checkout (Elements Integration)
|
|
41
44
|
|
|
@@ -43,10 +46,13 @@ This method renders the checkout UI directly into a container on your webpage.
|
|
|
43
46
|
|
|
44
47
|
### **HTML**
|
|
45
48
|
|
|
49
|
+
```html
|
|
46
50
|
<div id="payment-element" style="height:500px;overflow-y:auto"></div>
|
|
51
|
+
```
|
|
47
52
|
|
|
48
53
|
### **JS Integration**
|
|
49
54
|
|
|
55
|
+
```html
|
|
50
56
|
<script>
|
|
51
57
|
const shopperDetails = {
|
|
52
58
|
dateOfBirth: null,
|
|
@@ -73,7 +79,7 @@ This method renders the checkout UI directly into a container on your webpage.
|
|
|
73
79
|
async function mountBoxpayCheckout() {
|
|
74
80
|
checkoutInstance = await boxPay.elements({
|
|
75
81
|
container: "payment-element",
|
|
76
|
-
paymentMethods: ['
|
|
82
|
+
paymentMethods: ['card'], // emi, wallet
|
|
77
83
|
shopperDetails: shopperDetails,
|
|
78
84
|
mode: "development", // "production"
|
|
79
85
|
|
|
@@ -96,13 +102,7 @@ This method renders the checkout UI directly into a container on your webpage.
|
|
|
96
102
|
show: false,
|
|
97
103
|
onPaymentButtonValidity: handlePayButtonValidity,
|
|
98
104
|
},
|
|
99
|
-
layout: {
|
|
100
|
-
type: "tabs", // tabs | accordion | accordionWithRadio
|
|
101
|
-
defaultCollapsed: false
|
|
102
|
-
},
|
|
103
|
-
cssFormClass: "form-class"
|
|
104
105
|
},
|
|
105
|
-
|
|
106
106
|
onLoad: handlePaymentElementLoad,
|
|
107
107
|
onPayment: handleOnPayment
|
|
108
108
|
});
|
|
@@ -122,8 +122,9 @@ This method renders the checkout UI directly into a container on your webpage.
|
|
|
122
122
|
// Enable external pay button if needed
|
|
123
123
|
}
|
|
124
124
|
</script>
|
|
125
|
+
```
|
|
125
126
|
|
|
126
|
-
|
|
127
|
+
---
|
|
127
128
|
|
|
128
129
|
# 2๏ธโฃ Full-Page Hosted Checkout (Iframe)
|
|
129
130
|
|
|
@@ -131,10 +132,13 @@ This approach opens the hosted checkout in an iframe โ no UI managed by the me
|
|
|
131
132
|
|
|
132
133
|
### **HTML**
|
|
133
134
|
|
|
135
|
+
```html
|
|
134
136
|
<div id="boxpay-checkout"></div>
|
|
137
|
+
```
|
|
135
138
|
|
|
136
139
|
### **JS Integration**
|
|
137
140
|
|
|
141
|
+
```html
|
|
138
142
|
<script>
|
|
139
143
|
function handlePaymentResponse(data) {
|
|
140
144
|
console.log("Payment completed!", data);
|
|
@@ -150,13 +154,15 @@ This approach opens the hosted checkout in an iframe โ no UI managed by the me
|
|
|
150
154
|
handlePaymentCancellation
|
|
151
155
|
);
|
|
152
156
|
</script>
|
|
157
|
+
```
|
|
153
158
|
|
|
154
159
|
This automatically loads the checkout and triggers callbacks on success/cancel.
|
|
155
160
|
|
|
156
|
-
|
|
161
|
+
---
|
|
157
162
|
|
|
158
163
|
## ๐งญ Shopper Details Format
|
|
159
164
|
|
|
165
|
+
```json
|
|
160
166
|
{
|
|
161
167
|
"email": "example@boxpay.com",
|
|
162
168
|
"firstName": "John",
|
|
@@ -174,11 +180,13 @@ This automatically loads the checkout and triggers callbacks on success/cancel.
|
|
|
174
180
|
"postalCode": "10001"
|
|
175
181
|
}
|
|
176
182
|
}
|
|
183
|
+
```
|
|
177
184
|
|
|
178
|
-
|
|
185
|
+
---
|
|
179
186
|
|
|
180
187
|
## ๐จ Appearance Customization
|
|
181
188
|
|
|
189
|
+
```js
|
|
182
190
|
appearance: {
|
|
183
191
|
primaryColor: "#ffd042",
|
|
184
192
|
secondaryColor: "#ff0000",
|
|
@@ -190,24 +198,22 @@ appearance: {
|
|
|
190
198
|
width: "100%"
|
|
191
199
|
}
|
|
192
200
|
}
|
|
201
|
+
```
|
|
193
202
|
|
|
194
|
-
|
|
203
|
+
---
|
|
195
204
|
|
|
196
205
|
## โ Options
|
|
197
206
|
|
|
207
|
+
```js
|
|
198
208
|
options: {
|
|
199
209
|
payButton: {
|
|
200
210
|
show: false,
|
|
201
211
|
onPaymentButtonValidity: (isValid) => {},
|
|
202
212
|
},
|
|
203
|
-
layout: {
|
|
204
|
-
type: "tabs", // tabs | accordion | accordionWithRadio
|
|
205
|
-
defaultCollapsed: false
|
|
206
|
-
},
|
|
207
|
-
cssFormClass: "form-class"
|
|
208
213
|
}
|
|
214
|
+
```
|
|
209
215
|
|
|
210
|
-
|
|
216
|
+
---
|
|
211
217
|
|
|
212
218
|
## ๐ก Callback Events
|
|
213
219
|
|
|
@@ -217,19 +223,21 @@ options: {
|
|
|
217
223
|
| `onPayment` | Triggered after payment success or failure |
|
|
218
224
|
| `onPaymentButtonValidity` | Called whenever the input form becomes valid or invalid |
|
|
219
225
|
|
|
220
|
-
|
|
226
|
+
---
|
|
221
227
|
|
|
222
228
|
## ๐งช Modes
|
|
223
229
|
|
|
230
|
+
```js
|
|
224
231
|
mode: "development" // or "production"
|
|
232
|
+
```
|
|
225
233
|
|
|
226
|
-
|
|
234
|
+
---
|
|
227
235
|
|
|
228
236
|
## ๐ License
|
|
229
237
|
|
|
230
238
|
Proprietary โ authorized use only.
|
|
231
239
|
|
|
232
|
-
|
|
240
|
+
---
|
|
233
241
|
|
|
234
242
|
## ๐ฌ Support
|
|
235
243
|
|