[][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 ::new(...) with any required 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::CreateCharge::new();
// NOTE: Stripe represents currency in the lowest denominations (e.g. cents)
params.amount = Some(1095); // e.g. $10.95
params.source = Some(stripe::ChargeSourceParams::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::ListCharges::new();
let charges = stripe::Charge::list(&client, params).unwrap();
println!("{:?}", charges); // =>  List { data: [Charge { id: "ch_12345", .. }] }

Structs

AcceptTos
Account

The resource representing a Stripe "Account".

AccountCapabilities
AccountId

An id for the corresponding object type.

AccountRequirements
AccountSettings
AccountSettingsParams
Address
AlipayAccount

The resource representing a Stripe "AlipayAccount".

AlipayAccountId

An id for the corresponding object type.

Application

The resource representing a Stripe "Application".

ApplicationFee

The resource representing a Stripe "PlatformFee".

ApplicationFeeId

An id for the corresponding object type.

ApplicationFeeRefund

The resource representing a Stripe "FeeRefund".

ApplicationFeeRefundId

An id for the corresponding object type.

Balance

The resource representing a Stripe "Balance".

BalanceAmount
BalanceAmountBySourceType
BalanceTransaction

The resource representing a Stripe "BalanceTransaction".

BalanceTransactionId

An id for the corresponding object type.

BankAccount

The resource representing a Stripe "BankAccount".

BankAccountId

An id for the corresponding object type.

BankAccountParams
BankTokenId

An id for the corresponding object type.

BillingDetails
BrandingSettings
BrandingSettingsParams
BusinessProfile
CancelSubscription
CaptureCharge

The set of parameters that can be used when capturing a charge object.

Card

The resource representing a Stripe "Card".

CardDetails
CardId

An id for the corresponding object type.

CardParams
CardPaymentsSettings
CardPaymentsSettingsParams
CardPresent
CardTokenId

An id for the corresponding object type.

Charge

The resource representing a Stripe "Charge".

ChargeId

An id for the corresponding object type.

ChargeOutcome
CheckoutSession

The resource representing a Stripe "Session".

CheckoutSessionCustomDisplayItemDescription
CheckoutSessionDisplayItem
CheckoutSessionId

An id for the corresponding object type.

Client
Company
CompanyParams
ConnectCollectionTransfer

The resource representing a Stripe "ConnectCollectionTransfer".

Coupon

The resource representing a Stripe "Coupon".

CouponId
CreateAccount

The parameters for Account::create.

CreateCharge

The parameters for Charge::create.

CreateCoupon

The parameters for Coupon::create.

CreateCustomer

The parameters for Customer::create.

CreateFileLink

The parameters for FileLink::create.

CreateInvoice

The parameters for Invoice::create.

CreateInvoiceItem

The parameters for InvoiceItem::create.

CreateInvoiceLineItem
CreateOrder

The parameters for Order::create.

CreatePaymentMethod

The parameters for PaymentMethod::create.

CreatePayout

The parameters for Payout::create.

CreatePlan

The parameters for Plan::create.

CreatePlanTiers
CreatePlanTransformUsage
CreateProduct

The parameters for Product::create.

CreateRecipient

The parameters for Recipient::create.

CreateRefund

The parameters for Refund::create.

CreateSku

The parameters for Sku::create.

CreateSource

The parameters for Source::create.

CreateSourceReceiver
CreateSourceRedirect
CreateSubscription

The parameters for Subscription::create.

CreateSubscriptionItems
CreateTaxRate

The parameters for TaxRate::create.

CreateToken

The parameters for Token::create.

CreateTokenAccount
CreateTokenPii
CreateTransfer

The parameters for Transfer::create.

CreateWebhookEndpoint

The parameters for WebhookEndpoint::create.

CustomField
Customer

The resource representing a Stripe "Customer".

CustomerId

An id for the corresponding object type.

CustomerInvoiceSettings
DashboardSettings
DeclineChargeOn
DeclineChargeOnParams
DeliveryEstimate
Discount

The resource representing a Stripe "Discount".

Dispute

The resource representing a Stripe "Dispute".

DisputeEvidence
DisputeEvidenceDetails
DisputeId

An id for the corresponding object type.

Dob
Event
EventData
EventId

An id for the corresponding object type.

Fee
File

The resource representing a Stripe "File".

FileId

An id for the corresponding object type.

FileLink

The resource representing a Stripe "FileLink".

FileLinkId

An id for the corresponding object type.

FraudDetails
FraudDetailsParams
Headers
Inventory
Invoice

The resource representing a Stripe "Invoice".

InvoiceId

An id for the corresponding object type.

InvoiceItem

The resource representing a Stripe "InvoiceItem".

InvoiceItemId

An id for the corresponding object type.

InvoiceItemThresholdReason
InvoiceLineItem

The resource representing a Stripe "InvoiceLineItem".

InvoiceSettingCustomField
InvoiceSettingCustomerSetting
InvoiceThresholdReason
InvoicesResourceInvoiceTaxId
InvoicesStatusTransitions
IssuingAuthorization

The resource representing a Stripe "IssuingAuthorization".

IssuingAuthorizationId

An id for the corresponding object type.

IssuingAuthorizationRequest
IssuingAuthorizationVerificationData
IssuingCard

The resource representing a Stripe "IssuingCard".

IssuingCardAuthorizationControls
IssuingCardId

An id for the corresponding object type.

IssuingCardShipping
IssuingCardholder

The resource representing a Stripe "IssuingCardholder".

IssuingCardholderAddress
IssuingCardholderAuthorizationControls
IssuingCardholderId

An id for the corresponding object type.

IssuingDispute

The resource representing a Stripe "IssuingDispute".

IssuingDisputeEvidence
IssuingDisputeFraudulentEvidence
IssuingDisputeId

An id for the corresponding object type.

IssuingDisputeOtherEvidence
IssuingTransaction

The resource representing a Stripe "IssuingTransaction".

IssuingTransactionId

An id for the corresponding object type.

List

A single page of a cursor-paginated list of an object.

ListAccounts

The parameters for Account::list.

ListApplicationFees

The parameters for ApplicationFee::list.

ListCharges

The parameters for Charge::list.

ListCoupons

The parameters for Coupon::list.

ListCustomers

The parameters for Customer::list.

ListDisputes

The parameters for Dispute::list.

ListFileLinks

The parameters for FileLink::list.

ListFiles

The parameters for File::list.

ListInvoiceItems

The parameters for InvoiceItem::list.

ListInvoices

The parameters for Invoice::list.

ListOrderReturns

The parameters for OrderReturn::list.

ListOrders

The parameters for Order::list.

ListOrdersStatusTransitions
ListPaymentMethods

The parameters for PaymentMethod::list.

ListPayouts

The parameters for Payout::list.

ListPlans

The parameters for Plan::list.

ListProducts

The parameters for Product::list.

ListRecipients

The parameters for Recipient::list.

ListRefunds

The parameters for Refund::list.

ListReviews

The parameters for Review::list.

ListSkus

The parameters for Sku::list.

ListSubscriptionItems

The parameters for SubscriptionItem::list.

ListSubscriptions

The parameters for Subscription::list.

ListTaxRates

The parameters for TaxRate::list.

ListTopups

The parameters for Topup::list.

ListTransfers

The parameters for Transfer::list.

ListWebhookEndpoints

The parameters for WebhookEndpoint::list.

MerchantData

The resource representing a Stripe "IssuingAuthorizationMerchantData".

Order

The resource representing a Stripe "Order".

OrderId

An id for the corresponding object type.

OrderItem

The resource representing a Stripe "OrderItem".

OrderItemParams
OrderReturn

The resource representing a Stripe "OrderReturn".

OrderReturnId

An id for the corresponding object type.

PackageDimensions
ParseCurrencyError
ParseIdError
PaymentError

The resource representing a Stripe PaymentError object.

PaymentIntent

The resource representing a Stripe "PaymentIntent".

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.

PaymentIntentId

An id for the corresponding object type.

PaymentIntentListParams

The parameters for PaymentIntent::list.

PaymentIntentNextAction
PaymentIntentNextActionRedirectToUrl
PaymentIntentUpdateParams

The set of parameters that can be used when updating a payment_intent object.

PaymentMethod

The resource representing a Stripe "PaymentMethod".

PaymentMethodCard
PaymentMethodCardChecks
PaymentMethodCardGeneratedCard
PaymentMethodDetails

This type is a stub that still needs to be implemented.

PaymentMethodId

An id for the corresponding object type.

PaymentsSettings
PaymentsSettingsParams
Payout

The resource representing a Stripe "Payout".

PayoutId

An id for the corresponding object type.

PayoutSettings
PayoutSettingsParams
Period

Period is a structure representing a start and end dates.

Person

The resource representing a Stripe "Person".

PersonId

An id for the corresponding object type.

PersonParams
PersonRelationship
PersonRequirements
PersonVerification
PersonVerificationDocument
PersonVerificationDocumentParams
PersonVerificationParams
Plan

The resource representing a Stripe "Plan".

PlanId
PlanTier
Product

The resource representing a Stripe "Product".

ProductId

An id for the corresponding object type.

RadarReviewResourceLocation
RadarReviewResourceSession
RangeBounds
Recipient

The resource representing a Stripe "TransferRecipient".

RecipientId
Refund

The resource representing a Stripe "Refund".

RefundId

An id for the corresponding object type.

RequestError

An error reported by stripe in a request's response.

ReserveTransaction

The resource representing a Stripe "ReserveTransaction".

RetrieveUpcomingInvoice
Review

The resource representing a Stripe "RadarReview".

ReviewId

An id for the corresponding object type.

Rule
ScheduledQueryRun

The resource representing a Stripe "ScheduledQueryRun".

ScheduledQueryRunId

An id for the corresponding object type.

Shipping
ShippingMethod
ShippingParams
SigmaScheduledQueryRunError
Sku

The resource representing a Stripe "SKU".

SkuId

An id for the corresponding object type.

Source

The resource representing a Stripe "Source".

SourceAcceptanceOfflineParams
SourceAcceptanceOnlineParams
SourceAcceptanceParams
SourceCodeVerificationFlow
SourceId

An id for the corresponding object type.

SourceMandateParams
SourceOwner
SourceReceiverFlow
SourceRedirectFlow
SourceTypeAchCreditTransfer
SourceTypeAchDebit
SourceTypeAlipay
SourceTypeBancontact
SourceTypeCard
SourceTypeCardPresent
SourceTypeEps
SourceTypeGiropay
SourceTypeIdeal
SourceTypeMultibanco
SourceTypeP24
SourceTypeSepaDebit
SourceTypeSofort
SourceTypeThreeDSecure
SourceTypeWechat
SpendingLimit
StatusTransitions
Subscription

The resource representing a Stripe "Subscription".

SubscriptionBillingThresholds
SubscriptionId

An id for the corresponding object type.

SubscriptionItem

The resource representing a Stripe "SubscriptionItem".

SubscriptionItemBillingThresholds
SubscriptionItemFilter
SubscriptionItemId

An id for the corresponding object type.

SubscriptionLineId

An id for the corresponding object type.

TaxAmount
TaxId

The resource representing a Stripe "tax_id".

TaxIdData
TaxIdId

An id for the corresponding object type.

TaxIdVerification
TaxInfo
TaxInfoParams
TaxInfoVerification
TaxRate

The resource representing a Stripe "TaxRate".

TaxRateId

An id for the corresponding object type.

ThreeDSecureUsage
Token

The resource representing a Stripe "Token".

Topup

The resource representing a Stripe "Topup".

TopupId

An id for the corresponding object type.

TosAcceptance
Transfer

The resource representing a Stripe "Transfer".

TransferData
TransferDataParams
TransferId

An id for the corresponding object type.

TransferReversal

The resource representing a Stripe "TransferReversal".

TransferReversalId

An id for the corresponding object type.

TransferSchedule
TransferScheduleParams
TransformUsage
UpdateAccount

The parameters for Account::update.

UpdateCharge

The parameters for Charge::update.

UpdateCoupon

The parameters for Coupon::update.

UpdateCustomer

The parameters for Customer::update.

UpdateFileLink

The parameters for FileLink::update.

UpdateInvoiceItem

The parameters for InvoiceItem::update.

UpdateOrder

The parameters for Order::update.

UpdatePaymentMethod

The parameters for PaymentMethod::update.

UpdatePayout

The parameters for Payout::update.

UpdatePlan

The parameters for Plan::update.

UpdateProduct

The parameters for Product::update.

UpdateRecipient

The parameters for Recipient::update.

UpdateRefund

The parameters for Refund::update.

UpdateSku

The parameters for Sku::update.

UpdateSource

The parameters for Source::update.

UpdateSubscription

The parameters for Subscription::update.

UpdateSubscriptionItem

The parameters for SubscriptionItem::update.

UpdateSubscriptionItems
UpdateTaxRate

The parameters for TaxRate::update.

UpdateTopup

The parameters for Topup::update.

UpdateTransfer

The parameters for Transfer::update.

UpdateWebhookEndpoint

The parameters for WebhookEndpoint::update.

VerifyBankAccount

The set of parameters that can be used when verifying a Bank Account.

WalletAmexExpressCheckout
WalletApplePay
WalletDetails
WalletGooglePay
WalletMasterpass
WalletSamsungPay
WalletVisaCheckout
Webhook
WebhookEndpoint

The resource representing a Stripe "NotificationWebhookEndpoint".

WebhookEndpointId

An id for the corresponding object type.

Enums

AccountHolderType

An enum representing the possible values of a BankAccount's account_holder_type field.

AccountType

An enum representing the possible values of an Account's type field.

ApiVersion

An enum representing the possible values of an WebhookEndpoint's api_version field.

BalanceTransactionSource
BalanceTransactionSourceId
BalanceTransactionStatus

An enum representing the possible values of an BalanceTransaction's status field.

BalanceTransactionType

An enum representing the possible values of an BalanceTransaction's type field.

BankAccountStatus

An enum representing the possible values of an BankAccount's status field.

BusinessType

An enum representing the possible values of an Account's business_type field.

CapabilityStatus

An enum representing the possible values of an AccountCapabilities's card_payments field.

CaptureMethod

The resource representing a Stripe CaptureMethod object.

CardBrand
CardType
ChargeSourceParams

The set of PaymentSource parameters that can be used to create a charge.

CheckResult
CheckoutSessionLocale

An enum representing the possible values of an CheckoutSession's locale field.

ConfirmationMethod

The resource representing a Stripe ConfirmationMethod object.

CouponDuration

An enum representing the possible values of an Coupon's duration field.

CreatePlanTransformUsageRound

An enum representing the possible values of an CreatePlanTransformUsage's round field.

Currency

Currency is the list of supported currencies.

CustomerTaxExempt

An enum representing the possible values of an Customer's tax_exempt field.

CustomerTaxExemptFilter

An enum representing the possible values of an CreateCustomer's tax_exempt field.

DelayDays
DelayDaysOther
DetachedSource
DisputeStatus

An enum representing the possible values of an Dispute's status field.

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.

EventFilter

An enum representing the possible values of an WebhookEndpoint's enabled_events field.

EventObject
EventType
Expandable

An id or object.

ExternalAccount
FeeType

An enum representing the possible values of an Fee's type field.

FilePurpose

An enum representing the possible values of an File's purpose field.

FraudDetailsReport

An enum representing the possible values of a FraudDetails's report fields.

InvoiceBilling

An enum representing the possible values of an Invoice's billing field.

InvoiceBillingReason

An enum representing the possible values of an Invoice's billing_reason field.

InvoiceCustomerTaxExempt

An enum representing the possible values of an Invoice's customer_tax_exempt field.

InvoiceLineItemId
InvoiceLineItemType

An enum representing the possible values of an InvoiceLineItem's type field.

InvoiceStatus

An enum representing the possible values of an Invoice's status field.

InvoicesResourceInvoiceTaxIdType

An enum representing the possible values of an InvoicesResourceInvoiceTaxId's type field.

IssuingAuthorizationCheck

An enum representing the possible values of the IssuingAuthorizationVerificationData fields.

IssuingAuthorizationMethod

An enum representing the possible values of the IssuingAuthorization's authorization_method field.

IssuingAuthorizationReason

An enum representing the possible values of the IssuingAuthorizationRequest's reason field.

IssuingAuthorizationWalletProvider

An enum representing the possible values of an IssuingAuthorization's wallet_provider field.

IssuingCardReplacementReason

An enum representing the possible values of an IssuingCard's replacement_reason field.

IssuingCardShippingStatus

An enum representing the possible values of an IssuingCardShipping's status field.

IssuingCardShippingType

An enum representing the possible values of an IssuingCardShipping's type field.

IssuingCardStatus

An enum representing the possible values of an IssuingCard's status field.

IssuingCardType

An enum representing the possible values of an IssuingCard's type field.

IssuingCardholderStatus

An enum representing the possible values of an IssuingCardholder's status field.

IssuingCardholderType

An enum representing the possible values of an IssuingCardholder's type field.

IssuingDisputeReason

An enum representing the possible values of an IssuingDispute's reason field.

IssuingDisputeStatus

An enum representing the possible values of an IssuingDispute's status field.

IssuingTransactionType

An enum representing the possible values of an IssuingTransaction's type field.

MerchantCategory

An enum representing the industry of a merchant.

OrderItemParamsType

An enum representing the possible values of an OrderItemParams's type field.

OrderStatus

An enum representing the possible values of an Order's status field.

OrderStatusFilter

An enum representing the possible values of an ListOrders's status field.

PaymentErrorType

The resource representing a Stripe PaymentErrorType object.

PaymentIntentCancellationReason

An enum representing the possible values of an PaymentIntent's cancellation_reason field.

PaymentIntentCaptureMethod

An enum representing the possible values of an PaymentIntent's capture_method field.

PaymentIntentConfirmationMethod

An enum representing the possible values of an PaymentIntent's confirmation_method field.

PaymentIntentMethodType
PaymentIntentNextActionType
PaymentIntentStatus

An enum representing the possible values of an PaymentIntent's status field.

PaymentMethodType

An enum representing the possible values of an PaymentMethod's type field.

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 Customer::attach_source.

PayoutDestination
PayoutDestinationId
PayoutMethod

An enum representing the possible values of an CreatePayout's method field.

PayoutSourceType

An enum representing the possible values of an CreatePayout's source_type field.

PayoutType

An enum representing the possible values of an Payout's type field.

PlanAggregateUsage

An enum representing the possible values of an Plan's aggregate_usage field.

PlanBillingScheme

An enum representing the possible values of an Plan's billing_scheme field.

PlanInterval

An enum representing the possible values of an Plan's interval field.

PlanTiersMode

An enum representing the possible values of an Plan's tiers_mode field.

PlanUsageType

An enum representing the possible values of an Plan's usage_type field.

ProductType

An enum representing the possible values of an Product's type field.

RangeQuery

A set of generic request parameters that can be used on list endpoints to filter their results by some timestamp.

RecipientType

An enum representing the possible values of an Recipient's type field.

RefundReason

An enum representing the possible values of an CreateRefund's reason field.

RequestedCapability

An enum representing the possible values of an CreateAccount's requested_capabilities field.

ReviewClosedReason

An enum representing the possible values of an Review's closed_reason field.

ReviewOpenedReason

An enum representing the possible values of an Review's opened_reason field.

ReviewReason

An enum representing the possible values of an Review's reason field.

Scheduled
ScheduledOther
SourceAcceptanceParamsStatus

An enum representing the possible values of an SourceAcceptanceParams's status field.

SourceAcceptanceParamsType

An enum representing the possible values of an SourceAcceptanceParams's type field.

SourceFlow

An enum representing the possible values of an Source's flow field.

SourceMandateInterval

An enum representing the possible values of an SourceMandateParams's interval field.

SourceMandateNotificationMethod

An enum representing the possible values of an SourceMandateParams's notification_method field.

SourceRedirectFlowFailureReason

An enum representing the possible values of an SourceRedirectFlow's failure_reason field.

SourceRedirectFlowStatus

An enum representing the possible values of an SourceRedirectFlow's status field.

SourceRefundNotificationMethod

An enum representing the possible values of an CreateSourceReceiver's refund_attributes_method field.

SourceStatus

An enum representing the possible values of an Source's status field.

SourceType

An enum representing the possible values of an Source's type field.

SourceUsage

An enum representing the possible values of an Source's usage field.

SpendingLimitInterval

An enum representing the possible values of an SpendingLimit's interval field.

SubscriptionBilling

An enum representing the possible values of an Subscription's billing field.

SubscriptionBillingCycleAnchor

An enum representing the possible values of an UpdateSubscription's billing_cycle_anchor field.

SubscriptionStatus

An enum representing the possible values of an Subscription's status field.

SubscriptionStatusFilter

An enum representing the possible values of an ListSubscriptions's status field.

TaxIdDataType

An enum representing the possible values of an TaxIdData's type field.

TaxIdType

An enum representing the possible values of an TaxId's type field.

TaxIdVerificationStatus

An enum representing the possible values of an TaxIdVerification's status field.

TaxInfoType

An enum representing the possible values of an TaxInfoParams's type field.

TokenId
TokenType

An enum representing the possible values of an Token's type field.

TokenizationMethod
TopupStatus

An enum representing the possible values of an Topup's status field.

TopupStatusFilter

An enum representing the possible values of an ListTopups's status field.

TransferScheduleInterval

An enum representing the possible values of an TransferScheduleParams's interval field.

TransferSourceType

An enum representing the possible values of an Transfer's source_type field.

TransformUsageRound

An enum representing the possible values of an TransformUsage's round field.

UpTo
UpToOther
WalletDetailsType

An enum representing the possible values of an WalletDetails's type field.

WebhookEndpointStatus

An enum representing the possible values of an WebhookEndpoint's status field.

WebhookError

An error encountered when communicating with the Stripe API webhooks.

Weekday

A day of the week.

Traits

Object

Implemented by types which represent stripe objects.

Type Definitions

Metadata
Response

An alias for Result.

Timestamp