1. Checkout
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. Checkout

Submit Fields

$kit->checkout->submitFields()#

Validates and stores custom field values for a checkout session created with customFields, and best-effort mirrors them onto the underlying Stripe PaymentIntent or Subscription's metadata.

Signature#

Parameters#

FieldTypeDescription
checkoutIdstringThe session returned by create().
submittedarray<string,string>Keyed by each field's key, as defined in customFields.

Example request#

Example response#

Only the validated values that passed, keyed the same way as submitted:

Errors#

ExceptionWhen
NotFoundErrorThe checkout session was not found.
ValidationErrorThe session is no longer 'open' (already completed); or one or more fields fail validation, in which case $error->fieldErrors is an array keyed by field key with a human-readable message per field, for example ['company_name' => 'Company name is required.'].

Notes#

Required fields left blank, and fields that don't match their configured pattern, are collected into a single ValidationError, so you can show every problem to the customer at once instead of one at a time.
After validation succeeds, StripeKit best-effort writes each value onto the underlying Stripe object's metadata as field_<key>, wrapped in its own try/catch so a metadata write failure never blocks the checkout itself.
Previous
Create
Next
Apply Coupon
Built with