@deliverart/sdk-js-payment

中文文档
3.0.1发布于 2026/11/11TypeScriptESM + CJS近 30 天下载 4165

Deliverart JavaScript SDK for Payment Management

原始使用文档
文档目录13 节
  1. Installation
  2. Additional order payments
  3. Exported Types
  4. Core Types
  5. Payment Method Types
  6. Payment Status Types
  7. IRI Types
  8. Available Requests
  9. Payments
  10. Payment Configurations
  11. Complete Usage Example
  12. License
  13. Manual meal vouchers and financial control

@deliverart/sdk-js-payment

Payment management package for the DeliverArt JavaScript SDK.

Installation

npm install @deliverart/sdk-js-payment @deliverart/sdk-js-core

Additional order payments

GetPaymentInfo reads an amendment's separate Stripe payment without polling Stripe. While its asynchronous Checkout is being prepared, sessionUrl and expiresAt are both null. Once ready, they contain the stored link and expiration timestamp. Only render a payment action when sessionUrl is non-null. Expired, failed, or paid sessions return a null link; expiration alone is not evidence of a failed payment. The amount is a decimal string for the additional balance, not the original order payment. Creating a link does not confirm receipt of money.

The existing /orders/{id}/pay full-order flow and generic payment PATCH/DELETE cannot replace a payment once amendment settlement accounting is active. Use the order's settlement operations instead. The original payment stays unchanged.

Exported Types

Core Types

  • Payment - Payment information
  • PaymentDetails - Extended payment with order details
  • PaymentConfig - Payment configuration for point of sale
  • PaymentMethod - Payment method type
  • PaymentStatus - Payment status

Payment Method Types

type PaymentMethod = 
  | 'CASH'
  | 'CREDIT_CARD'
  | 'DEBIT_CARD'
  | 'STRIPE'
  | 'PAYPAL'
  | 'SATISPAY'
  | 'ONLINE'
  | 'POS'

Payment Status Types

type PaymentStatus = 
  | 'PENDING'
  | 'PROCESSING'
  | 'COMPLETED'
  | 'FAILED'
  | 'REFUNDED'
  | 'CANCELLED'

IRI Types

  • PaymentIri - Payment IRI (/payments/:id)
  • PaymentConfigIri - Payment config IRI (/payment_configs/:id)

Available Requests

Payments

CreatePayment

import { CreatePayment } from '@deliverart/sdk-js-payment';

const payment = await sdk.call(new CreatePayment({
  order: '/orders/123',
  method: 'CREDIT_CARD',
  amount: 2500, // In cents
  status: 'PENDING'
}));

Input Parameters:

  • order: string (required) - Order IRI
  • method: PaymentMethod (required) - Payment method
  • amount: number (required) - Amount in cents
  • status?: PaymentStatus (optional) - Initial status (default: 'PENDING')
  • transactionId?: string (optional) - External transaction ID
  • metadata?: object (optional) - Additional metadata

GetPayments

import { GetPayments } from '@deliverart/sdk-js-payment';

const payments = await sdk.call(new GetPayments({
  query: {
    order: '/orders/123',
    method: 'CREDIT_CARD',
    'status[]': ['COMPLETED', 'PENDING'],
    page: 1
  }
}));

Query Parameters:

  • order?: string - Filter by order
  • method?: PaymentMethod - Filter by payment method
  • status[]?: PaymentStatus[] - Filter by statuses
  • createdAt[before]?: string - Created before date
  • createdAt[after]?: string - Created after date
  • page?: number - Page number

GetPaymentDetails

import { GetPaymentDetails } from '@deliverart/sdk-js-payment';

const payment = await sdk.call(new GetPaymentDetails('payment-123'));

UpdatePayment

import { UpdatePayment } from '@deliverart/sdk-js-payment';

const updated = await sdk.call(new UpdatePayment('payment-123', {
  status: 'COMPLETED',
  transactionId: 'txn_abc123'
}));

Payment Configurations

CreatePaymentConfig

import { CreatePaymentConfig } from '@deliverart/sdk-js-payment';

const config = await sdk.call(new CreatePaymentConfig({
  pointOfSale: '/point_of_sales/123',
  method: 'STRIPE',
  enabled: true,
  config: {
    publicKey: 'pk_test_...',
    secretKey: 'sk_test_...'
  }
}));

