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
57
58
59
60
61
62
63
64
//! BitMomo merchant SDK: accept crypto payments and verify BitMomo webhooks.
//!
//! > **Test money only.** BitMomo currently runs on test networks. Live API
//! > keys are disabled, so nothing you do with this SDK moves real money.
//!
//! ```no_run
//! use bitmomo::{Client, CreatePaymentParams, Decimal};
//!
//! # async fn run() -> Result<(), bitmomo::Error> {
//! let client = Client::new(std::env::var("BITMOMO_API_KEY").unwrap(), "https://api.dev.bitmomo.app")?;
//! let params = CreatePaymentParams::new(Decimal::new("150.00")?, "USDT_TRC20")
//! .order_id("order-1001")
//! .idempotency_key("order-1001"); // reuse the same key if you retry
//! let payment = client.create_payment(¶ms).await?;
//! println!("{} {} {}", payment.deposit_address, payment.crypto_amount, payment.qr_code_data);
//! # Ok(())
//! # }
//! ```
//!
//! Verify webhooks with [`webhooks::verify_event`]. Every failure is an
//! [`Error`] with the HTTP `status`, the API's `code`, a `message` and a
//! `retriable` hint. Money is [`Decimal`], an exact decimal string.
//!
//! The `client` feature (on by default) provides the async [`Client`]; turn
//! default features off to use only the webhook helpers. TLS uses rustls by
//! default (`rustls-tls`); enable `native-tls` instead if you prefer.
//!
//! Guides and the API reference: <https://docs.bitmomo.app>
pub use ;
pub use Decimal;
pub use Error;
pub use *;
/// The SDK version, sent in the User-Agent header.
pub const VERSION: &str = env!;
/// A random UUID (version 4) to use as an idempotency key. Keep it with the
/// business intent and reuse it when you retry.