#price #port #anypay

bin+lib anypay

AnyPay is a payment processing platform that allows you to accept payments from multiple cryptocurrencies and fiat currencies

2 unstable releases

0.1.0 Jan 18, 2025
0.0.1 Mar 10, 2024

#37 in #price

Custom license and AGPL-3.0

170KB
4K SLoC

Rust 3K SLoC // 0.1% comments Python 800 SLoC // 0.1% comments Shell 93 SLoC // 0.1% comments

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. ๐Ÿ˜Š

Dependencies

~39โ€“57MB
~1M SLoC