You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> If you're using TypeScript, make sure that the `moduleResolution` setting in your `tsconfig.json` is equal to `node16`, `nodenext`, > or `bundler` to consume the legacy SDK.
82
-
While the new SDK has a lot of improvements, we at Square understand that it takes time to upgrade when there are breaking changes. To make the migration easier, the new SDK also exports the legacy SDK as `square/legacy`. Here's an example of how you can use the legacy SDK alongside the new SDK inside a single file:
83
-
```typescript import { randomUUID } from "crypto"; import { Square, SquareClient } from "square"; import { Client } from "square/legacy";
81
+
## Legacy SDK
82
+
83
+
> If you're using TypeScript, make sure that the `moduleResolution` setting in your `tsconfig.json` is equal to `node16`, `nodenext`,
84
+
> or `bundler` to consume the legacy SDK.
85
+
86
+
While the new SDK has a lot of improvements, we at Square understand that it takes time to upgrade when there are breaking changes.
87
+
To make the migration easier, the new SDK also exports the legacy SDK as `square/legacy`. Here's an example of how you can use the
88
+
legacy SDK alongside the new SDK inside a single file:
@@ -115,10 +129,19 @@ async function createOrder() {
115
129
},
116
130
});
117
131
}
118
-
createOrder(); ```
132
+
133
+
createOrder();
134
+
```
135
+
119
136
We recommend migrating to the new SDK using the following steps:
120
-
1. Upgrade the NPM module to `^40.0.0` 2. Search and replace all requires and imports from `"square"` to `"square/legacy"`
121
-
- For required, replace `require("square")` with `require("square/legacy")` - For imports, replace `from"square"` with `from"square/legacy"` - For dynamic imports, replace `import("square")` with `import("square/legacy")`
137
+
138
+
1. Upgrade the NPM module to `^40.0.0` or later.
139
+
2. Search and replace all requires and imports from `"square"` to `"square/legacy"`
140
+
141
+
- For required, replace `require("square")` with `require("square/legacy")`
142
+
- For imports, replace `from "square"` with `from "square/legacy"`
143
+
- For dynamic imports, replace `import("square")` with `import("square/legacy")`
144
+
122
145
3. Gradually move over to use the new SDK by importing it from the `"square"` import.
0 commit comments