SDK Integration
The SpacePay SDK provides a simple way to integrate payments with minimal code and built-in functionality. For full SDK package details, see SpacePay Client SDK on npm.Installation
Requirements: Node.js 18+ or modern browsers with Fetch API support.
Basic Usage
SDK Features
SDK Benefits
- Lightweight: No heavy dependencies, minimal bundle size
- Type-safe: Full TypeScript support with comprehensive type definitions
- Universal: Works in Node.js 18+ and modern browsers
- Modern: Uses native fetch API and modern JavaScript features
- Robust: Built-in error handling, timeout management, and retry logic
Client Configuration
You can configure the client with additional options:Payment Status Values
The SDK returns payment statuses with the following values:pending- Payment created, waiting for fundsprocessing- Payment detected, confirming on blockchaincompleted- Payment confirmed and settledfailed- Payment failed or rejectedexpired- Payment expired without completioncancelled- Payment was cancelled
Error Handling
The SDK provides structured error handling:Next Steps
API Integration
For maximum control, integrate directly with SpacePay’s REST APIs.
Webhooks
Set up real-time payment notifications.
Testing
Learn about test environments and scenarios.
Support
Get help with your integration from our support team.