1. Payment Methods
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. Payment Methods

Create Setup Intent

$kit->paymentMethods->createSetupIntent()#

Creates a Stripe SetupIntent, the entry point for saving a customer's card for later use, without charging them anything right now. Confirmed on the frontend with Stripe Elements.

Signature#

Parameters#

FieldTypeRequiredDescription
customerIdstringYesThe customer this saved payment method will belong to.
usagestringNo, defaults to 'off_session'Either 'off_session' (the customer is not present for future charges) or 'on_session'.
metadataarray<string,string>NoArbitrary metadata stored on the SetupIntent.

Example request#

Example response#

Errors#

ExceptionWhen
StripeOperationErrorThe customer ID does not exist.

Using the result#

Pass clientSecret to your frontend and confirm it with the bundled Stripe Elements helper:
See Stripe Elements for the full frontend flow.

Notes#

This call does not itself save anything to your storage adapter. Once the customer confirms the SetupIntent on the frontend, call list() or sync() to pull the newly saved payment method into your own database. StripeKit's webhook handling also does this automatically for the setup_intent.succeeded event, see Webhooks.
Previous
Overview
Next
List
Built with