2 unstable releases
0.1.0 | Jan 18, 2025 |
---|---|
0.0.1 | Mar 10, 2024 |
#37 in #price
170KB
4K
SLoC
Anypay Rust SDK ๐
Welcome to Anypay's WebSocket Tools! This powerful suite enables real-time payment processing and monitoring through a modern WebSocket interface. Built with Rust for maximum performance and reliability, these tools make cryptocurrency payment integration a breeze! ๐ซ
What's Inside? ๐ฆ
anypay-client
๐ง: A powerful CLI tool for creating and managing invoices, submitting payments, and monitoring payment status in real-timeanypay-server
๐ฅ๏ธ: A high-performance WebSocket server that handles payment processing and real-time notifications
Features โจ
- Real-time Updates ๐: Get instant notifications about payment status changes
- Multi-Currency Support ๐ฐ: Handle payments in various cryptocurrencies
- Secure Authentication ๐: Built-in token-based security
- Flexible Integration ๐: Easy-to-use CLI and WebSocket interfaces
- Automatic Payment Options โก: Smart payment option generation based on current prices
Installation ๐ ๏ธ
From crates.io
# Install both client and server binaries
cargo install anypay
# Or install them separately
cargo install anypay-client
cargo install anypay-server
From Source
# Clone the repository
git clone https://github.com/anypay/anypay
cd anypay-websockets-rust
# Build the release binaries
cargo build --release
# The binaries will be available in target/release/
anypay-client Usage ๐ง
Authentication ๐
Provide your API token either:
- As a command line argument:
--token YOUR_TOKEN
- Via environment variable:
export ANYPAY_TOKEN=YOUR_TOKEN
Available Commands ๐ป
Create an Invoice ๐
anypay-client create-invoice \
--amount 100 \
--currency USD \
--webhook https://example.com/webhook \
--redirect https://example.com/return \
--memo "Payment for services"
Request a Payment ๐ธ
anypay-client request-payment \
--currency BTC \
--address bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh \
--amount 100 \
--quote-currency USD
Submit a Payment ๐ค
anypay-client submit-payment \
--uid inv_123 \
--chain BTC \
--currency BTC \
--txhex 0200000001...
Get Invoice Details ๐
anypay-client get-invoice inv_123
Cancel an Invoice โ
anypay-client cancel-invoice inv_123
Get Current Prices ๐
anypay-client get-prices
Monitor Invoice Updates ๐
anypay-client monitor inv_123
Additional Options โ๏ธ
--json
: Output responses in JSON format--endpoint URL
: Use a custom API endpoint--debug
: Enable debug logging
anypay-server Usage ๐ฅ๏ธ
Configuration โ๏ธ
Configure the server using environment variables:
# Required ๐
export SUPABASE_URL=your_supabase_url
export SUPABASE_KEY=your_supabase_key
# Optional ๐ง
export PORT=8080 # Default: 8080
export HOST=0.0.0.0 # Default: 0.0.0.0
export LOG_LEVEL=debug # Default: info
Running the Server ๐
# Start the server
anypay-server
# With custom port
anypay-server --port 9000
# With debug logging
anypay-server --debug
Server Features ๐
- Real-time WebSocket communication ๐
- Price updates and conversions ๐ฑ
- Invoice creation and management ๐
- Payment processing ๐ณ
- Event subscriptions ๐ก
- Automatic payment option generation โก
Development ๐ฉโ๐ป
Requirements ๐
- Rust 1.70 or later
- Cargo package manager
Building ๐๏ธ
# Debug build
cargo build
# Release build
cargo build --release
Testing ๐งช
cargo test
API Documentation ๐
For detailed API documentation, including WebSocket message formats and HTTP endpoints, see API.md.
Get Started Today! ๐
Start accepting cryptocurrency payments in minutes with Anypay's WebSocket tools. For more information, visit our documentation or contact our support team.
License ๐
MIT License. See LICENSE for details.
Thank you for choosing Anypay! We look forward to powering your payment solutions. ๐
Dependencies
~39โ57MB
~1M SLoC