> ## Documentation Index
> Fetch the complete documentation index at: https://spreecommerce.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Stripe Setup Intent

> First, this endpoint creates a customer in Stripe (if it doesn't already exist), then it creates an Ephemeral Key for the customer, and finally, it creates a Setup Intent for the customer.



## OpenAPI

````yaml /api-reference/storefront.yaml post /api/v2/storefront/stripe/setup_intents
openapi: 3.0.3
info:
  version: 2.0.0
  title: Storefront API
  description: >-
    Storefront API is a modern REST API based on the [JSON API
    spec](https://jsonapi.org/) which provides you with all the necessary
    endpoints to build amazing user interfaces either in JavaScript frameworks
    or native mobile libraries.


    Import to
    [Postman](https://raw.githubusercontent.com/spree/spree/main/docs/api-reference/storefront.yaml)
  contact:
    name: Vendo Connect Inc.
    url: https://spreecommerce.org
    email: hello@spreecommerce.org
  license:
    name: BSD-3-Clause
    url: https://github.com/spree/spree/blob/main/LICENSE.md
servers:
  - url: https://demo.spreecommerce.org
    description: demo
  - url: http://localhost:3000
    description: localhost
security: []
tags:
  - name: Account
  - name: Account / Address
  - name: Account / Credit Cards
  - name: Account / Orders
  - name: Cart
  - name: Cart / Line Items
  - name: Cart / Coupons
  - name: Cart / Other
  - name: Checkout
  - name: Checkout / State
  - name: Checkout / Shipments
  - name: Checkout / Payments
  - name: Checkout / Store Credit
  - name: Stripe
  - name: Adyen
  - name: Countries
  - name: Digital Downloads
  - name: Order Status
  - name: Products
  - name: Variants
  - name: Stores
  - name: Policies
  - name: Taxons
  - name: Vendors
  - name: Wishlists
  - name: Wishlists / Wished Items
paths:
  /api/v2/storefront/stripe/setup_intents:
    post:
      tags:
        - Stripe
      summary: Create a Stripe Setup Intent
      description: >-
        First, this endpoint creates a customer in Stripe (if it doesn't already
        exist), then it creates an Ephemeral Key for the customer, and finally,
        it creates a Setup Intent for the customer.
      operationId: create-stripe-setup-intent
      responses:
        '200':
          $ref: '#/components/responses/StripeSetupIntent'
        '422':
          $ref: '#/components/responses/422UnprocessableEntity'
components:
  responses:
    StripeSetupIntent:
      description: >-
        200 Success - Returns the `customer_id` of the authenticated user,
        created ephemeral key's secret and client secret of the created setup
        intent.
      content:
        application/vnd.api+json:
          schema:
            type: object
            properties:
              customer_id:
                type: string
                description: >
                  Stripe's customer ID of the authenticated user (or new one if
                  unauthenticated).
              ephemeral_key_secret:
                type: string
                description: |
                  Secret of the created ephemeral key.
              setup_intent_client_secret:
                type: string
                description: |
                  Client secret of the created setup intent
            required:
              - customer_id
              - ephemeral_key_secret
              - setup_intent_client_secret
          examples:
            Stripe Setup Intent:
              value:
                customer_id: cus_Q9uqUz6gVQFku2
                ephemeral_key_secret: >-
                  ek_test_YWNjdF8xTGtSb1lJaFIwZ0llZ0llyG1LbFhsVU9XWHY1SlNyMXRKVzNJb0hyQ2JZam1HY28_007lGgvGaA
                setup_intent_client_secret: >-
                  seti_1PJb0hIhR0gIegIeZYQQuxpH_secret_Q9uqLuTAvIJQSK1SFS6OaxJMRpe9s7R
    422UnprocessableEntity:
      description: 422 Unprocessable Entity
      content:
        application/vnd.api+json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            422 Example:
              value:
                error: Example is invalid
                errors:
                  example:
                    - Example is invalid
  schemas:
    Error:
      x-internal: false
      title: Error
      type: object
      properties:
        error:
          type: string

````