@undernouzen/ay-payments-sdk 1.0.2 → 1.0.3
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/CHANGELOG.md +18 -0
- package/README.md +80 -221
- package/dist/client.d.ts +199 -175
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -2
- package/dist/client.js.map +1 -1
- package/dist/core.d.ts +51 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -0
- package/dist/errors.d.ts +43 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +31 -0
- package/dist/errors.js.map +1 -0
- package/dist/models.d.ts +277 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +2 -0
- package/dist/models.js.map +1 -0
- package/dist/modules/admin.types.d.ts +35 -0
- package/dist/modules/admin.types.d.ts.map +1 -0
- package/dist/modules/admin.types.js +2 -0
- package/dist/modules/admin.types.js.map +1 -0
- package/dist/modules/analytics.types.d.ts +21 -0
- package/dist/modules/analytics.types.d.ts.map +1 -0
- package/dist/modules/analytics.types.js +2 -0
- package/dist/modules/analytics.types.js.map +1 -0
- package/dist/modules/api-keys.types.d.ts +20 -0
- package/dist/modules/api-keys.types.d.ts.map +1 -0
- package/dist/modules/api-keys.types.js +2 -0
- package/dist/modules/api-keys.types.js.map +1 -0
- package/dist/modules/auth.types.d.ts +55 -0
- package/dist/modules/auth.types.d.ts.map +1 -0
- package/dist/modules/auth.types.js +2 -0
- package/dist/modules/auth.types.js.map +1 -0
- package/dist/modules/checkouts.types.d.ts +128 -0
- package/dist/modules/checkouts.types.d.ts.map +1 -0
- package/dist/modules/checkouts.types.js +2 -0
- package/dist/modules/checkouts.types.js.map +1 -0
- package/dist/modules/commissions.types.d.ts +17 -0
- package/dist/modules/commissions.types.d.ts.map +1 -0
- package/dist/modules/commissions.types.js +2 -0
- package/dist/modules/commissions.types.js.map +1 -0
- package/dist/modules/customers.types.d.ts +22 -0
- package/dist/modules/customers.types.d.ts.map +1 -0
- package/dist/modules/customers.types.js +2 -0
- package/dist/modules/customers.types.js.map +1 -0
- package/dist/modules/logs.types.d.ts +16 -0
- package/dist/modules/logs.types.d.ts.map +1 -0
- package/dist/modules/logs.types.js +2 -0
- package/dist/modules/logs.types.js.map +1 -0
- package/dist/modules/orders.types.d.ts +32 -0
- package/dist/modules/orders.types.d.ts.map +1 -0
- package/dist/modules/orders.types.js +2 -0
- package/dist/modules/orders.types.js.map +1 -0
- package/dist/modules/products.types.d.ts +28 -0
- package/dist/modules/products.types.d.ts.map +1 -0
- package/dist/modules/products.types.js +2 -0
- package/dist/modules/products.types.js.map +1 -0
- package/dist/modules/profile.types.d.ts +23 -0
- package/dist/modules/profile.types.d.ts.map +1 -0
- package/dist/modules/profile.types.js +2 -0
- package/dist/modules/profile.types.js.map +1 -0
- package/dist/modules/projects.types.d.ts +91 -0
- package/dist/modules/projects.types.d.ts.map +1 -0
- package/dist/modules/projects.types.js +2 -0
- package/dist/modules/projects.types.js.map +1 -0
- package/dist/types.d.ts +15 -621
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -10
- package/dist/types.js.map +1 -1
- package/examples/calculate-checkout.ts +25 -0
- package/examples/create-pix-checkout.ts +30 -0
- package/examples/create-project.ts +21 -0
- package/examples/handle-error.ts +22 -0
- package/package.json +19 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.3
|
|
4
|
+
|
|
5
|
+
- Reorganized public SDK types by module.
|
|
6
|
+
- Added typed `ApiResult<T>` responses.
|
|
7
|
+
- Added `isApiError`, `isContextError` and `isExternalProviderError` helpers.
|
|
8
|
+
- Sanitized connected account types so public SDK responses do not expose `accessToken` or `refreshToken`.
|
|
9
|
+
- Added module-specific package exports.
|
|
10
|
+
|
|
11
|
+
## 1.0.2
|
|
12
|
+
|
|
13
|
+
- Updated package scope to `@undernouzen/ay-payments-sdk`.
|
|
14
|
+
- Added AY Payments docs homepage.
|
|
15
|
+
|
|
16
|
+
## 1.0.0
|
|
17
|
+
|
|
18
|
+
- Initial SDK client for AY Payments API v1.
|
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# AY Payments SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript/JavaScript SDK for the AY Payments API.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Full docs: https://aypayments.undernouzen.com.br/docs/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Instalação
|
|
7
|
+
## Install
|
|
10
8
|
|
|
11
9
|
```bash
|
|
12
10
|
npm install @undernouzen/ay-payments-sdk
|
|
13
11
|
```
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @undernouzen/ay-payments-sdk
|
|
15
|
+
```
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Create a client
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
import { createAYPaymentsClient } from "@undernouzen/ay-payments-sdk";
|
|
@@ -25,13 +25,13 @@ const ay = createAYPaymentsClient({
|
|
|
25
25
|
});
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
The default API base is:
|
|
29
29
|
|
|
30
|
-
```
|
|
30
|
+
```txt
|
|
31
31
|
https://aypayments.undernouzen.com.br/api/v1
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
You can also pass the exact API URL:
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
37
|
const ay = createAYPaymentsClient({
|
|
@@ -40,28 +40,24 @@ const ay = createAYPaymentsClient({
|
|
|
40
40
|
});
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
##
|
|
43
|
+
## Authentication
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Default:
|
|
46
46
|
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
baseUrl: "https://aypayments.undernouzen.com.br",
|
|
50
|
-
apiKey: "ayp_secret",
|
|
51
|
-
});
|
|
47
|
+
```http
|
|
48
|
+
Authorization: Bearer ayp_secret
|
|
52
49
|
```
|
|
53
50
|
|
|
54
|
-
|
|
51
|
+
Use `x-api-key` instead:
|
|
55
52
|
|
|
56
53
|
```ts
|
|
57
54
|
const ay = createAYPaymentsClient({
|
|
58
|
-
baseUrl: "https://aypayments.undernouzen.com.br",
|
|
59
55
|
apiKey: "ayp_secret",
|
|
60
56
|
authHeader: "x-api-key",
|
|
61
57
|
});
|
|
62
58
|
```
|
|
63
59
|
|
|
64
|
-
|
|
60
|
+
Send the raw key in `Authorization`:
|
|
65
61
|
|
|
66
62
|
```ts
|
|
67
63
|
const ay = createAYPaymentsClient({
|
|
@@ -70,56 +66,68 @@ const ay = createAYPaymentsClient({
|
|
|
70
66
|
});
|
|
71
67
|
```
|
|
72
68
|
|
|
73
|
-
|
|
69
|
+
The client can be created without an API key. Protected routes will then depend on session cookies or return an API auth error.
|
|
70
|
+
|
|
71
|
+
## Error handling
|
|
72
|
+
|
|
73
|
+
Mapped SDK methods return `ApiResult<T>`, which is either the expected response or an `ErrorResponse`.
|
|
74
74
|
|
|
75
75
|
```ts
|
|
76
|
-
|
|
77
|
-
```
|
|
76
|
+
import { createAYPaymentsClient, isApiError } from "@undernouzen/ay-payments-sdk";
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
const ay = createAYPaymentsClient({ apiKey: "ayp_secret" });
|
|
80
79
|
|
|
81
|
-
|
|
80
|
+
const result = await ay.projects.accounts.list("project-id-or-external-id");
|
|
81
|
+
|
|
82
|
+
if (isApiError(result)) {
|
|
83
|
+
console.log(result.error);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
console.log(result.accounts);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Error shapes:
|
|
82
91
|
|
|
83
92
|
```ts
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
type ErrorResponse = CommunError | ContextError | ExternalProviderError;
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Versioning
|
|
88
97
|
|
|
98
|
+
`v1` is the default.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
89
101
|
await ay.v1.projects.list();
|
|
90
102
|
```
|
|
91
103
|
|
|
92
|
-
|
|
104
|
+
Convenience aliases point to `v1`:
|
|
93
105
|
|
|
94
106
|
```ts
|
|
95
107
|
await ay.projects.list();
|
|
96
|
-
await ay.products.
|
|
108
|
+
await ay.products.listByProject("project-id");
|
|
97
109
|
await ay.checkouts.create(payload);
|
|
98
110
|
```
|
|
99
111
|
|
|
100
|
-
## Raw
|
|
112
|
+
## Raw requests
|
|
101
113
|
|
|
102
|
-
|
|
114
|
+
Use `raw` or the exposed Axios instance for endpoints not mapped yet.
|
|
103
115
|
|
|
104
116
|
```ts
|
|
105
|
-
const
|
|
117
|
+
const result = await ay.raw<{ ok: boolean }>({
|
|
106
118
|
method: "GET",
|
|
107
|
-
url: "/
|
|
119
|
+
url: "/projects",
|
|
108
120
|
});
|
|
109
121
|
```
|
|
110
122
|
|
|
111
|
-
Você também pode usar a instância diretamente:
|
|
112
|
-
|
|
113
123
|
```ts
|
|
114
124
|
const response = await ay.api.get("/projects");
|
|
115
125
|
```
|
|
116
126
|
|
|
117
127
|
## Projects
|
|
118
128
|
|
|
119
|
-
Criar ou atualizar por `externalId`:
|
|
120
|
-
|
|
121
129
|
```ts
|
|
122
|
-
const
|
|
130
|
+
const result = await ay.projects.create({
|
|
123
131
|
externalId: "832320430277918720",
|
|
124
132
|
name: "Vagalumes",
|
|
125
133
|
webhookUrl: "https://guildbuilders.example.com/webhooks/aypayments",
|
|
@@ -127,32 +135,15 @@ const { project, created } = await ay.projects.create({
|
|
|
127
135
|
guildId: "832320430277918720",
|
|
128
136
|
},
|
|
129
137
|
});
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Listar:
|
|
133
|
-
|
|
134
|
-
```ts
|
|
135
|
-
const { projects, pagination } = await ay.projects.list({
|
|
136
|
-
page: 1,
|
|
137
|
-
limit: 50,
|
|
138
|
-
});
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Buscar com query parcial, incluindo metadata:
|
|
142
138
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
guildId: "832320430277918720",
|
|
147
|
-
},
|
|
148
|
-
});
|
|
139
|
+
if (!isApiError(result)) {
|
|
140
|
+
console.log(result.project.id, result.created);
|
|
141
|
+
}
|
|
149
142
|
```
|
|
150
143
|
|
|
151
|
-
|
|
144
|
+
## Connected accounts
|
|
152
145
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
Gerar URL OAuth:
|
|
146
|
+
Generate an OAuth URL:
|
|
156
147
|
|
|
157
148
|
```ts
|
|
158
149
|
const oauth = await ay.projects.accounts.oauth({
|
|
@@ -162,43 +153,34 @@ const oauth = await ay.projects.accounts.oauth({
|
|
|
162
153
|
redirectUrl: "https://guildbuilders.example.com/connect/result",
|
|
163
154
|
});
|
|
164
155
|
|
|
165
|
-
|
|
156
|
+
if (!isApiError(oauth)) {
|
|
157
|
+
console.log(oauth.authorizationUrl);
|
|
158
|
+
}
|
|
166
159
|
```
|
|
167
160
|
|
|
168
|
-
|
|
161
|
+
List connected accounts:
|
|
169
162
|
|
|
170
163
|
```ts
|
|
171
|
-
const
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
Editar nome/status:
|
|
164
|
+
const accounts = await ay.projects.accounts.list("832320430277918720");
|
|
175
165
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
status: "active",
|
|
180
|
-
});
|
|
166
|
+
if (!isApiError(accounts)) {
|
|
167
|
+
console.log(accounts.accounts);
|
|
168
|
+
}
|
|
181
169
|
```
|
|
182
170
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
```ts
|
|
186
|
-
await ay.projects.accounts.delete("832320430277918720", "connection-id");
|
|
187
|
-
```
|
|
171
|
+
Public connected account responses never expose `accessToken` or `refreshToken`.
|
|
188
172
|
|
|
189
173
|
## Products
|
|
190
174
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
Criar produto:
|
|
175
|
+
Products use `value`. Product routes do not calculate platform commission; commission is calculated by checkout routes.
|
|
194
176
|
|
|
195
177
|
```ts
|
|
196
|
-
const
|
|
178
|
+
const product = await ay.products.create("832320430277918720", {
|
|
197
179
|
connectedAccountId: "330692399",
|
|
198
180
|
name: "Cargo VIP",
|
|
181
|
+
value: 19.9,
|
|
199
182
|
icon: "https://cdn.example.com/vip.png",
|
|
200
183
|
description: "Acesso VIP no Discord",
|
|
201
|
-
value: 19.9,
|
|
202
184
|
fees: [
|
|
203
185
|
{
|
|
204
186
|
name: "Taxa operacional",
|
|
@@ -208,63 +190,30 @@ const { product } = await ay.products.create("832320430277918720", {
|
|
|
208
190
|
active: true,
|
|
209
191
|
},
|
|
210
192
|
],
|
|
211
|
-
metadata: {
|
|
212
|
-
discordRoleId: "123",
|
|
213
|
-
},
|
|
214
|
-
});
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
Listar por projeto:
|
|
218
|
-
|
|
219
|
-
```ts
|
|
220
|
-
const { products } = await ay.products.listByProject("832320430277918720");
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
Buscar produtos:
|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
const result = await ay.products.query({
|
|
227
|
-
metadata: {
|
|
228
|
-
discordRoleId: "123",
|
|
229
|
-
},
|
|
230
193
|
});
|
|
231
194
|
```
|
|
232
195
|
|
|
233
196
|
## Checkouts
|
|
234
197
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
Use `calculate` para exibir o resumo antes de gerar Pix, boleto ou Checkout Pro/Stripe Checkout.
|
|
198
|
+
Calculate totals without creating an order/payment:
|
|
238
199
|
|
|
239
200
|
```ts
|
|
240
201
|
const calculation = await ay.checkouts.calculate({
|
|
241
|
-
items: [
|
|
242
|
-
{
|
|
243
|
-
productId: "product-id",
|
|
244
|
-
quantity: 1,
|
|
245
|
-
},
|
|
246
|
-
],
|
|
202
|
+
items: [{ productId: "product-id", quantity: 1 }],
|
|
247
203
|
customer: {
|
|
248
204
|
email: "cliente@example.com",
|
|
249
205
|
name: "Cliente Teste",
|
|
250
206
|
},
|
|
251
207
|
currency: "BRL",
|
|
252
208
|
});
|
|
253
|
-
|
|
254
|
-
console.log(calculation.summary.amount);
|
|
255
209
|
```
|
|
256
210
|
|
|
257
|
-
|
|
211
|
+
Create a real checkout:
|
|
258
212
|
|
|
259
213
|
```ts
|
|
260
214
|
const checkout = await ay.checkouts.create({
|
|
261
215
|
paymentMethod: "pix",
|
|
262
|
-
items: [
|
|
263
|
-
{
|
|
264
|
-
productId: "product-id",
|
|
265
|
-
quantity: 1,
|
|
266
|
-
},
|
|
267
|
-
],
|
|
216
|
+
items: [{ productId: "product-id", quantity: 1 }],
|
|
268
217
|
customer: {
|
|
269
218
|
email: "cliente@example.com",
|
|
270
219
|
name: "Cliente Teste",
|
|
@@ -273,26 +222,14 @@ const checkout = await ay.checkouts.create({
|
|
|
273
222
|
},
|
|
274
223
|
externalReference: "guild-832320430277918720-user-123",
|
|
275
224
|
webhookUrl: "https://guildbuilders.example.com/webhooks/orders",
|
|
276
|
-
redirectUrls: {
|
|
277
|
-
successUrl: "https://guildbuilders.example.com/payments/success",
|
|
278
|
-
pendingUrl: "https://guildbuilders.example.com/payments/pending",
|
|
279
|
-
failureUrl: "https://guildbuilders.example.com/payments/failure",
|
|
280
|
-
cancelUrl: "https://guildbuilders.example.com/payments/cancel",
|
|
281
|
-
},
|
|
282
225
|
metadata: {
|
|
283
226
|
guildId: "832320430277918720",
|
|
284
227
|
discordUserId: "123456789",
|
|
285
228
|
},
|
|
286
229
|
});
|
|
287
|
-
|
|
288
|
-
console.log(checkout.order.id);
|
|
289
|
-
console.log(checkout.payment?.qrCode);
|
|
290
|
-
console.log(checkout.checkout?.url);
|
|
291
230
|
```
|
|
292
231
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
Para itens sem produto cadastrado, informe `projectId` e `accountId`. Todos os itens do mesmo checkout devem resolver para o mesmo projeto e a mesma conta conectada.
|
|
232
|
+
Custom checkout without a registered product:
|
|
296
233
|
|
|
297
234
|
```ts
|
|
298
235
|
const checkout = await ay.checkouts.create({
|
|
@@ -304,108 +241,30 @@ const checkout = await ay.checkouts.create({
|
|
|
304
241
|
name: "Cargo VIP",
|
|
305
242
|
amount: 19.9,
|
|
306
243
|
quantity: 1,
|
|
307
|
-
description: "Acesso VIP no Discord",
|
|
308
244
|
},
|
|
309
245
|
],
|
|
310
246
|
customer: {
|
|
311
247
|
email: "cliente@example.com",
|
|
312
248
|
name: "Cliente Teste",
|
|
313
249
|
},
|
|
314
|
-
externalReference: "guild-832320430277918720-custom-001",
|
|
315
|
-
});
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
## Orders
|
|
319
|
-
|
|
320
|
-
Listar orders:
|
|
321
|
-
|
|
322
|
-
```ts
|
|
323
|
-
const { orders } = await ay.orders.list({ page: 1, limit: 100 });
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
Buscar por metadata:
|
|
327
|
-
|
|
328
|
-
```ts
|
|
329
|
-
const result = await ay.orders.query({
|
|
330
|
-
metadata: {
|
|
331
|
-
guildId: "832320430277918720",
|
|
332
|
-
},
|
|
333
250
|
});
|
|
334
251
|
```
|
|
335
252
|
|
|
336
|
-
|
|
253
|
+
## Typed imports
|
|
337
254
|
|
|
338
|
-
|
|
339
|
-
const result = await ay.orders.listByProject("832320430277918720");
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
## Customers
|
|
343
|
-
|
|
344
|
-
A API atual usa `/clients`, mas a SDK expõe `customers` e o alias `clients`.
|
|
255
|
+
Everything is also available from `types`:
|
|
345
256
|
|
|
346
257
|
```ts
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
const { clients } = await ay.customers.list();
|
|
258
|
+
import type {
|
|
259
|
+
AyPaymentsCreateProjectPayload,
|
|
260
|
+
AyPaymentsCreateCheckoutResponse,
|
|
261
|
+
ErrorResponse,
|
|
262
|
+
} from "@undernouzen/ay-payments-sdk/types";
|
|
355
263
|
```
|
|
356
264
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
Essas rotas dependem do escopo da sessão/API key.
|
|
265
|
+
Module-specific imports are supported:
|
|
360
266
|
|
|
361
267
|
```ts
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
password: "123456",
|
|
365
|
-
name: "Minha Loja",
|
|
366
|
-
fullName: "Responsavel",
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
const key = await ay.apiKeys.create({
|
|
370
|
-
name: "Guild Builders",
|
|
371
|
-
permissions: {
|
|
372
|
-
projects: { list: true, create: true, edit: true, delete: false },
|
|
373
|
-
products: { list: true, create: true, edit: true, delete: true },
|
|
374
|
-
orders: { list: true, create: true },
|
|
375
|
-
},
|
|
376
|
-
});
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
Revogar, habilitar/desabilitar ou deletar:
|
|
380
|
-
|
|
381
|
-
```ts
|
|
382
|
-
await ay.apiKeys.revoke("api-key-id");
|
|
383
|
-
await ay.apiKeys.setStatus("api-key-id", "active");
|
|
384
|
-
await ay.apiKeys.delete("api-key-id");
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
## Tratamento de erro
|
|
388
|
-
|
|
389
|
-
Métodos da SDK retornam `data` em caso de sucesso e lançam `AyPaymentsApiError` em caso de erro.
|
|
390
|
-
|
|
391
|
-
```ts
|
|
392
|
-
import { AyPaymentsApiError } from "@ay-payments/sdk";
|
|
393
|
-
|
|
394
|
-
try {
|
|
395
|
-
await ay.projects.list();
|
|
396
|
-
} catch (error) {
|
|
397
|
-
if (error instanceof AyPaymentsApiError) {
|
|
398
|
-
console.log(error.status);
|
|
399
|
-
console.log(error.payload.error);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
268
|
+
import type { AyPaymentsCheckoutPayload } from "@undernouzen/ay-payments-sdk/modules/checkouts.types";
|
|
269
|
+
import { isApiError } from "@undernouzen/ay-payments-sdk/errors";
|
|
402
270
|
```
|
|
403
|
-
|
|
404
|
-
## Notas de contrato
|
|
405
|
-
|
|
406
|
-
- Produto usa `value`.
|
|
407
|
-
- Produto não calcula comissão.
|
|
408
|
-
- Comissão é calculada em `POST /checkouts/calculate` e `POST /checkouts`.
|
|
409
|
-
- `projectIdOrExternalId` aceita o `id` interno do AY Payments ou o `externalId` do projeto.
|
|
410
|
-
- `connectedAccountId` é o id da conta conectada no provedor, como `acct_...` na Stripe ou o user id do Mercado Pago.
|
|
411
|
-
- `connectionId` é o id interno da conexão dentro do projeto.
|