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

Create

kit.payments.create()#

Starts a one-off payment. What actually happens depends on the resolved flow, see Choosing a mode.
api flow: creates a Stripe-hosted Checkout Session in payment mode and returns hostedUrl to redirect the customer to.
elements flow: creates a PaymentIntent and returns clientSecret for your frontend to confirm with Stripe Elements.

Signature#

Parameters#

FieldTypeRequiredDescription
amountnumberYesAmount in minor currency units. Must be at least 50 (for example, $0.50), or a ValidationError is thrown. See Money and currency.
currencystringNo3-letter ISO code. Defaults to the currency configured on init.
customerIdstringNoAn existing Stripe customer to bill.
emailstringNoUsed as customer_email on the Checkout Session (api flow) or as receipt_email (elements flow) when customerId is not given.
userIdstring|numberNoYour own internal user ID, stamped on the persisted record. Only used in the elements flow, where a KitPaymentRecord is saved.
descriptionstringNoShown on the Checkout Session's line item, or set as the PaymentIntent's description.
metadataRecord<string,string>NoMerged with StripeKit's own source: "stripekit" entry.
paymentMethodIdstringOnly for elements flowAn existing payment method to charge directly instead of collecting a new one.
receiptEmailstringOnly for elements flowOverrides email for the receipt address specifically.
offSessionbooleanOnly for elements flowMarks the PaymentIntent as off-session.
confirmbooleanOnly for elements flowForces immediate confirmation. Defaults to true automatically when both paymentMethodId and offSession are set.
captureMethod'automatic'|'manual'Only for elements flowDefaults to 'automatic'.
statementDescriptorstringOnly for elements flowShown on the customer's card statement.
applicationFeeAmountnumberOnly for elements flowFor Stripe Connect platforms taking a fee.
returnUrlstringNoUnused by create() itself; kept for parity with other payment calls.
mode'api'|'elements'Only when global mode is 'both'Overrides the resolved flow for this call.

Example request — api flow#

Example response#

Redirect the customer to hostedUrl.

Example request — elements flow#

Example response#

Pass clientSecret to your frontend. See Stripe Elements.

Errors#

ExceptionWhen
ValidationErroramount is below 50 minor units, or currency is not a valid 3-letter code.
ConfigurationErrorThe resolved flow is neither 'api' nor 'elements', which normally only happens with a misconfigured mode.
StripeOperationErrorStripe rejects the request.

Notes#

In the api flow, success_url and cancel_url fall back to the values configured on StripeKit.init(). If neither is set, StripeKit falls back to placeholder https://example.com/... URLs, which you almost certainly want to override, either globally on init or by configuring successUrl / cancelUrl.
Only the elements flow persists a KitPaymentRecord via savePayment(). The api flow does not persist anything until the customer completes checkout and, if configured, your webhook handler syncs the resulting payment. See Webhooks.
Previous
Pay With Saved Method
Next
Retrieve
Built with