Crates.io | dodopayments_rust |
lib.rs | dodopayments_rust |
version | 0.2.0 |
created_at | 2025-08-22 16:57:40.690447+00 |
updated_at | 2025-09-18 19:10:51.674856+00 |
description | Rust SDK for Dodo Payments API |
homepage | https://github.com/Muhammad-Owais-Warsi/dodpayments_rust_sdk |
repository | https://github.com/Muhammad-Owais-Warsi/dodpayments_rust_sdk |
max_upload_size | |
id | 1806607 |
size | 94,754 |
Rust sdk to interact with dodopayments REST API.
The REST API documentation can be found on docs.dodopayments.com.
cargo add dodopayments_rust
use dodopayments_rust::{DodoPaymentsClient, DodoPaymentsClientBuilder, ResponseData};
use std::collections::HashMap;
#[tokio::main]
async fn main() {
let client: DodoPaymentsClient = DodoPaymentsClientBuilder::new()
.bearer_token("")
.enviroment("test_mode")
.build()
.unwrap();
let mut query_params = HashMap::new();
query_params.insert("status", "succeeded");
let body = None;
let ext_path = None;
match client
.payments()
.list(Some(query_params), body, ext_path)
.await
{
Ok(resp) => match resp {
ResponseData::Text(text) => {
println!("Text response: {}", text);
}
ResponseData::Blob(bytes) => {
std::fs::write("invoice.pdf", &bytes).expect("Failed to write file");
}
},
Err(err) => eprintln!("Error: {}", err),
}
}
You can checkout examples folder to view the usage of all the endpoints. To run any example run the following command in your root
cargo run --example <file_name>