导入
开始使用 Square SDK
了解 Square Node.js SDK。
- 软件构建工具
- 示例代码
- 编译器
- 库
- 文档
- 调试器
...
...
本章讨论的 Square SDK 方法
1import { Client, Environment } from 'square'; 2 3const client = new Client({ 4 accessToken: '{{ACCESS_TOKEN}}', 5 environment: Environment.Sandbox, 6}); 7 8try { 9 const response = await client.locationsApi.listLocations(); 10 printResponse(response.body); 11} catch(error) { 12 console.log(error); 13}
1import { Client, Environment } from 'square'; 2 3const client = new Client({ 4 accessToken: '{{ACCESS_TOKEN}}', 5 environment: Environment.Sandbox, 6}); 7 8try { 9 const response = await client.invoicesApi.listInvoices('{{LOCATION_ID}}'); 10 printResponse(response.body); 11} catch(error) { 12 console.log(error); 13}