Ecommerce

The client.ecommerce namespace covers payment links, payment buttons, and payment requests. All list methods return paginated results; listAll() provides an async generator for automatic pagination.

Code Example

TypeScript
const result = await client.ecommerce.paymentLinks.create({
  amount: 29.99,
  currency: 'EUR',
  description: 'Invoice #1042',
  expiresAt: '2024-12-31',
})

if (result.success) {
  console.log('Payment link URL:', result.data.url)
}

Code Example

JavaScript
const result = await client.ecommerce.paymentLinks.create({
  amount: 29.99,
  currency: 'EUR',
  description: 'Invoice #1042',
  expiresAt: '2024-12-31',
})

if (result.success) {
  console.log('Payment link URL:', result.data.url)
}

Code Example

TypeScript
const result = await client.ecommerce.paymentLinks.list({ page: 1, size: 20 })

if (result.success) {
  for (const link of result.data.items) {
    console.log(link.id + ' - ' + link.amount + ' ' + link.currency)
  }
}

Code Example

JavaScript
const result = await client.ecommerce.paymentLinks.list({ page: 1, size: 20 })

if (result.success) {
  for (const link of result.data.items) {
    console.log(link.id + ' - ' + link.amount + ' ' + link.currency)
  }
}

List All (auto-pagination)

listAll() is an async generator that automatically fetches subsequent pages:

Code Example

TypeScript
for await (const link of client.ecommerce.paymentLinks.listAll()) {
  console.log(link.id + ' - ' + link.amount + ' ' + link.currency)
}

Code Example

JavaScript
for await (const link of client.ecommerce.paymentLinks.listAll()) {
  console.log(link.id + ' - ' + link.amount + ' ' + link.currency)
}

Get, Update, Delete

Code Example

TypeScript
// Get
const getResult = await client.ecommerce.paymentLinks.get('link_id_123')

// Update
const updateResult = await client.ecommerce.paymentLinks.update('link_id_123', {
  description: 'Updated invoice',
  expiresAt: '2025-03-31',
})

// Delete
const deleteResult = await client.ecommerce.paymentLinks.delete('link_id_123')

// Get transactions for a link
const txnResult = await client.ecommerce.paymentLinks.getTransactions('link_id_123')

Code Example

JavaScript
const getResult = await client.ecommerce.paymentLinks.get('link_id_123')
const updateResult = await client.ecommerce.paymentLinks.update('link_id_123', { description: 'Updated' })
const deleteResult = await client.ecommerce.paymentLinks.delete('link_id_123')
const txnResult = await client.ecommerce.paymentLinks.getTransactions('link_id_123')

Payment Buttons

Code Example

TypeScript
// Create
const createResult = await client.ecommerce.paymentButtons.create({
  name: 'Donate €5',
  amount: 5.00,
  currency: 'EUR',
})

// List
const listResult = await client.ecommerce.paymentButtons.list({ page: 1, size: 20 })

// Get
const getResult = await client.ecommerce.paymentButtons.get('btn_id_123')

Code Example

JavaScript
const createResult = await client.ecommerce.paymentButtons.create({
  name: 'Donate €5',
  amount: 5.00,
  currency: 'EUR',
})

const listResult = await client.ecommerce.paymentButtons.list({ page: 1, size: 20 })
const getResult = await client.ecommerce.paymentButtons.get('btn_id_123')

Payment Requests

Code Example

TypeScript
// Create
const createResult = await client.ecommerce.paymentRequests.create({
  amount: 150.00,
  currency: 'EUR',
  customerEmail: 'customer@example.com',
  description: 'Service invoice',
})

// List — filter by status
const pendingResult = await client.ecommerce.paymentRequests.list({
  status: 'Pending',
  page: 1,
  size: 20,
})

// Get
const getResult = await client.ecommerce.paymentRequests.get('req_id_123')

// Send reminder
const reminderResult = await client.ecommerce.paymentRequests.sendReminder('req_id_123')

Code Example

JavaScript
const createResult = await client.ecommerce.paymentRequests.create({
  amount: 150.00,
  currency: 'EUR',
  customerEmail: 'customer@example.com',
  description: 'Service invoice',
})

const pendingResult = await client.ecommerce.paymentRequests.list({ status: 'Pending', page: 1, size: 20 })
const getResult = await client.ecommerce.paymentRequests.get('req_id_123')
const reminderResult = await client.ecommerce.paymentRequests.sendReminder('req_id_123')

Utilities

Code Example

TypeScript
// Get supported languages
const languages = await client.ecommerce.getLanguages()

// Get settlement data
const settlement = await client.ecommerce.getSettlementData()

Code Example

JavaScript
const languages = await client.ecommerce.getLanguages()
const settlement = await client.ecommerce.getSettlementData()