Use ezstripe to easily communicate with Stripe's API.
Warning
Up to version1.0.0
a lot of the structure can change with each new version!
Therefore, pay attention to the changes in the changelog on Github with every new version!
```toml
[dependencies]
ezstripe = "0.6.0"
``
or
cargo add ezstripe`
All features are enabled by default, but you can only select the features you really need for your project.
```toml
[dependencies] ezstripe = { version = "0.6.0", default-features = false, features = ["payment_intent", "refund"] } ```
```toml
[dependencies] ezstripe = "0.6.0" env_logger = "0.10.0" # Optional ```
``Rust
// Required to use the
ezbody!` macro
async fn main() { // To show possible errors (recommended for development) envlogger::initfromenv(envlogger::Env::default().filteror("MYLOG_LEVEL", "debug"));
// We need a client to make requests let client = ezstripe::Client::new("SECRET_KEY");
// Create a body for the request let stripebody = ezbody!( "amount" => 1500, "currency" => "eur", "paymentmethodtypes[]" => "card", "paymentmethodtypes[]" => "sofort", "capturemethod" => "automatic", "shipping[name]" => "Your Name", "shipping[address][city]" => "Test" );
// Now send a request to Stripe's API let striperesponse = client.createpaymentintent(stripebody).send().await; if let Err((emsg, einfo)) = striperesponse { if let Some(r) = einfo { println!("{}: {} | {} | {}", emsg, r.r#type, r.code, r.message); } else { // Such an error only occurs when a request to Stripe failed println!("{}", emsg); } std::process::exit(1); }
// No error, so let's unpack the answer let striperesult = striperesponse.unwrap();
// Print the unique ID from the created PaymentIntent println!("Created: {}", stripe_result.id); } ```
A list of currently supported and planned features.
CORE RESOURCES - [X] Balance - [X] Balance Transactions - [ ] Charges - [ ] Customers - [X] Disputes - [ ] Events - [ ] Files - [ ] File Links - [X] Mandates - [X] PaymentIntents - [ ] SetupIntents - [ ] SetupAttempts - [X] Payouts - [X] Refunds - [ ] Tokens
I spent hours writing the code and creating each member of a struct. So please respect my time and work.
This project is licensed under MIT license.