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
65
66
67
68
69
70
71
72
73
74
75
76
//! Unofficial Rust SDK for the [Bachs API](https://docs.bachs.io) — payments
//! and billing for internet businesses.
//!
//! This is a community client, not published or endorsed by Bachs.
//!
//! # Quickstart
//!
//! ```no_run
//! use bachs_sdk::{Bachs, customers::CreateCustomerRequest};
//!
//! # async fn run() -> Result<(), bachs_sdk::BachsError> {
//! // Reads a sandbox (sk_sandbox_...) or live (sk_live_...) key and infers
//! // the right base URL from the prefix.
//! let bachs = Bachs::new(std::env::var("BACHS_API_KEY").unwrap())?;
//!
//! let customer = bachs
//! .customers()
//! .create(&CreateCustomerRequest::new("jane@example.com").name("Jane Doe"))
//! .await?;
//!
//! println!("created {}", customer.customer_id);
//! # Ok(())
//! # }
//! ```
//!
//! # Conventions carried over from the API
//!
//! - **Money** is always a decimal string at the currency's precision (e.g.
//! `"29.00"`), paired with an ISO 4217 currency code — never minor units.
//! - **Sandbox vs. production** are different hosts entirely
//! (`sandbox-api.bachs.io` / `api.bachs.io`) with different key prefixes
//! (`sk_sandbox_...` / `sk_live_...`). [`Bachs::new`] infers which one you
//! mean from the key; going live is a key swap.
//! - **Webhooks are the source of truth** for fulfilment — see the
//! [`webhooks`] module — not client-side checkout redirects.
//! - **Subscriptions** are created by completing a
//! [checkout session](checkout_sessions::CheckoutSessions::create) against
//! a recurring product. There's no direct create-subscription call.
//! - Resource IDs carry type prefixes (`cust_`, `prod_`, `sub_`, `chk_`,
//! `inv_`, `ref_`, ...).
//!
//! # A note on coverage
//!
//! This SDK is built from Bachs' public documentation, not an internal
//! schema dump. The `customers` and `checkout_sessions` resources follow a
//! fully-specified OpenAPI schema and are typed strictly. Several other
//! resources (subscriptions, payments, refunds, transfers, connected
//! accounts, ...) are typed against the fields the docs and examples confirm,
//! with an `extra: FlexObject` catch-all on each response so additional
//! fields your API version returns are preserved rather than causing a
//! deserialization error. If you hit a mismatch, please open an issue.
pub use ;
pub use ;
pub use ;
// Flat re-exports so callers can write `bachs_sdk::customers::...` as shown
// in the README, matching the ergonomics of the Node SDK's `bachs.customers`.
pub use accounts;
pub use checkout_sessions;
pub use connected_accounts;
pub use customer_sessions;
pub use customers;
pub use media;
pub use payment_rails;
pub use payments;
pub use products;
pub use refunds;
pub use subscriptions;
pub use transfers;