Crate stripe [−] [src]
This crate provides Rust bindings to the Stripe HTTP API.
Getting Started
To get started, we need to create a client:
let client = stripe::Client::new("sk_test_YOUR_STRIPE_SECRET");
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 = stripe::ChargeParams::default(); // NOTE: Stripe represents currency in the lowest denominations (e.g. cents) params.amount = Some(1095); // e.g. $10.95 params.source = Some(stripe::CustomerSource::Token(token)); // Example: Override currency to be in Canadian Dollars params.currency = Some(stripe::Currency::CAD); let charge = stripe::Charge::create(&client, params).unwrap(); println!("{:?}", charge); // => Charge { id: "ch_12345", amount: 1095, .. }
/* Listing Stripe Charges */ let params = stripe::ChargeListParams::default(); let charges = stripe::Charge::list(&client, params).unwrap(); println!("{:?}", charges); // => List { data: [Charge { id: "ch_12345", .. }] }
Structs
| Address | |
| CancelParams | |
| CaptureParams |
The set of parameters that can be used when capturing a charge. |
| Card | |
| CardParams | |
| Charge |
The resource representing a Stripe charge. |
| ChargeListParams |
The set of parameters that can be used when listing charges. |
| ChargeOutcome | |
| ChargeParams |
The set of parameters that can be used when creating or updating a charge. |
| Client | |
| Coupon | |
| Customer |
The resource representing a Stripe customer. |
| CustomerListParams |
The set of parameters that can be used when listing customers. |
| CustomerParams |
The set of parameters that can be used when creating or updating a customer. |
| CustomerShippingDetails | |
| Deleted | |
| DestinationParams | |
| Discount | |
| Event | |
| EventData | |
| FraudDetails | |
| Invoice |
The resource representing a Stripe invoice. |
| InvoiceItem |
The resource representing a Stripe invoice line item. |
| InvoiceItemParams | |
| InvoiceListParams | |
| InvoiceParams |
The set of parameters that can be used when creating or updating an invoice. |
| ItemParams | |
| List | |
| OwnerParams | |
| Params | |
| Period |
Period is a structure representing a start and end dates. |
| Plan |
The resource representing a Stripe plan. |
| PlanParams |
The set of parameters that can be used when creating or updating a plan. |
| RangeBounds | |
| RedirectParams | |
| Refund | |
| RequestError |
An error reported by stripe in a request's response. |
| ShippingDetails | |
| SourceFilter | |
| SourceParams | |
| Subscription |
The resource representing a Stripe subscription. |
| SubscriptionItem |
The resource representing a Stripe subscription item. |
| SubscriptionParams |
The set of parameters that can be used when creating or updating a subscription. |
Enums
| Currency |
Currency is the list of supported currencies. |
| CustomerSource | |
| Error |
An error encountered when communicating with the Stripe API. |
| ErrorCode |
The list of possible values for a RequestError's code. |
| ErrorType |
The list of possible values for a RequestError's type. |
| EventObject | |
| EventType | |
| RangeQuery |
A set of generic request parameters that can be used on list endpoints to filter their results by some timestamp. |
| Source | |
| SourceType |
Type Definitions
| Metadata | |
| Timestamp |