1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! crypto-pay-api
//!
//! A Rust client library for interacting with the CryptoPay API.
//!
//! # Example with tokio
//!
//! ```no_run
//! use crypto_pay_api::prelude::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), CryptoBotError> {
//! let client = CryptoBot::builder().api_token("YOUR_API_TOKEN").build()?;
//! let invoice = client.create_invoice().amount(dec!(10.0)).asset(CryptoCurrencyCode::Ton).execute().await?;
//! println!("Invoice created: {}", invoice.invoice_id);
//! Ok(())
//! }
//! ```
//!
//! # Webhook Handling with axum
//!
//! ```no_run
//! use crypto_pay_api::prelude::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), CryptoBotError> {
//! let client = CryptoBot::builder().api_token("YOUR_API_TOKEN").build()?;
//! let mut handler = client.webhook_handler().build();
//! handler.on_update(|update| async move {
//! println!("Invoice paid: {:?}", update.payload);
//! Ok(())
//! });
//! Ok(())
//! }
//! ```
//!
//! For issues and contributions, please refer to the [GitHub repository](https://github.com/escwxyz/crypto-pay-api).