@vexpay/node 0.11.0 → 0.13.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 CHANGED
@@ -177,13 +177,28 @@ await vexpay.conversions.settings.update({ autoConvert: { COP: { percent: 50 } }
177
177
 
178
178
  ## Colombian pesos (COP)
179
179
 
180
- Collect pesos from buyers in Colombia through Bre-B, Nequi or Daviplata. Amounts are whole pesos, payments complete asynchronously (`payment.completed` / `payment.failed`), and completed payments go to your COP balance net of the COP fee. COP must be enabled on your account — otherwise the calls fail with `method_not_allowed` (403).
180
+ Collect pesos from buyers in Colombia through PSE, Bancolombia (transfer or QR), Bre-B, Nequi or Daviplata — and cards on the hosted checkout. Amounts are whole pesos, payments complete asynchronously (`payment.completed` / `payment.failed`), and completed payments go to your COP balance net of the COP fee. COP must be enabled on your account — otherwise the calls fail with `method_not_allowed` (403).
181
181
 
182
182
  ```ts
183
183
  import VexPay from '@vexpay/node';
184
184
 
185
185
  const vexpay = new VexPay(process.env.VEXPAY_API_KEY!);
186
186
 
187
+ // What your account can use now, the PSE banks, and the terms links some channels need.
188
+ const { channels, pseBanks, terms } = await vexpay.cop.channels();
189
+
190
+ // PSE: send the buyer to their bank (next.url). On redirect_pending, retrieve again in a few seconds.
191
+ const pse = await vexpay.cop.payments.create({
192
+ amountCop: 80000,
193
+ channel: 'pse',
194
+ pse: { bankCode: pseBanks![0]!.code },
195
+ buyer: {
196
+ firstName: 'Juan', lastName: 'Pérez', personType: 'natural', email: 'juan@example.com', phone: '3001234567',
197
+ documentType: 'CC', documentNumber: '1234567890', termsAccepted: true, // the buyer accepted `terms`
198
+ },
199
+ });
200
+ if (pse.next?.type === 'redirect') console.log('Send the buyer to', pse.next.url);
201
+
187
202
  // Bre-B: no buyer data. Show next.qrPngBase64 as an image and next.transferKey as text.
188
203
  const breb = await vexpay.cop.payments.create(
189
204
  { amountCop: 100000, channel: 'breb', reference: 'order-1042' },
@@ -194,10 +209,10 @@ const breb = await vexpay.cop.payments.create(
194
209
  await vexpay.cop.payments.create({
195
210
  amountCop: 50000,
196
211
  channel: 'nequi',
197
- buyer: { email: 'juan@example.com', phone: '3001234567', documentType: 'CC', documentNumber: '1234567890' },
212
+ buyer: { email: 'juan@example.com', phone: '3001234567', documentType: 'CC', documentNumber: '1234567890', termsAccepted: true },
198
213
  });
199
214
 
200
- // Daviplata: the buyer reads you the SMS code; submit it.
215
+ // Daviplata: with next.type 'submit_otp' the buyer reads you the SMS code; submit it (otherwise follow next.url).
201
216
  const davi = await vexpay.cop.payments.create({
202
217
  amountCop: 50000,
203
218
  channel: 'daviplata',
@@ -209,15 +224,54 @@ const status = (await vexpay.cop.payments.retrieve(breb.id)).status; // pending
209
224
  const { availableCop } = await vexpay.cop.balance.retrieve();
210
225
  ```
211
226
 
212
- `cancel(id)` cancels a pending payment and `refund(id)` refunds a completed one in full within 96 hours. A webhook for a COP payment has `data.method === 'COP'`; read it as `CopPaymentWebhookData`.
227
+ `cancel(id)` cancels a pending payment and `refund(id)` refunds a completed one in full (cards within 24 hours, Bre-B within 96 hours; channels without API refunds fail with `refund_not_supported`). Send `buyer.termsAccepted: true` for channels whose catalog entry has `needsTermsAcceptance`. A webhook for a COP payment has `data.method === 'COP'`; read it as `CopPaymentWebhookData`.
213
228
 
214
229
  **Test mode** (test API keys use a sandbox):
215
230
 
216
231
  | Channel | What to use | Result |
217
232
  |---|---|---|
218
233
  | Bre-B | No buyer data | QR and key from the sandbox. **Never send real money to them** — sandbox keys are reachable from real banks and the money is not credited. |
219
- | Nequi | Any valid data, e.g. phone `3001234567`, `CC` `1234567890`, any email | Completes on its own within about a minute |
220
- | Daviplata | Same buyer data (`CC`, `CE` or `TI` only) | OTP `123456`, `000000` or `111111` completes it; any other code fails with `invalid_otp` |
234
+ | Nequi | Phone `3991111111`, any valid document and email | Completes on its own within about a minute; `3992222222` is declined |
235
+ | Daviplata | Same buyer data (`CC`, `CE` or `TI` only) | With `submit_otp`, OTP `123456`, `000000` or `111111` completes it; any other code fails with `invalid_otp`. With `redirect`, follow the test page |
236
+ | PSE | Any valid buyer data | Bank code `1` approves, `2` declines |
237
+ | Card (hosted checkout) | `4242 4242 4242 4242`, any future expiry and CVC | Approved; `4111 1111 1111 1111` is declined |
238
+
239
+ ## Subscriptions
240
+
241
+ Bill a customer on a recurring USD price. Each period VEXPay issues an invoice; with `send_invoice` (default) the customer pays it on a hosted page (`hostedInvoiceUrl`), with `charge_automatically` VEXPay charges their domiciliación. Listen for `invoice.paid`, `invoice.payment_failed` and `customer.subscription.*` webhooks.
242
+
243
+ ```ts
244
+ import VexPay from '@vexpay/node';
245
+
246
+ const vexpay = new VexPay(process.env.VEXPAY_API_KEY!);
247
+
248
+ const customer = await vexpay.customers.create({ name: 'María Pérez', email: 'maria@example.com' });
249
+ const price = await vexpay.prices.create({
250
+ product: 'prod_123',
251
+ unitAmountUsd: 10,
252
+ recurring: { interval: 'month' },
253
+ });
254
+
255
+ const subscription = await vexpay.subscriptions.create(
256
+ { customer: customer.id, price: price.id, methods: ['c2p', 'pago_movil'] },
257
+ { idempotencyKey: `sub-${customer.id}` },
258
+ );
259
+
260
+ for await (const invoice of vexpay.invoices.list({ subscription: subscription.id })) {
261
+ console.log(invoice.number, invoice.status, invoice.amountDueUsd, invoice.hostedInvoiceUrl);
262
+ }
263
+
264
+ // Domiciliación: send the customer a setup link, then charge automatically.
265
+ const setup = await vexpay.setupSessions.create({ customer: customer.id });
266
+ console.log(setup.url);
267
+ for await (const method of vexpay.customers.paymentMethods.list(customer.id)) {
268
+ console.log(method.id, method.status);
269
+ }
270
+
271
+ await vexpay.subscriptions.update(subscription.id, { cancelAtPeriodEnd: true });
272
+ ```
273
+
274
+ `subscriptions.cancel(id)` cancels at once and voids its open invoices. On an open invoice, `invoices.void(id)`, `invoices.markUncollectible(id)` (stays payable) and `invoices.pay(id, { paidOutOfBand: true })` (paid outside VEXPay; no money moves). `paymentMethods.detach(id)` stops a domiciliación from being charged again.
221
275
 
222
276
  ## Testing card payments
223
277
 
@@ -278,6 +332,32 @@ const page = await vexpay.balance.transactions.list({ paymentId: 'pay_…', type
278
332
  console.log(page.items.map((m) => [m.type, m.amountVes]));
279
333
  ```
280
334
 
335
+ ## Top up your balance
336
+
337
+ Load your own Bs balance by Pago Móvil — for money that is not a sale (for example advertising income). Send the exact `amountVes` from `payerPhone` to the returned `receiver` before `expiresAt` (15 minutes); the top-up completes on its own when the transfer arrives, and its fee is charged then. The credit is held like any other credit unless you release it early with `instant` (for `instantFeeVes`). Each top-up needs a `sourceNote` and counts against your monthly limit (`topup_cap_exceeded`, 422, with `remainingUsd`/`remainingVes` in the error body). Top-ups are enabled per account (`topups_not_enabled`, 403). In balance movements they appear as `topup`, `topup_fee`, `topup_instant_release` and `topup_instant_fee`.
338
+
339
+ ```ts
340
+ import VexPay from '@vexpay/node';
341
+
342
+ const vexpay = new VexPay(process.env.VEXPAY_API_KEY!);
343
+
344
+ const topup = await vexpay.balance.topups.create({
345
+ amountVes: '100000.00',
346
+ payerPhone: '04121234567',
347
+ payerCedula: 'V12345678',
348
+ sourceNote: 'Ingresos publicidad quincena 2',
349
+ });
350
+ console.log(topup.receiver, topup.expiresAt); // where and until when to send the Pago Móvil
351
+
352
+ const { data, monthRemainingUsd } = await vexpay.balance.topups.list({ limit: 20 });
353
+ console.log(data.length, monthRemainingUsd); // newest first, plus what is left of this month's limit (USD)
354
+ const latest = await vexpay.balance.topups.retrieve(topup.id);
355
+ if (latest.status === 'completed' && latest.heldVes !== '0.00') {
356
+ await vexpay.balance.topups.instant(topup.id); // idempotent; `not_held` (409) when nothing is held
357
+ }
358
+ // Test mode only: await vexpay.balance.topups.simulate(topup.id);
359
+ ```
360
+
281
361
  ## Errors
282
362
 
283
363
  Every error extends `VexPayError` and carries `status`, the API `code` (e.g. `insufficient_balance`), and the response `body`.
@@ -340,9 +420,35 @@ await vexpay.payments.c2p.execute(
340
420
  );
341
421
  ```
342
422
 
423
+ ## Seller balances
424
+
425
+ Credit a seller from your platform balance in bolívares, or in dollars converted at the official BCV rate, then read their movements and monthly statement:
426
+
427
+ ```ts
428
+ import VexPay from '@vexpay/node';
429
+
430
+ const vexpay = new VexPay(process.env.VEXPAY_API_KEY!);
431
+ const merchantId = '00000000-0000-4000-8000-000000000002';
432
+
433
+ const balance = await vexpay.merchants.transfer(merchantId, { amountUsd: '100.00', transferKey: 'payroll-2026-11-u1' });
434
+ console.log(balance.pendingVes, balance.transfer.amountVes, balance.transfer.rate);
435
+
436
+ for await (const movement of vexpay.merchants.listTransactions(merchantId, { from: '2026-11-01T00:00:00Z' })) {
437
+ console.log(movement.type, movement.amountVes);
438
+ }
439
+
440
+ const statement = await vexpay.merchants.retrieveStatement(merchantId, { month: '2026-11' });
441
+ console.log(statement.openingVes, statement.closingVes, statement.movements.length);
442
+
443
+ const csv = await vexpay.merchants.retrieveStatementCsv(merchantId, { month: '2026-11' });
444
+ console.log(csv.split('\n')[0]);
445
+ ```
446
+
447
+ A transfer with `amountUsd` fails with `rate_unavailable` (503) when no BCV rate can be read; nothing is recorded.
448
+
343
449
  ## Pagination
344
450
 
345
- `list()` methods on payouts, merchants, and products return the first page when awaited, and every item when iterated:
451
+ `list()` methods on payouts, merchants, products, customers, prices, subscriptions and invoices return the first page when awaited, and every item when iterated:
346
452
 
347
453
  ```ts
348
454
  import VexPay from '@vexpay/node';
@@ -397,6 +503,7 @@ console.log(describe, {} as NewPayout, {} as Session);
397
503
  | `quotes` | `retrieve` |
398
504
  | `balance` | `retrieve` |
399
505
  | `balance.transactions` | `list` |
506
+ | `balance.topups` | `create`, `list`, `retrieve`, `instant`, `simulate` |
400
507
  | `payments` | `retrieve`, `retrieveByRef`, `reverse` |
401
508
  | `payments.c2p` | `request`, `execute` |
402
509
  | `payments.vpos` | `create` |
@@ -412,14 +519,22 @@ console.log(describe, {} as NewPayout, {} as Session);
412
519
  | `conversions.quotes` | `create` |
413
520
  | `conversions.settings` | `retrieve`, `update` |
414
521
  | `cop.payments` | `create`, `retrieve`, `submitOtp`, `cancel`, `refund` |
522
+ | `cop` | `channels` |
415
523
  | `cop.balance` | `retrieve` |
416
- | `merchants` | `create`, `list`, `retrieve`, `retrieveByRef`, `update`, `delete`, `retrieveBalance`, `transfer`, `listAuditEvents`, `startVerification`, `confirmVerification` |
524
+ | `merchants` | `create`, `list`, `retrieve`, `retrieveByRef`, `update`, `delete`, `retrieveBalance`, `transfer`, `listTransactions`, `retrieveStatement`, `retrieveStatementCsv`, `listAuditEvents`, `startVerification`, `confirmVerification` |
417
525
  | `merchants.payoutMethods` | `list`, `create`, `setDefault`, `delete`, `startVerification`, `confirmVerification` |
418
526
  | `payouts` | `create`, `createInstant`, `createBatch`, `list`, `retrieve`, `retrieveByRef` |
419
527
  | `products` | `create`, `list`, `retrieve`, `update`, `delete`, `createLink`, `listLinks` |
420
528
  | `paymentLinks` | `retrieve`, `update`, `delete` |
421
529
  | `tenantPayoutAccount` | `retrieve`, `upsert`, `create`, `startVerification`, `confirmVerification` |
422
530
  | `webhookEndpoints` | `create`, `list`, `update`, `delete`, `sendTest` |
531
+ | `customers` | `create`, `list`, `retrieve`, `update`, `delete` |
532
+ | `customers.paymentMethods` | `list` |
533
+ | `prices` | `create`, `list`, `retrieve`, `update` |
534
+ | `subscriptions` | `create`, `list`, `retrieve`, `update`, `cancel` |
535
+ | `invoices` | `list`, `retrieve`, `void`, `markUncollectible`, `pay` |
536
+ | `setupSessions` | `create`, `retrieve` |
537
+ | `paymentMethods` | `retrieve`, `detach` |
423
538
  | `webhooks` | `constructEvent`, `generateTestHeader` (offline) |
424
539
 
425
540
  Full API reference: [docs](https://pay.vexwallet.co/docs) · OpenAPI: `/openapi.json`.
package/dist/index.cjs CHANGED
@@ -107,7 +107,7 @@ function errorFromResponse(status, body, requestId) {
107
107
  }
108
108
 
109
109
  // src/version.ts
110
- var VERSION = "0.11.0";
110
+ var VERSION = "0.13.0";
111
111
 
112
112
  // src/core.ts
113
113
  var INITIAL_RETRY_DELAY_MS = 500;
@@ -270,6 +270,7 @@ var ROUTES = {
270
270
  ConversionSettings_update: { method: "PATCH", path: "/v1/conversions/settings" },
271
271
  CopPayments_balance: { method: "GET", path: "/v1/cop/balance" },
272
272
  CopPayments_cancel: { method: "POST", path: "/v1/cop/payments/{id}/cancel" },
273
+ CopPayments_channels: { method: "GET", path: "/v1/cop/channels" },
273
274
  CopPayments_create: { method: "POST", path: "/v1/cop/payments" },
274
275
  CopPayments_get: { method: "GET", path: "/v1/cop/payments/{id}" },
275
276
  CopPayments_refund: { method: "POST", path: "/v1/cop/payments/{id}/refund" },
@@ -280,6 +281,16 @@ var ROUTES = {
280
281
  Crypto_getBalances: { method: "GET", path: "/v1/crypto/balances" },
281
282
  Crypto_getPayout: { method: "GET", path: "/v1/crypto/payouts/{id}" },
282
283
  Crypto_listNetworks: { method: "GET", path: "/v1/crypto/networks" },
284
+ Customers_create: { method: "POST", path: "/v1/customers" },
285
+ Customers_list: { method: "GET", path: "/v1/customers" },
286
+ Customers_remove: { method: "DELETE", path: "/v1/customers/{id}" },
287
+ Customers_retrieve: { method: "GET", path: "/v1/customers/{id}" },
288
+ Customers_update: { method: "POST", path: "/v1/customers/{id}" },
289
+ Invoices_list: { method: "GET", path: "/v1/invoices" },
290
+ Invoices_markUncollectible: { method: "POST", path: "/v1/invoices/{id}/mark-uncollectible" },
291
+ Invoices_pay: { method: "POST", path: "/v1/invoices/{id}/pay" },
292
+ Invoices_retrieve: { method: "GET", path: "/v1/invoices/{id}" },
293
+ Invoices_void: { method: "POST", path: "/v1/invoices/{id}/void" },
283
294
  Merchants_addPayoutMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods" },
284
295
  Merchants_confirmVerify: { method: "POST", path: "/v1/merchants/{id}/verify" },
285
296
  Merchants_confirmVerifyMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods/{methodId}/verify" },
@@ -290,16 +301,21 @@ var ROUTES = {
290
301
  Merchants_listAuditEvents: { method: "GET", path: "/v1/merchants/{id}/audit-events" },
291
302
  Merchants_listOrGetByRef: { method: "GET", path: "/v1/merchants" },
292
303
  Merchants_listPayoutMethods: { method: "GET", path: "/v1/merchants/{id}/payout-methods" },
304
+ Merchants_listTransactions: { method: "GET", path: "/v1/merchants/{id}/transactions" },
293
305
  Merchants_remove: { method: "DELETE", path: "/v1/merchants/{id}" },
294
306
  Merchants_setDefaultPayoutMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods/{methodId}/default" },
295
307
  Merchants_startVerify: { method: "POST", path: "/v1/merchants/{id}/verify/start" },
296
308
  Merchants_startVerifyMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods/{methodId}/verify/start" },
309
+ Merchants_statement: { method: "GET", path: "/v1/merchants/{id}/statement" },
297
310
  Merchants_transfer: { method: "POST", path: "/v1/merchants/{id}/transfers" },
298
311
  Merchants_update: { method: "PATCH", path: "/v1/merchants/{id}" },
299
312
  Notifications_sendTest: { method: "POST", path: "/v1/notifications/test" },
300
313
  PaymentLinks_get: { method: "GET", path: "/v1/payment-links/{id}" },
301
314
  PaymentLinks_remove: { method: "DELETE", path: "/v1/payment-links/{id}" },
302
315
  PaymentLinks_update: { method: "PATCH", path: "/v1/payment-links/{id}" },
316
+ PaymentMethods_detach: { method: "DELETE", path: "/v1/payment-methods/{id}" },
317
+ PaymentMethods_list: { method: "GET", path: "/v1/customers/{id}/payment-methods" },
318
+ PaymentMethods_retrieve: { method: "GET", path: "/v1/payment-methods/{id}" },
303
319
  Payments_executeC2p: { method: "POST", path: "/v1/payments/c2p" },
304
320
  Payments_executeVpos: { method: "POST", path: "/v1/payments/vpos" },
305
321
  Payments_getBanks: { method: "GET", path: "/v1/banks" },
@@ -317,6 +333,10 @@ var ROUTES = {
317
333
  Payouts_getById: { method: "GET", path: "/v1/payouts/{id}" },
318
334
  Payouts_getByRef: { method: "GET", path: "/v1/payouts/by-ref/{externalRef}" },
319
335
  Payouts_list: { method: "GET", path: "/v1/payouts" },
336
+ Prices_create: { method: "POST", path: "/v1/prices" },
337
+ Prices_list: { method: "GET", path: "/v1/prices" },
338
+ Prices_retrieve: { method: "GET", path: "/v1/prices/{id}" },
339
+ Prices_update: { method: "POST", path: "/v1/prices/{id}" },
320
340
  Products_create: { method: "POST", path: "/v1/products" },
321
341
  Products_createLink: { method: "POST", path: "/v1/products/{id}/links" },
322
342
  Products_get: { method: "GET", path: "/v1/products/{id}" },
@@ -333,11 +353,23 @@ var ROUTES = {
333
353
  R4Operations_ejecutarVuelto: { method: "POST", path: "/v1/payments/change" },
334
354
  R4Operations_generarOtp: { method: "POST", path: "/v1/payments/debit/otp" },
335
355
  R4Operations_pollOperation: { method: "POST", path: "/v1/payments/operations/poll" },
356
+ SetupSessions_create: { method: "POST", path: "/v1/setup-sessions" },
357
+ SetupSessions_retrieve: { method: "GET", path: "/v1/setup-sessions/{id}" },
358
+ Subscriptions_cancel: { method: "DELETE", path: "/v1/subscriptions/{id}" },
359
+ Subscriptions_create: { method: "POST", path: "/v1/subscriptions" },
360
+ Subscriptions_list: { method: "GET", path: "/v1/subscriptions" },
361
+ Subscriptions_retrieve: { method: "GET", path: "/v1/subscriptions/{id}" },
362
+ Subscriptions_update: { method: "POST", path: "/v1/subscriptions/{id}" },
336
363
  TenantPayoutAccount_confirmVerify: { method: "POST", path: "/v1/tenant/payout-account/verify" },
337
364
  TenantPayoutAccount_get: { method: "GET", path: "/v1/tenant/payout-account" },
338
365
  TenantPayoutAccount_startVerify: { method: "POST", path: "/v1/tenant/payout-account/verify/start" },
339
366
  TenantPayoutAccount_upsert: { method: "PUT", path: "/v1/tenant/payout-account" },
340
367
  TenantPayoutAccount_upsertPost: { method: "POST", path: "/v1/tenant/payout-account" },
368
+ Topups_create: { method: "POST", path: "/v1/balance/topups" },
369
+ Topups_get: { method: "GET", path: "/v1/balance/topups/{id}" },
370
+ Topups_instant: { method: "POST", path: "/v1/balance/topups/{id}/instant" },
371
+ Topups_list: { method: "GET", path: "/v1/balance/topups" },
372
+ Topups_simulate: { method: "POST", path: "/v1/balance/topups/{id}/simulate" },
341
373
  Webhooks_createWebhook: { method: "POST", path: "/v1/webhooks" },
342
374
  Webhooks_deleteWebhook: { method: "DELETE", path: "/v1/webhooks/{id}" },
343
375
  Webhooks_listWebhooks: { method: "GET", path: "/v1/webhooks" },
@@ -388,8 +420,30 @@ var BalanceTransactions = class extends APIResource {
388
420
  );
389
421
  }
390
422
  };
423
+ var BalanceTopups = class extends APIResource {
424
+ /** Start a top-up. Over the monthly limit fails with `topup_cap_exceeded` (422). */
425
+ create(params, options) {
426
+ return this.call("Topups_create", { body: params }, options);
427
+ }
428
+ /** Your latest top-ups (newest first, `limit` 1–100) plus this month's limit usage. */
429
+ list(params = {}, options) {
430
+ return this.call("Topups_list", { query: params }, options);
431
+ }
432
+ retrieve(id, options) {
433
+ return this.call("Topups_get", { path: { id } }, options);
434
+ }
435
+ /** Release the still-held part of a completed top-up now, for `instantFeeVes`. Idempotent; `not_held` (409) if nothing is held. */
436
+ instant(id, options) {
437
+ return this.call("Topups_instant", { path: { id } }, options);
438
+ }
439
+ /** Test mode only: complete the top-up as if the Pago Móvil arrived. */
440
+ simulate(id, options) {
441
+ return this.call("Topups_simulate", { path: { id } }, options);
442
+ }
443
+ };
391
444
  var Balance = class extends APIResource {
392
445
  transactions = new BalanceTransactions(this.http);
446
+ topups = new BalanceTopups(this.http);
393
447
  retrieve(options) {
394
448
  return this.call("Balance_getBalance", {}, options);
395
449
  }
@@ -459,6 +513,126 @@ var WebhookEndpoints = class extends APIResource {
459
513
  }
460
514
  };
461
515
 
516
+ // src/resources/billing.ts
517
+ var CustomerPaymentMethods = class extends APIResource {
518
+ /** Await for one page, or `for await` over every attached method (newest first). */
519
+ list(customerId, params = {}, options) {
520
+ return new PagePromise(
521
+ (cursor) => this.call("PaymentMethods_list", { path: { id: customerId }, query: { ...params, cursor } }, options),
522
+ params.cursor
523
+ );
524
+ }
525
+ };
526
+ var Customers = class extends APIResource {
527
+ paymentMethods = new CustomerPaymentMethods(this.http);
528
+ /** Pass `idempotencyKey` in options to retry safely. */
529
+ create(params = {}, options) {
530
+ return this.call("Customers_create", { body: params }, options);
531
+ }
532
+ /** Await for one page, or `for await` over every customer (newest first). Filter with `email`. */
533
+ list(params = {}, options) {
534
+ return new PagePromise(
535
+ (cursor) => this.call("Customers_list", { query: { ...params, cursor } }, options),
536
+ params.cursor
537
+ );
538
+ }
539
+ retrieve(id, options) {
540
+ return this.call("Customers_retrieve", { path: { id } }, options);
541
+ }
542
+ update(id, params, options) {
543
+ return this.call("Customers_update", { path: { id }, body: params }, options);
544
+ }
545
+ /** Refused with 409 while the customer has a live subscription. */
546
+ delete(id, options) {
547
+ return this.call("Customers_remove", { path: { id } }, options);
548
+ }
549
+ };
550
+ var Prices = class extends APIResource {
551
+ create(params, options) {
552
+ return this.call("Prices_create", { body: params }, options);
553
+ }
554
+ /** Await for one page, or `for await` over every price. Filter with `product` and `active`. */
555
+ list(params = {}, options) {
556
+ return new PagePromise(
557
+ (cursor) => this.call("Prices_list", { query: { ...params, cursor } }, options),
558
+ params.cursor
559
+ );
560
+ }
561
+ retrieve(id, options) {
562
+ return this.call("Prices_retrieve", { path: { id } }, options);
563
+ }
564
+ /** Only `active`, `nickname` and `metadata` can change; create a new price for a new amount. */
565
+ update(id, params, options) {
566
+ return this.call("Prices_update", { path: { id }, body: params }, options);
567
+ }
568
+ };
569
+ var Subscriptions = class extends APIResource {
570
+ /** Pass `idempotencyKey` in options to retry safely. */
571
+ create(params, options) {
572
+ return this.call("Subscriptions_create", { body: params }, options);
573
+ }
574
+ /** Await for one page, or `for await` over every subscription (newest first). Filter with `customer`, `price`, `status`. */
575
+ list(params = {}, options) {
576
+ return new PagePromise(
577
+ (cursor) => this.call("Subscriptions_list", { query: { ...params, cursor } }, options),
578
+ params.cursor
579
+ );
580
+ }
581
+ retrieve(id, options) {
582
+ return this.call("Subscriptions_retrieve", { path: { id } }, options);
583
+ }
584
+ /** Changes apply from the next invoice. Set `cancelAtPeriodEnd` to cancel when the period ends. */
585
+ update(id, params, options) {
586
+ return this.call("Subscriptions_update", { path: { id }, body: params }, options);
587
+ }
588
+ /** Cancel now; its open invoices are voided. */
589
+ cancel(id, options) {
590
+ return this.call("Subscriptions_cancel", { path: { id } }, options);
591
+ }
592
+ };
593
+ var Invoices = class extends APIResource {
594
+ /** Await for one page, or `for await` over every invoice (newest first). Filter with `customer`, `subscription`, `status`. */
595
+ list(params = {}, options) {
596
+ return new PagePromise(
597
+ (cursor) => this.call("Invoices_list", { query: { ...params, cursor } }, options),
598
+ params.cursor
599
+ );
600
+ }
601
+ retrieve(id, options) {
602
+ return this.call("Invoices_retrieve", { path: { id } }, options);
603
+ }
604
+ /** Void an open invoice. */
605
+ void(id, options) {
606
+ return this.call("Invoices_void", { path: { id } }, options);
607
+ }
608
+ /** Stop chasing an open invoice; it can still be paid. */
609
+ markUncollectible(id, options) {
610
+ return this.call("Invoices_markUncollectible", { path: { id } }, options);
611
+ }
612
+ /** Record an open invoice as paid outside VEXPay (`paidOutOfBand: true`); no money moves. */
613
+ pay(id, params, options) {
614
+ return this.call("Invoices_pay", { path: { id }, body: params }, options);
615
+ }
616
+ };
617
+ var SetupSessions = class extends APIResource {
618
+ /** `url` is returned only here — send it to the customer. */
619
+ create(params, options) {
620
+ return this.call("SetupSessions_create", { body: params }, options);
621
+ }
622
+ retrieve(id, options) {
623
+ return this.call("SetupSessions_retrieve", { path: { id } }, options);
624
+ }
625
+ };
626
+ var PaymentMethods = class extends APIResource {
627
+ retrieve(id, options) {
628
+ return this.call("PaymentMethods_retrieve", { path: { id } }, options);
629
+ }
630
+ /** The method is never charged again. */
631
+ detach(id, options) {
632
+ return this.call("PaymentMethods_detach", { path: { id } }, options);
633
+ }
634
+ };
635
+
462
636
  // src/resources/commerce.ts
463
637
  var CheckoutSessions = class extends APIResource {
464
638
  /** `clientSecret` is returned only here — hand it to the browser, never store or log it. */
@@ -557,8 +731,10 @@ var Conversions = class extends APIResource {
557
731
  // src/resources/cop.ts
558
732
  var CopPayments = class extends APIResource {
559
733
  /**
560
- * Create a payment in whole pesos. `buyer` is required for `nequi` and `daviplata`. The response
561
- * `next` says what the buyer does: `show_qr`, `approve_in_app` or `submit_otp`.
734
+ * Create a payment in whole pesos. `buyer` is required for every channel except `breb`, with
735
+ * `termsAccepted: true` when {@link Cop.channels} says `needsTermsAcceptance`; `pse` also needs
736
+ * `pse.bankCode`. The response `next` says what the buyer does: `show_qr`, `approve_in_app`,
737
+ * `submit_otp`, `redirect` (send them to `next.url`) or `redirect_pending` (retrieve again shortly).
562
738
  * Pass `idempotencyKey` in options to retry safely.
563
739
  */
564
740
  create(params, options) {
@@ -567,7 +743,7 @@ var CopPayments = class extends APIResource {
567
743
  retrieve(id, options) {
568
744
  return this.call("CopPayments_get", { path: { id } }, options);
569
745
  }
570
- /** Daviplata: submit the code the buyer received by SMS. A wrong code fails with `invalid_otp`. */
746
+ /** Daviplata with `next.type: "submit_otp"`: submit the code the buyer received by SMS. A wrong code fails with `invalid_otp`. */
571
747
  submitOtp(id, params, options) {
572
748
  return this.call("CopPayments_submitOtp", { path: { id }, body: params }, options);
573
749
  }
@@ -575,7 +751,10 @@ var CopPayments = class extends APIResource {
575
751
  cancel(id, options) {
576
752
  return this.call("CopPayments_cancel", { path: { id } }, options);
577
753
  }
578
- /** Full refund of a completed payment, within 96 hours. */
754
+ /**
755
+ * Full refund of a completed payment, within the channel's window (card 24 h, Bre-B 96 h).
756
+ * Channels that cannot be refunded through the API fail with `refund_not_supported`.
757
+ */
579
758
  refund(id, options) {
580
759
  return this.call("CopPayments_refund", { path: { id } }, options);
581
760
  }
@@ -588,6 +767,10 @@ var CopBalance = class extends APIResource {
588
767
  var Cop = class extends APIResource {
589
768
  payments = new CopPayments(this.http);
590
769
  balance = new CopBalance(this.http);
770
+ /** Channels you can use right now, with what each needs, plus the PSE banks and terms links. */
771
+ channels(options) {
772
+ return this.call("CopPayments_channels", {}, options);
773
+ }
591
774
  };
592
775
 
593
776
  // src/resources/crypto.ts
@@ -684,10 +867,34 @@ var Merchants = class extends APIResource {
684
867
  retrieveBalance(id, options) {
685
868
  return this.call("Merchants_getBalance", { path: { id } }, options);
686
869
  }
687
- /** Move VES between this merchant's balance and another. */
870
+ /**
871
+ * Credit this seller's pending balance from your platform balance. Send `amountVes`, or
872
+ * `amountUsd` to convert at the official BCV rate; `transferKey` makes it idempotent.
873
+ * The response is the seller balance plus `transfer` (amounts and rate used).
874
+ */
688
875
  transfer(id, params, options) {
689
876
  return this.call("Merchants_transfer", { path: { id }, body: params }, options);
690
877
  }
878
+ /** Seller balance movements, newest first. Await for one page, or `for await` over every movement. */
879
+ listTransactions(id, params = {}, options) {
880
+ return new PagePromise(
881
+ (cursor) => this.call("Merchants_listTransactions", { path: { id }, query: { ...params, cursor } }, options),
882
+ params.cursor
883
+ );
884
+ }
885
+ /** Monthly statement (`month: 'YYYY-MM'`, America/Caracas): opening, movements, closing. */
886
+ retrieveStatement(id, params, options) {
887
+ return this.call("Merchants_statement", { path: { id }, query: { ...params, format: "json" } }, options);
888
+ }
889
+ /** The same monthly statement as CSV (with a running balance column), returned as a string. */
890
+ async retrieveStatementCsv(id, params, options) {
891
+ const body = await this.call(
892
+ "Merchants_statement",
893
+ { path: { id }, query: { ...params, format: "csv" } },
894
+ options
895
+ );
896
+ return typeof body === "string" ? body : "";
897
+ }
691
898
  listAuditEvents(id, options) {
692
899
  return this.call("Merchants_listAuditEvents", { path: { id } }, options);
693
900
  }
@@ -828,6 +1035,25 @@ var WEBHOOK_EVENT_NAMES = [
828
1035
  "tenant.api_key.rotated",
829
1036
  "tenant.api_key.revoked",
830
1037
  "tenant.live_status_changed",
1038
+ "customer.created",
1039
+ "customer.updated",
1040
+ "customer.deleted",
1041
+ "customer.subscription.created",
1042
+ "customer.subscription.updated",
1043
+ "customer.subscription.deleted",
1044
+ "customer.subscription.trial_will_end",
1045
+ "customer.subscription.reactivated",
1046
+ "invoice.created",
1047
+ "invoice.upcoming",
1048
+ "invoice.paid",
1049
+ "invoice.payment_attempt",
1050
+ "invoice.payment_failed",
1051
+ "invoice.overdue",
1052
+ "invoice.voided",
1053
+ "invoice.marked_uncollectible",
1054
+ "payment_method.attached",
1055
+ "payment_method.updated",
1056
+ "payment_method.detached",
831
1057
  "notification.test"
832
1058
  ];
833
1059
  var SIGNATURE_HEADER = "VexPay-Signature";
@@ -929,6 +1155,17 @@ var VexPay = class {
929
1155
  paymentLinks;
930
1156
  tenantPayoutAccount;
931
1157
  webhookEndpoints;
1158
+ /** Billing: who you bill. */
1159
+ customers;
1160
+ /** Billing: recurring prices on products. */
1161
+ prices;
1162
+ /** Billing: bill a customer on a price every interval. */
1163
+ subscriptions;
1164
+ invoices;
1165
+ /** Billing: hosted links where a customer authorizes domiciliación. */
1166
+ setupSessions;
1167
+ /** Billing: domiciliación payment methods (bolívar methods your account takes: `payments.methods()`). */
1168
+ paymentMethods;
932
1169
  /** Offline helpers: `constructEvent` verifies deliveries; no API calls. */
933
1170
  webhooks = new Webhooks();
934
1171
  constructor(apiKey, options = {}) {
@@ -963,6 +1200,12 @@ var VexPay = class {
963
1200
  this.paymentLinks = new PaymentLinks(this.http);
964
1201
  this.tenantPayoutAccount = new TenantPayoutAccount(this.http);
965
1202
  this.webhookEndpoints = new WebhookEndpoints(this.http);
1203
+ this.customers = new Customers(this.http);
1204
+ this.prices = new Prices(this.http);
1205
+ this.subscriptions = new Subscriptions(this.http);
1206
+ this.invoices = new Invoices(this.http);
1207
+ this.setupSessions = new SetupSessions(this.http);
1208
+ this.paymentMethods = new PaymentMethods(this.http);
966
1209
  }
967
1210
  };
968
1211
  // Annotate the CommonJS export names for ESM import in node: