@medipass/checkout-sdk 2.0.1 → 3.0.0-alpha.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.
- package/README.md +64 -3
- package/dist/cjs/index.js +9 -0
- package/package.json +35 -9
- package/es/constants.js +0 -16
- package/es/index.js +0 -272
- package/es/overlay.js +0 -184
- package/es/style.css +0 -1
- package/es/utils/object-to-css.js +0 -3
- package/lib/constants.js +0 -25
- package/lib/index.js +0 -284
- package/lib/overlay.js +0 -196
- package/lib/style.css +0 -1
- package/lib/utils/object-to-css.js +0 -11
- package/umd/checkout-sdk.js +0 -2193
- package/umd/checkout-sdk.min.js +0 -3
- package/umd/checkout-sdk.min.js.map +0 -1
- package/umd/main.3a4213e0.css +0 -2
- package/umd/main.3a4213e0.css.map +0 -1
package/README.md
CHANGED
|
@@ -7,8 +7,12 @@ The Medipass Checkout SDK is a client-side JavaScript library which allows you t
|
|
|
7
7
|
- [Medipass Checkout SDK](#medipass-checkout-sdk)
|
|
8
8
|
- [Table of Contents](#table-of-contents)
|
|
9
9
|
- [Install](#install)
|
|
10
|
-
- [
|
|
10
|
+
- [Create Checkout](#create-checkout)
|
|
11
|
+
- [Basic Usage](#basic-usage)
|
|
11
12
|
- [With a `<script>` tag](#with-a-script-tag)
|
|
13
|
+
- [Request To Update Patient Card Details](#request-to-update-patient-card-details)
|
|
14
|
+
- [Example](#example)
|
|
15
|
+
- [Using `<script>` tag](#using-script-tag)
|
|
12
16
|
- [API](#api)
|
|
13
17
|
- [sdk.init(config)](#sdkinitconfig)
|
|
14
18
|
- [config](#config)
|
|
@@ -27,7 +31,11 @@ or NPM:
|
|
|
27
31
|
npm install @medipass/checkout-sdk
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
##
|
|
34
|
+
## Create Checkout
|
|
35
|
+
|
|
36
|
+
A payment request URL is passed to the createCheckout function, which opens a secure pop-up window to Medipass to take the payment.
|
|
37
|
+
|
|
38
|
+
### Basic Usage
|
|
31
39
|
|
|
32
40
|
```jsx
|
|
33
41
|
import medipassCheckoutSDK from '@medipass/checkout-sdk';
|
|
@@ -51,7 +59,7 @@ medipassCheckoutSDK.init({
|
|
|
51
59
|
|
|
52
60
|
const paymentRequestUrl = getPaymentRequestUrl();
|
|
53
61
|
|
|
54
|
-
medipassCheckoutSDK.createCheckout({
|
|
62
|
+
await medipassCheckoutSDK.createCheckout({
|
|
55
63
|
paymentRequestUrl // the paymentRequestUrl returned after creating a Medipass invoice
|
|
56
64
|
});
|
|
57
65
|
|
|
@@ -92,6 +100,59 @@ medipassCheckoutSDK.createCheckout({
|
|
|
92
100
|
</html>
|
|
93
101
|
```
|
|
94
102
|
|
|
103
|
+
## Request To Update Patient Card Details
|
|
104
|
+
You can update a patient's payment details using the requestUpdatePaymentDetails function.
|
|
105
|
+
|
|
106
|
+
### Example
|
|
107
|
+
```jsx
|
|
108
|
+
import medipassCheckoutSDK from '@medipass/checkout-sdk';
|
|
109
|
+
// or: const medipassCheckoutSDK = require('@medipass/checkout-sdk');
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
await medipassCheckoutSDK.requestUpdatePaymentDetails({
|
|
113
|
+
apiKey, // apiKey | undefined
|
|
114
|
+
token, // token | undefined
|
|
115
|
+
patientRefId, // patientRefId
|
|
116
|
+
env, // 'stg' | 'prod'
|
|
117
|
+
onSuccess, // Invoked when the payment method update has been successful
|
|
118
|
+
onFailure, // Invoked when the payment method update has failed
|
|
119
|
+
onCancel, // Invoked when the payment method update has been rejected
|
|
120
|
+
onClose, // Invoked when the pop-up window has been closed by the user
|
|
121
|
+
callbackOrigin // The origin of the window invoking the checkout SDK
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Using `<script>` tag
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<html>
|
|
130
|
+
<head>
|
|
131
|
+
<script src="https://unpkg.com/@medipass/checkout-sdk/umd/@medipass/checkout-sdk.min.js"></script>
|
|
132
|
+
</head>
|
|
133
|
+
<body>
|
|
134
|
+
<script>
|
|
135
|
+
|
|
136
|
+
medipassCheckoutSDK.requestUpdatePaymentDetails({
|
|
137
|
+
apiKey, // apiKey | undefined
|
|
138
|
+
token, // token | undefined
|
|
139
|
+
patientRefId, // patientRefId
|
|
140
|
+
env, // 'stg' | 'prod'
|
|
141
|
+
onSuccess, // Invoked when the payment method update has been successful
|
|
142
|
+
onFailure, // Invoked when the payment method update has failed
|
|
143
|
+
onCancel, // Invoked when the payment method update has been rejected
|
|
144
|
+
onClose, // Invoked when the pop-up window has been closed by the user
|
|
145
|
+
callbackOrigin // The origin of the window invoking the checkout SDK
|
|
146
|
+
});
|
|
147
|
+
</script>
|
|
148
|
+
</body>
|
|
149
|
+
</html>
|
|
150
|
+
```
|
|
151
|
+
Take note of the following:
|
|
152
|
+
1. medipassCheckoutSDK.int() should not be called when using requestUpdatePaymentDetails
|
|
153
|
+
2. it is required that you pass either an apiKey or a token
|
|
154
|
+
|
|
155
|
+
|
|
95
156
|
## API
|
|
96
157
|
|
|
97
158
|
### sdk.init(config)
|