How 0neshot101/btcpay-js works
BTCPay-JS is a typed TypeScript client for BTCPay Server’s REST API. An application configures BTCPayClient, chooses a resource client (including store-scoped invoices), and makes an operation that the shared HTTP client sends to the server and returns as a typed response. Resource clients cover the documented store, payment, wallet, Lightning, app, notification, webhook, user, API-key, server and file capabilities. Sampled code confirms construction and HTTP behavior; several resource-to-transport calls are documented by the README but their source excerpts were not shown.
Main entry points: client.ts BTCPayClient · http-client.ts HTTP client · apps.ts Apps · webhooks.ts Webhooks
Components 23
Client entry
- BTCPayClient
src/client.ts
API resources
- Stores
src/structures/stores.ts - Invoices
src/structures/invoices.ts - Pull payments
src/structures/pull-payments.ts - Lightning
src/structures/lightning.ts - Lightning addresses
src/structures/lightning-addresses.ts - Payment methods
src/structures/payment-methods.ts - Apps
src/structures/apps.ts - Notifications
src/structures/notifications.ts - Webhooks
src/structures/webhooks.ts - Server and files
src/structures/server.ts - Users
src/structures/users.ts - API keys
src/structures/api-keys.ts - Payment requests
src/structures/payment-requests.ts
HTTP transport
- HTTP client
src/utils/http-client.ts
Types and errors
- API errors
src/utils/errors.ts - Shared API types
src/typings/common.ts - Invoice types
src/typings/invoices.ts - Lightning types
src/typings/lightning.ts - Payment method types
src/typings/payment-methods.ts - Payout types
src/typings/pull-payments.ts - App types
src/typings/apps.ts
Other components
- SDK consumer
Connections 24
- SDK consumer → BTCPayClient: configures
README.md - BTCPayClient → Stores: creates
src/client.ts - BTCPayClient → Invoices: creates
src/client.ts - BTCPayClient → Pull payments: creates
src/client.ts - BTCPayClient → Lightning: creates
src/client.ts - BTCPayClient → Lightning addresses: creates
src/client.ts - BTCPayClient → Payment methods: creates
src/client.ts - BTCPayClient → Apps: creates
src/client.ts - BTCPayClient → Notifications: creates
src/client.ts - BTCPayClient → Webhooks: creates
src/client.ts - BTCPayClient → Server and files: creates
src/client.ts - BTCPayClient → Users: creates
src/client.ts - BTCPayClient → API keys: creates
src/client.ts - BTCPayClient → Payment requests: creates
src/client.ts - BTCPayClient → HTTP client: creates
src/client.ts - Apps → HTTP client: sends requests
src/structures/apps.ts - Webhooks → HTTP client: sends requests
src/structures/webhooks.ts - HTTP client → API errors: raises errors
src/utils/http-client.ts - Apps → App types: uses types
src/structures/apps.ts - Invoices → Invoice types: uses types
- Lightning → Lightning types: uses types
- Payment methods → Payment method types: uses types
- Pull payments → Payout types: uses types
- Webhooks → Shared API types: uses identifiers
src/structures/webhooks.ts