Skip to content

PiyushXCoder/dodo-payments-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unoffical Dodo Payment SDK


Image

crates.io docs.rs

This is Unoffical SDK of dodopayments.com. Almost all features are implemented with a example script. A good amount of testing is required.

🏆 The dodo-payments-rs is listed in Dodo Payments Community Projects

How to use

For now the basic usage looks much like.

use dodo_payments::{
    DodoPayments, client::DodoPaymentsConfigBuilder, operations::common::structs::ProductItem,
};
use std::env;

#[tokio::main]
async fn main() {
    let bearer_token = env::var("DODO_PAYMENTS_BEARER_TOKEN")
        .expect("DODO_PAYMENTS_BEARER_TOKEN must be set in env variables");
    let product_id = env::var("DODO_PAYMENTS_PRODUCT_ID")
        .expect("DODO_PAYMENTS_PRODUCT_ID must be set in env variables");

    let client = DodoPayments::new(
        DodoPaymentsConfigBuilder::new()
            .bearer_token(&bearer_token)
            .environment("test_mode"),
    );

    let response = client
        .checkout_sessions(vec![ProductItem {
            product_id: product_id,
            quantity: 1,
            amount: None,
        }])
        .send()
        .await;

    println!("Response: {:#?}", response);
}

Running example

Check examples directory to understanding usage

export DODO_PAYMENTS_BEARER_TOKEN="<your token>"
export DODO_PAYMENTS_PRODUCT_ID="<your product id>"
cargo run --example checkout_sessions

Roadmap

  • Checkout Session
  • Payments
  • Subscriptions
  • Discounts
  • Licenses
  • Customers
  • Products
  • Addons
  • Meters
  • Usage Events
  • Refunds
  • Disputes
  • Payouts
  • Brands
  • Webhooks
  • Miscellaneous

Contributing

Welcome aboard! 🎉 We’re excited to have you here. If you’re adding a new operation, please make sure to also include a clear example that demonstrates its usage. We also encourage you to contribute by testing and refining existing operations to help maintain overall stability and reliability of the project. Every contribution—big or small—helps improve the ecosystem for everyone.

About

Unofficial Dodo Payments SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages