# The Client (https://dev.cosmospay.lat/docs/sdk/server/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.

```ts
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](https://dev.cosmospay.lat/docs/sdk/definitions/server/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](https://dev.cosmospay.lat/docs/sdk/definitions/server/customer/): A customer record, optionally enriched with on-chain payment stats.
- [PaymentIntent](https://dev.cosmospay.lat/docs/sdk/definitions/server/payment-intent/): A Stellar SEP-7 payment intent
- [PrivatePayment](https://dev.cosmospay.lat/docs/sdk/definitions/server/private-payment/): A private payment, from `client.privatePayments`: an amount in XLM whose value is hidden on-chain
- [Product](https://dev.cosmospay.lat/docs/sdk/definitions/server/product/): A product / price the consumer can charge for.
- [Usdt0Transfer](https://dev.cosmospay.lat/docs/sdk/definitions/server/usdt0-transfer/): A USDT0 transfer from Stellar to an EVM network through LayerZero, from `client.usdt0`
- [WebhookEndpoint](https://dev.cosmospay.lat/docs/sdk/definitions/server/webhook-endpoint/): A registered webhook endpoint
