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

# Create Payment Session

> Create a Payment Session to collect credit card/direct debit information from the customer using [Wingback.js.](/dev/guides/integrate-wingback-signup-flow#create-a-payment-method-session-in-wingback-backend)

export const IntRedir = () => {
  if (typeof document === "undefined") {
    return null;
  } else {
    setTimeout(() => {
      const currentUrl = new URL(window.location.href);
      if (currentUrl.hostname === 'docs-int.wingback.com') {
        currentUrl.hostname = 'docs.wingback.com';
        window.location.replace(currentUrl.toString());
      }
    }, 1);
    return <></>;
  }
};

<IntRedir />


## OpenAPI

````yaml POST /v1/c/customer/{customer_id}/payment/session
openapi: 3.0.3
info:
  title: wingback-api
  description: ''
  contact:
    name: ''
  license:
    name: commercial
  version: 0.1.0
servers:
  - url: http://127.0.0.1:8080
    description: Local server
  - url: https://api.app.test.wingback.com
    description: Testing server
security: []
paths:
  /v1/c/customer/{customer_id}/payment/session:
    post:
      tags:
        - payment-session
      summary: Create a payment_session whose id will be used as token
      operationId: c_create_payment_session
      parameters:
        - name: customer_id
          in: path
          description: Id of the customer
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/inbound.payment.PaymentSession'
        required: true
      responses:
        '200':
          description: payment session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/outbound.payment.PaymentSession'
      security:
        - api-key: []
        - wb_user_cookie: []
components:
  schemas:
    inbound.payment.PaymentSession:
      type: object
      description: |-
        An inbound payment session for creation
        (a different one is used for updating, see FI-360)
      required:
        - operation
        - address
      properties:
        address:
          type: boolean
          description: whether to collect billing address
        detach_previous_on_success:
          type: boolean
          nullable: true
        operation:
          $ref: '#/components/schemas/Operation'
        plan_id:
          allOf:
            - $ref: '#/components/schemas/Id'
          nullable: true
        pricing_id:
          allOf:
            - $ref: '#/components/schemas/Id'
          nullable: true
        provider:
          allOf:
            - $ref: '#/components/schemas/core.payment.Provider'
          nullable: true
    outbound.payment.PaymentSession:
      type: object
      description: Payment Session used to configure Payment Method
      required:
        - token
        - wb_customer_id
        - customer_id
        - provider
        - operation
        - status
        - address
        - detach_previous_on_success
      properties:
        address:
          type: boolean
          description: Indicates whether address is required
        customer_id:
          $ref: '#/components/schemas/Id'
        detach_previous_on_success:
          type: boolean
          description: >-
            Determines whether previous payment method will be disabled and
            deregistered

            once current setup succeeds
        operation:
          $ref: '#/components/schemas/Operation'
        provider:
          $ref: '#/components/schemas/core.payment.Provider'
        setup_intent:
          allOf:
            - $ref: '#/components/schemas/outbound.payment.SetupIntent'
          nullable: true
        status:
          type: string
          description: Payment Session Status
        token:
          $ref: '#/components/schemas/Id'
        wb_customer_id:
          $ref: '#/components/schemas/Id'
    Operation:
      type: string
      description: |-
        The purpose of a payment session:
        * AddMethod - add a new payment method
      enum:
        - add_method
    Id:
      type: string
      description: >-
        Unique identifier of an object. Consists of object class prefix and a
        UUID
      example: Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670
    core.payment.Provider:
      type: string
      description: |-
        The payment providers known by the backend.

        Those variants MUST be kept identical to the variants of
        the payment_provider enum of the postgres database
      enum:
        - authorize
        - self_handled
        - stripe
      example: stripe
    outbound.payment.SetupIntent:
      type: object
      description: Payment Configuration setup intent
      required:
        - wb_customer_id
        - customer_id
        - address
      properties:
        address:
          type: boolean
          description: Determines if address should be required
        customer_id:
          $ref: '#/components/schemas/Id'
        stripe:
          allOf:
            - $ref: '#/components/schemas/StripeSetupIntent'
          nullable: true
        wb_customer_id:
          $ref: '#/components/schemas/Id'
    StripeSetupIntent:
      type: object
      description: Additional configuration for Stripe Setup Intent
      required:
        - pk_key
        - connected_account_id
        - client_secret
      properties:
        client_secret:
          type: string
          description: Client Secret
        connected_account_id:
          type: string
          description: Account ID
        pk_key:
          type: string
          description: Stripe Publishable Key
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: wb-key
    wb_user_cookie:
      type: apiKey
      in: cookie
      name: app-session

````