Skip to content

A WebSocket server implementation in Rust that allows clients to establish persistent connections and subscribe to events through an internal message bus.

License

Notifications You must be signed in to change notification settings

anypay/anypay-websockets-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Anypay Logo

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-time
  • anypay-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. 😊

About

A WebSocket server implementation in Rust that allows clients to establish persistent connections and subscribe to events through an internal message bus.

Resources

License

Stars

Watchers

Forks

Packages

No packages published