ezstripe 💳

A Stripe-SDK for Rustlang

Use ezstripe to easily communicate with Stripe's API.

Crate | Docs | Examples

Warning
Up to version 1.0.0 a lot of the structure can change with each new version!
Therefore, with every new version, pay attention to the changes in the changelogs on Github!

Usage

Installation

```toml

Cargo.toml

[dependencies] ezstripe = "0.3.1" `` or cargo add ezstripe`

Features

All features are enabled by default, but you can only select the features you really need for your project.

```toml

Cargo.toml

[dependencies] ezstripe = { version = "0.3.1", default-features = false, features = ["payment_intent", "refund"] } ```

List of all available features: - full - - Default. Same as without "default-features = false" - balance - mandate - payment_intent - payout - refund

Example

```toml

Cargo.toml

[dependencies] ezstripe = "0.3.1" env_logger = "0.10.0" # Optional ```

``Rust // Required to use theezbody!` macro

[macro_use] extern crate ezstripe;

[tokio::main]

async fn main() { // To show possible errors (recommended for development) envlogger::initfromenv(envlogger::Env::default().filteror("MYLOG_LEVEL", "debug"));

let client = ezstripe::Client { secretkey: "YOURSECRETKEY".tostring() };

// Returns: String("amount=1500;currency=eur;paymentmethodtypes[]=card;capturemethod=manual;") let stripebody = ezbody!( "amount" => 1500, "currency" => "eur", "paymentmethodtypes[]" => "card", "capture_method" => "manual" );

// 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); } ```

Status

This SDK for Stripe is still in a very early version, which is why there can be many changes with each update.

The following is expected from version 1.0.0:
Complete and stable ...