Skip to content

Commit 6b74e8f

Browse files
committed
chore(docs): update docs and e2e-tests
1 parent 21ec74a commit 6b74e8f

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ if (paypal) {
8383
```js
8484
import { loadScript } from "@paypal/paypal-js";
8585

86-
loadScript({ "client-id": "test" })
86+
loadScript({ clientId: "test" })
8787
.then((paypal) => {
8888
paypal
8989
.Buttons()
@@ -99,14 +99,14 @@ loadScript({ "client-id": "test" })
9999

100100
### Passing Arguments
101101

102-
The `loadScript` function accepts an object for configuring the JS SDK. It's used for setting query parameters and script attributes.
102+
The `loadScript` function accepts an object for configuring the JS SDK. It's used for setting query parameters and script attributes. It accepts parameters in camelCase or kebab-case.
103103

104104
#### Query Parameters
105105

106106
The following example adds `client-id` and `currency` as query string parameters:
107107

108108
```js
109-
loadScript({ "client-id": "YOUR_CLIENT_ID", currency: "EUR" });
109+
loadScript({ clientId: "YOUR_CLIENT_ID", currency: "EUR" });
110110
```
111111

112112
Which will load the following `<script>` asynchronously:
@@ -119,7 +119,7 @@ By default, the JS SDK only loads the buttons component. The `components` query
119119

120120
```js
121121
loadScript({
122-
"client-id": "YOUR_CLIENT_ID",
122+
clientId: "YOUR_CLIENT_ID",
123123
components: "buttons,marks,messages",
124124
});
125125
```
@@ -134,12 +134,12 @@ View the [full list of supported query parameters](https://developer.paypal.com/
134134

135135
#### Data Attributes
136136

137-
All options prefixed with `data-` are considered attributes. The following example adds `data-page-type` as an attribute:
137+
All options prefixed with `data` are considered attributes. The following example adds `data-page-type` as an attribute:
138138

139139
```js
140140
loadScript({
141-
"client-id": "YOUR_CLIENT_ID",
142-
"data-page-type": "checkout",
141+
clientId: "YOUR_CLIENT_ID",
142+
dataPageType: "checkout",
143143
});
144144
```
145145

@@ -154,16 +154,16 @@ Which will load the following `<script>` asynchronously:
154154

155155
View the [full list of supported script parameters](https://developer.paypal.com/sdk/js/configuration/#link-scriptparameters).
156156

157-
#### Merchant ID Array
157+
#### Merchant Id Array
158158

159-
The `merchant-id` option accepts an array to simplify the implementation for Multi-Seller Payments. With this approach the caller doesn't have to worry about managing the two different merchant id values (`data-merchant-id` and `merchant-id`).
159+
The `merchantId` option accepts an array to simplify the implementation for Multi-Seller Payments. With this approach the caller doesn't have to worry about managing the two different merchant id values (`data-merchant-id` and `merchant-id`).
160160

161-
**Here's an example with multiple `merchant-id` values:**
161+
**Here's an example with multiple `merchantId` values:**
162162

163163
```js
164164
loadScript({
165-
"client-id": "YOUR_CLIENT_ID",
166-
"merchant-id": ["123", "456", "789"],
165+
clientId: "YOUR_CLIENT_ID",
166+
merchantId: ["123", "456", "789"],
167167
});
168168
```
169169

@@ -180,8 +180,8 @@ Which will load the following `<script>` and use `merchant-id=*` to properly con
180180

181181
```js
182182
loadScript({
183-
"client-id": "YOUR_CLIENT_ID",
184-
"merchant-id": ["123"],
183+
clientId: "YOUR_CLIENT_ID",
184+
merchantId: ["123"],
185185
});
186186
```
187187

@@ -191,14 +191,14 @@ When there's only one, the merchant-id is passed in using the query string.
191191
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID&merchant-id=123"></script>
192192
```
193193

194-
#### sdkBaseURL
194+
#### sdkBaseUrl
195195

196-
For local development, the `sdkBaseURL` option can be used to set the base url of the JS SDK:
196+
For local development, the `sdkBaseUrl` option can be used to set the base url of the JS SDK:
197197

198198
```js
199199
loadScript({
200-
"client-id": "YOUR_CLIENT_ID",
201-
sdkBaseURL: "http://localhost.paypal.com:8000/sdk/js",
200+
clientId: "YOUR_CLIENT_ID",
201+
sdkBaseUrl: "http://localhost.paypal.com:8000/sdk/js",
202202
});
203203
```
204204

@@ -237,7 +237,7 @@ The paypal-js script is also available on the [unpkg CDN](https://unpkg.com/). T
237237
<body>
238238
<div id="paypal-buttons"></div>
239239
<script>
240-
window.paypalLoadScript({ "client-id": "test" }).then((paypal) => {
240+
window.paypalLoadScript({ clientId: "test" }).then((paypal) => {
241241
paypal.Buttons().render("#paypal-buttons");
242242
});
243243
</script>

e2e-tests/browser-global.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ <h1>Demo with window.paypalLoadScript</h1>
1010
<script src="../../dist/iife/paypal-js.min.js"></script>
1111
<script>
1212
var options = {
13-
"client-id": "test",
14-
"data-page-type": "checkout",
13+
clientId: "test",
14+
dataPageType: "checkout",
1515
};
1616

1717
window.paypalLoadScript(options).then(function (paypal) {

e2e-tests/load-cached-script.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ <h1>Load Cached Script</h1>
1111
import { loadScript } from "../../dist/esm/paypal-js.js";
1212

1313
const options = {
14-
"client-id": "test",
15-
"data-page-type": "checkout",
14+
clientId: "test",
15+
dataPageType: "checkout",
1616
};
1717

1818
// initial load and render

e2e-tests/reload-script.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ <h1>Reload Script Demo</h1>
1111
import { loadScript } from "../../dist/esm/paypal-js.js";
1212

1313
const options = {
14-
"client-id": "test",
15-
"data-page-type": "checkout",
14+
clientId: "test",
15+
dataPageType: "checkout",
1616
currency: document.querySelector("#currency").value,
1717
};
1818

e2e-tests/validation-errors.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h1>Validation Errors</h1>
3434
.addEventListener("click", () => {
3535
// Error: client-id not recognized for either production or sandbox: invalid-client-id-value
3636
loadScript({
37-
"client-id": "invalid-client-id-value",
37+
clientId: "invalid-client-id-value",
3838
}).catch((err) => setErrorMessage(err));
3939
});
4040
</script>

0 commit comments

Comments
 (0)