1. Setup
Documentation
  • Back to home
  • StripeKit
  • Installation
  • Getting Started
  • Choosing a Mode
  • Type Reference
  • Setup
    • Configuration
    • Timezones
    • Storage Adapter
    • Money and Currency
    • Error Handling
  • Stripe
    • Elements
  • Modules
    • Overview
    • Customers
      • Overview
      • List
      • Retrieve
      • Find or Create by Email
      • Create
      • Update
      • Sync
      • Delete
    • Payment Methods
      • Overview
      • Create Setup Intent
      • List
      • Attach
      • Detach
      • Set Default
      • Sync
    • Payments
      • Overview
      • Pay With Saved Method
      • Create
      • Retrieve
      • Confirm
      • Cancel
      • Sync
    • Checkout
      • Overview
      • Get
      • Create
      • Submit Fields
      • Apply Coupon
      • Mark Complete
    • Subscriptions
      • Overview
      • Create
      • Retrieve
      • Cancel
      • Resume
      • Toggle Collection Method
      • Update Fields
      • Apply Promotion Code
      • List By Customer
      • Find By Metadata
      • Sync
    • Invoices
      • Overview
      • Retrieve
      • List By Customer
      • List By Subscription
      • Pay With Saved Method
      • Void
      • Finalize
      • Sync
    • Coupons
      • Overview
      • Create
      • Validate
      • Apply To Subscription
      • List
      • Deactivate
    • Webhooks
      • Overview
      • Process
      • Events Reference
    • Sync
      • Overview
  1. Setup

Configuration

StripeKit is configured with a single call to StripeKit.init().

Options#

OptionRequiredDescription
secretKeyYesYour Stripe secret key (sk_live_... / sk_test_...). Never expose this in the browser.
modeYes'api', 'elements', or 'both'. See Choosing a mode.
publishableKeyOnly for elements/bothYour Stripe publishable key. Not used server-side, but returned via kit.toClientConfig() so your frontend can fetch it from your own backend instead of hardcoding it.
webhookSecretOnly if using kit.webhooksYour endpoint's signing secret from the Stripe Dashboard.
timezoneNo, defaults to "UTC"Any IANA timezone, e.g. "Europe/Amsterdam", "America/New_York". See Timezones.
currencyNo, defaults to "usd"Default 3-letter ISO currency for calls that don't specify one.
successUrl / cancelUrlNoDefault redirect URLs used by hosted Checkout Sessions when not passed per call.
storageNoA StorageAdapter implementation. See Storage adapter.
apiVersionNoPins a specific Stripe API version for the underlying stripe client.
appInfoNoPassed through to the underlying Stripe client for Stripe's App Info reporting.
debugNoEnables additional internal logging.
maxNetworkRetriesNo, defaults to 2Number of automatic retries for failed network requests to Stripe.
timeoutNoRequest timeout in milliseconds for calls to Stripe.

Fail-fast validation#

If required options are missing or invalid, StripeKit.init() throws a ConfigurationError immediately, so misconfiguration is caught at boot time rather than mid-request. See Error handling for the full exception hierarchy.
Previous
Type Reference
Next
Timezones
Built with