@cosmosapp/pay_sdkDefinitionen

Types & enums reference

The enums, input option types and entity payload shapes exported by the SDK.

A quick lookup for the enums, input option types and response payload shapes, so you can wire up TypeScript with confidence.

Everything is fully typed. Import option/entity types and the const-enums directly from @cosmosapp/pay_sdk (or /web).

import {
  Client,
  PaymentIntentStatus,
  PaymentIntentKind,
  WebhookEventType,
  WebhookDeliveryStatus,
  ProductKind,
  type CreatePayPaymentIntentOptions,
  type CreateTxPaymentIntentOptions,
  type PaymentIntentData,
} from '@cosmosapp/pay_sdk';

Enums (const objects — usable as values and types)

PaymentIntentStatus = { Pending:'PENDING', Submitted:'SUBMITTED', Succeeded:'SUCCEEDED',
                        Failed:'FAILED', Cancelled:'CANCELLED', Expired:'EXPIRED' }
PaymentIntentKind   = { Tx:'TX', Pay:'PAY' }
WebhookEventType    = { PaymentIntentCreated:'PAYMENT_INTENT_CREATED',
                        PaymentIntentUpdated:'PAYMENT_INTENT_UPDATED',
                        PaymentIntentSucceeded:'PAYMENT_INTENT_SUCCEEDED',
                        PaymentIntentFailed:'PAYMENT_INTENT_FAILED',
                        PaymentIntentCancelled:'PAYMENT_INTENT_CANCELLED',
                        PaymentIntentDeleted:'PAYMENT_INTENT_DELETED' }
WebhookDeliveryStatus = { Pending:'PENDING', Succeeded:'SUCCEEDED', Failed:'FAILED' }
ProductKind         = { Recurring:'recurring', OneTime:'one_time', Link:'link' }
PrivatePaymentStatus = { Pending:'PENDING', Succeeded:'SUCCEEDED', Expired:'EXPIRED' }
Usdt0TransferStatus  = { Pending:'PENDING', Submitted:'SUBMITTED', Delivered:'DELIVERED',
                         Failed:'FAILED', Expired:'EXPIRED' }

Option types (inputs)

interface CreatePayPaymentIntentOptions {
  destination: string; amount?: string; asset?: AssetRef;
  assetCode?: string; assetIssuer?: string; memo?: string; msg?: string; callback?: string;
}
interface CreateTxPaymentIntentOptions {
  source: string; destination: string; amount: string; asset?: AssetRef;
  assetCode?: string; assetIssuer?: string; memo?: string; msg?: string; callback?: string;
}
interface UpdatePaymentIntentOptions { status?: PaymentIntentStatus; txHash?: string; reference?: string; }
interface ListPaymentIntentsOptions  { status?: PaymentIntentStatus; take?: number; skip?: number; }
interface ValidatePaymentIntentOptions { txHash: string; }

interface CreateWebhookEndpointOptions { url: string; description?: string; eventTypes?: WebhookEventType[]; }
interface UpdateWebhookEndpointOptions { url?: string; description?: string; enabled?: boolean; eventTypes?: WebhookEventType[]; }
interface ListWebhookDeliveriesOptions { status?: WebhookDeliveryStatus; take?: number; skip?: number; }

interface CreateProductOptions { name: string; description?: string; amount?: string; assetCode?: string; kind?: ProductKind; active?: boolean; reference?: string; }
type      UpdateProductOptions = Partial<CreateProductOptions>;

interface AddCustomerWalletOptions { chain: 'stellar' | 'solana' | 'monad'; address: string; label?: string; }
interface CreateCustomerOptions { name: string; alias?: string; note?: string; email?: string;
                                  wallets?: AddCustomerWalletOptions[]; account?: string /* deprecated */; reference?: string; }
type      UpdateCustomerOptions = Partial<Omit<CreateCustomerOptions, 'wallets'>>;

interface AnalyticsSeriesOptions { period?: 'day' | 'week' | 'month' | 'year'; }

interface MerchantFeeOptions { bps?: number; fixed?: string; wallet: string; paidBy?: 'recipient' | 'payer'; }
interface CreatePrivatePaymentOptions { amount: string; recipient: string; description?: string;
                                        expiresInMinutes?: number; idempotencyKey?: string; merchantFee?: MerchantFeeOptions; }
interface ListPrivatePaymentsOptions  { status?: PrivatePaymentStatus; take?: number; skip?: number; }

interface QuoteUsdt0Options          { to: Usdt0Destination; amount: string; source?: string; }
interface CreateUsdt0TransferOptions { source: string; to: Usdt0Destination; recipient: string; amount: string;
                                       idempotencyKey?: string; merchantFee?: MerchantFeeOptions; }
interface ListUsdt0TransfersOptions  { status?: Usdt0TransferStatus; take?: number; skip?: number; }
interface SubmitUsdt0TransferOptions { signedXdr: string; }

Entity payloads (outputs)

  • PaymentIntentData — id, kind, status, network, source, destination, amount, asset, assetIssuer, memo, msg, callback, xdr, uri, qr, txHash, reference, createdAt, updatedAt.
  • WebhookEndpointData — id, url, description, enabled, eventTypes, createdAt, updatedAt (+ secret on create/rotate only).
  • WebhookEvent<T = PaymentIntentData> — { id, type, createdAt, data }.
  • ProductData — id, name, description, amount, asset, kind, active, reference, createdAt, updatedAt.
  • CustomerData: id, name, alias, note, email, wallets, account, reference, createdAt, updatedAt (+ list-only payments, succeeded, total).
  • CustomerWalletData: id, chain, address, label, createdAt.
  • AnalyticsSeriesData: period, buckets, totals, previous, swaps, liquidity, webhooks, zkPayments (see Analytics & health).
  • PrivatePaymentData, PrivatePaymentsConfigData: see Private payments.
  • Usdt0QuoteData, Usdt0TransferData, Usdt0RoutesData: see USDT0.
  • AnalyticsBalancesData — { data: { asset, amount, pending, count }[], total }.
  • ValidationOutcomeData — { valid, status, reason?, paymentIntent? }.

Pagination wrappers (list / fetchDeliveries) return { items, total, take, skip }.

References

  • Client: The main entry point of the SDK — a single, atomic client that exposes every resource through its own manager — an atomic, single-client design.

Auf dieser Seite