Input Parameters:

  • pointOfSale: string (required) - Point of sale IRI
  • method: PaymentMethod (required) - Payment method
  • enabled: boolean (required) - Enable/disable payment method
  • config: object (required) - Method-specific configuration

GetPaymentConfigs

import { GetPaymentConfigs } from '@deliverart/sdk-js-payment';

const configs = await sdk.call(new GetPaymentConfigs({
  query: {
    pointOfSale: '/point_of_sales/123',
    enabled: true
  }
}));

UpdatePaymentConfig

import { UpdatePaymentConfig } from '@deliverart/sdk-js-payment';

const updated = await sdk.call(new UpdatePaymentConfig('config-123', {
  enabled: false
}));

Complete Usage Example

import { sdk } from './lib/sdk';
import {
  CreatePaymentConfig,
  CreatePayment,
  UpdatePayment,
  GetPayments
} from '@deliverart/sdk-js-payment';

async function paymentWorkflow() {
  // Setup payment methods for point of sale
  await sdk.call(new CreatePaymentConfig({
    pointOfSale: '/point_of_sales/123',
    method: 'STRIPE',
    enabled: true,
    config: {
      publicKey: process.env.STRIPE_PUBLIC_KEY,
      secretKey: process.env.STRIPE_SECRET_KEY
    }
  }));

  // Create payment for order
  const payment = await sdk.call(new CreatePayment({
    order: '/orders/456',
    method: 'CREDIT_CARD',
    amount: 2500,
    status: 'PENDING'
  }));

  // Process payment (integrate with payment gateway)
  // ... payment processing logic ...

  // Update payment status
  await sdk.call(new UpdatePayment(payment.id, {
    status: 'COMPLETED',
    transactionId: 'txn_abc123'
  }));

  // Get all completed payments
  const completed = await sdk.call(new GetPayments({
    query: {
      'status[]': ['COMPLETED'],
      'order[createdAt]': 'desc'
    }
  }));

  console.log(`Total completed: ${completed.pagination.totalItems}`);
}

License

MIT

Manual meal vouchers and financial control

CreatePaymentConfigTicket creates a manual, Hub-only POS configuration. Reads expose availableChannels and execution. platform is evidence-only and cannot be enabled as a POS configuration. Payment reads include management, collectingPlatform, and ticketProvider; callers must honor server receipt capabilities rather than infer control from the method.

Order paymentSummary contains original funding portions and explicitly incomplete reported evidence. Net paid/refundable amounts still come from the settlement API. A Ticket reimbursement recorded through RecordOrderReceipt or offline settlement inputs requires confirmedOutsideSystem: true and a reference. Ecommerce configuration selects eligible POS configuration IRIs explicitly through UpdateIntegrationEcommerce.

版本与发布记录

@deliverart/sdk-js-payment 共发布 321 个版本,首次发布于 2025/06/30;过去 12 个月发布了 231 个版本。

版本发布日期距今
3.0.1latest2026/11/111 天前
3.0.02026/11/092 天前
3.0.0-dev.1dev2026/11/092 天前
2.48.12026/10/2518 天前
2.48.02026/10/2319 天前
2.47.02026/10/2319 天前

关于 @deliverart/sdk-js-payment 的常见问题

@deliverart/sdk-js-payment 是什么?

Deliverart JavaScript SDK for Payment Management

如何安装 @deliverart/sdk-js-payment?

在项目目录运行 npm install @deliverart/sdk-js-payment,或使用 pnpm add / yarn add / bun add。

@deliverart/sdk-js-payment 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@deliverart/sdk-js-payment 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@deliverart/sdk-js-payment 可以商用吗?

@deliverart/sdk-js-payment 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@deliverart/sdk-js-payment 的下载量有多少?

根据 npm 官方下载统计,@deliverart/sdk-js-payment 在 2026/10/12 – 2026/11/10 这 30 天内被下载 4,165 次,日均约 139 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@deliverart/sdk-js-payment 还在维护吗?

最新版本 3.0.1 发布于 2026/11/11(1 天前);至今共发布 321 个版本,其中过去 12 个月发布了 231 个;首次发布于 2025/06/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。