This crate provides Rust bindings to the Stripe HTTP API.
Getting Started
To get started, we need to create a client:
let client = new;
Then we can begin making requests as we'd like. Most Stripe requests accept
many optional parameters, so we usually get the ::default()
params and then
set the ones we want from there.
Most requests for creating or updating a Stripe object use the same Rust struct, so you may frequently need to refer to the official API docs to determine which fields are required for either request.
/* Creating a Stripe Charge */
let token = "TOKEN_FROM_CHECKOUT";
let mut params = default;
// NOTE: Stripe represents currency in the lowest denominations (e.g. cents)
params.amount = Some; // e.g. $10.95
params.source = Some;
// Example: Override currency to be in Canadian Dollars
params.currency = Some;
let charge = create.unwrap;
println!; // => Charge { id: "ch_12345", amount: 1095, .. }
/* Listing Stripe Charges */
let params = default;
let charges = list.unwrap;
println!; // => List { data: [Charge { id: "ch_12345", .. }] }