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

    Choosing a Mode

    This is the single most important decision StripeKit asks you to make, because it decides what your payment and checkout calls hand back to you.

    mode: 'api'#

    StripeKit creates a Stripe-hosted Checkout Session and returns hostedUrl. You redirect the customer there; Stripe hosts the entire payment form. Nothing to build on your frontend.

    mode: 'elements'#

    StripeKit creates a PaymentIntent (or SetupIntent) and returns clientSecret. You mount your own Stripe Elements form, using the optional @ricardoneudorfer/stripekit/elements helper or your own code, and confirm the payment yourself. Full control over your UI. See Stripe Elements.

    mode: 'both'#

    StripeKit defaults to the 'api' behavior, but every call that creates a payment or checkout accepts a mode (or flowOverride) argument to choose per call.

    Fields returned per mode#

    FieldSet when
    hostedUrlResolved flow is api
    clientSecretResolved flow is elements
    Both kit.payments.create() and kit.checkout.create() follow this same pattern.
    Previous
    Getting Started
    Next
    Type Reference
    Built with