@cosmosapp/pay_sdkServer
The Client
The Client object: the managers it exposes, its constructor options, and the self-acting structures it returns.
Almost everything you do goes through a single Client instance. It groups the API into one manager per resource and returns objects that can act on themselves.
import { Client } from '@cosmosapp/pay_sdk';
const client = new Client({ apiKey: process.env.COSMOS_PAY_API_KEY });One client exposes every resource through its own manager.
| Manager | Resource | Key methods |
|---|---|---|
client.paymentIntents | Stellar SEP-7 intents | createTx · createPay · fetch · list · update · delete · validate |
client.webhooks | Endpoints + deliveries + event listener | create · list · fetch · update · delete · rotateSecret · ping · fetchDeliveries · redeliver · on(...) · process · createHandler · middleware |
client.products | Products / prices | create · list · fetch · update · delete |
client.customers | Customers and their wallets | create · list · fetch · update · delete · addWallet · removeWallet |
client.privatePayments | Private payments (amounts hidden on-chain; Stellar Testnet for now) | create · list · fetch · config |
client.usdt0 | USDT0 from Stellar to EVM networks (LayerZero, mainnet only) | routes · quote · create · list · fetch · submit |
client.analytics | Read-only metrics | summary · series · balances · apiLogs · webhookLogs |
client.health | Liveness / readiness | liveness · readiness |
Returned objects are "structures"
Manager methods return rich instances (PaymentIntent, PrivatePayment, Usdt0Transfer, WebhookEndpoint,
Product, Customer) that can act on themselves and expose typed accessors —
e.g. intent.isPay, intent.assetLabel, await intent.validate(txHash),
await endpoint.disable(). Call .toJSON() for the raw payload.
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.
- Customer: A customer record, optionally enriched with on-chain payment stats.
- PaymentIntent: A Stellar SEP-7 payment intent
- PrivatePayment: A private payment, from
client.privatePayments: an amount in XLM whose value is hidden on-chain - Product: A product / price the consumer can charge for.
- Usdt0Transfer: A USDT0 transfer from Stellar to an EVM network through LayerZero, from
client.usdt0 - WebhookEndpoint: A registered webhook endpoint