[−][src]Crate stripe
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 = "tok_ID_FROM_CHECKOUT".parse().unwrap(); 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::PaymentSourceParams::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
Account | The resource representing a Stripe account. |
AccountParams | The set of parameters that can be used when creating an account for users. |
AchCreditTransfer | |
Address | |
ApplicationFee | The resource representing a Stripe application fee. |
ApplicationFeeRefund | The resource representing a Stripe application fee refund. |
AuthorizeWithUrl | The resource representing a Stripe AuthorizeWithUrl object. |
Balance | The resource representing a Stripe account balance. |
BalanceTransaction | The resource representing a Stripe balance transaction. |
BankAccount | The resource representing a Stripe bank account. |
BankAccountId | |
BankAccountParams | |
BankAccountVerifyParams | The set of parameters that can be used when verifying a Bank Account. |
BankTokenId | |
CancelParams | |
CaptureParams | The set of parameters that can be used when capturing a charge object. |
Card | The resource representing a Stripe card object. |
CardId | |
CardParams | |
CardShort | Card details returned as part of a |
CardTokenId | |
Charge | The resource representing a Stripe charge object. |
ChargeListParams | The set of parameters that can be used when listing charges. |
ChargeOutcome | The resource representing a Stripe charge object outcome. |
ChargeParams | The set of parameters that can be used when creating or updating a charge object. |
Client | |
CodeVerification | The resource representing a Stripe verification code. |
Coupon | The resource representing a Stripe 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 | |
DeclineChargeDetails | |
Deleted | |
DestinationParams | |
Discount | The resource representing a Stripe discount. |
Dispute | The resource representing a Stripe dispute. |
DisputeEvidenceObject | The resource representing the evidence used to support a dispute. |
Event | |
EventData | |
EvidenceDetails | |
FeeDetails | |
File | The resource representing a Stripe file. |
FraudDetails | |
Headers | |
Inventory | |
Invoice | The resource representing a Stripe invoice. |
InvoiceItem | The resource representing a Stripe invoice item. |
InvoiceLineItem | The resource representing a Stripe invoice line item. |
InvoiceLineItemParams | |
InvoiceListParams | |
InvoiceParams | The set of parameters that can be used when creating or updating an invoice. |
InvoiceUpcomingParams | |
ItemParams | |
List | |
NextSourceAction | The resource representing a Stripe NextSourceAction object. |
Order | The resource representing a Stripe order. |
OrderItem | The resource representing a Stripe order item. |
OrderReturn | The resource representing a Stripe order return. |
Owner | The resource representing a Stripe information about the owner. |
OwnerParams | |
PackageDimensions | |
ParseCurrencyError | |
ParseIdError | |
PaymentError | The resource representing a Stripe PaymentError object. |
PaymentIntent | The resource representing a Stripe PaymentIntent object. |
PaymentIntentCancelParams | The set of parameters that can be used when canceling a payment_intent object. |
PaymentIntentCaptureParams | The set of parameters that can be used when capturing a payment_intent object. |
PaymentIntentConfirmParams | The set of parameters that can be used when confirming a payment_intent object. |
PaymentIntentCreateParams | The set of parameters that can be used when creating a payment_intent object. |
PaymentIntentListParams | The set of parameters that can be used when listing payment_intents. |
PaymentIntentUpdateParams | The set of parameters that can be used when updating a payment_intent object. |
Payout | The resource representing a Stripe payout. |
PayoutListParams | The set of parameters that can be used when listing payouts. |
PayoutParams | The set of parameters that can be used when creating a payout object. |
PayoutScheduleDetails | |
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. |
Product | The resource representing a Stripe product. |
RangeBounds | |
Receiver | The resource representing a Stripe information related to the receiver flow. |
Redirect | The resource representing a Stripe information related to the redirect flow. |
RedirectParams | |
Refund | The resource representing a Stripe refund. |
RefundListParams | The set of parameters that can be used when listing refund. |
RefundParams | The set of parameters that can be used when creating refund object. |
RequestError | An error reported by stripe in a request's response. |
Review | The resource representing a Stripe review of a payment. |
ScheduledQueryRun | The resource representing a Stripe scheduled query run. |
ShippingDetails | |
Sku | The resource representing a Stripe Sku. |
Source | The resource representing a Stripe source. |
SourceFilter | |
SourceId | |
SourceParams | |
StatusTransitions | |
Subscription | The resource representing a Stripe subscription. |
SubscriptionItem | The resource representing a Stripe subscription item. |
SubscriptionItemParams | |
SubscriptionParams | The set of parameters that can be used when creating or updating a subscription. |
TOSAcceptanceDetails | |
Transaction | The resource representing a Stripe transaction. |
Transfer | The resource representing a Stripe transfer. |
TransferData | The resource representing a Stripe TransferData object. |
TransferReversal | The resource representing a Stripe transfer reversal. |
VerifiedAddress | The resource representing a Stripe verified owner’s address. |
Webhook |
Enums
CancellationReason | The resource representing a Stripe CancellationReason object. |
CaptureMethod | The resource representing a Stripe CaptureMethod object. |
CardBrand | |
CardType | |
ChargeStatus | The resource representing a Stripe charge object status. |
CheckResult | |
ConfirmationMethod | The resource representing a Stripe ConfirmationMethod object. |
Currency | Currency is the list of supported currencies. |
DetachedSource | |
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 | |
NetworkStatus | An enum representing the possible values of a |
OutcomeReason | An enum representing the possible values of a |
OutcomeType | An enum representing the possible values of a |
PaymentErrorType | The resource representing a Stripe PaymentErrorType object. |
PaymentIntentSourceType | |
PaymentIntentStatus | The resource representing a Stripe PaymentIntentStatus object. |
PaymentSource | A PaymentSource represents a payment method associated with a customer or charge. This value is usually returned as a subresource on another request. |
PaymentSourceId | |
PaymentSourceParams | A PaymentSourceParams represents all of the supported ways that can
be used to creating a new customer with a payment method or creating
a payment method directly for a customer via |
PayoutFailureCode | An enum representing the possible values of a |
PayoutMethod | An enum representing the possible values of a |
PayoutSourceType | An enum representing the possible values of a |
PayoutStatus | An enum representing the possible values of a |
PayoutType | An enum representing the possible values of a |
RangeQuery | A set of generic request parameters that can be used on list endpoints to filter their results by some timestamp. |
RefundFailureReason | An enum representing the possible values of a |
RefundReason | An enum representing the possible values of a |
RefundStatus | An enum representing the possible values of a |
RiskLevel | An enum representing the possible values of a |
SourceActionType | The resource representing a Stripe ConfirmationMethod object. |
SourceFilterType | |
SourceFlow | An enum representing the possible values of a |
SourceStatus | An enum representing the possible values of a |
SourceType | An enum representing the possible values of a |
SourceUsage | An enum representing the possible values of a |
TokenId | |
TokenizationMethod | |
TrialEnd | |
VerificationStatus | An enum representing the possible values of a |
WebhookError | An error encountered when communicating with the Stripe API webhooks. |
Type Definitions
Metadata | |
Response | An alias for |
Timestamp |