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

# Get Payment Link

> Retrieves the details of an existing payment link, including its line items and applied
discounts. If the link has no label yet, one is generated from its first line item's product
and persisted before the link is returned.



## OpenAPI

````yaml /openapi.json get /v1/payment_links/{id}
openapi: 3.1.0
info:
  title: Flex API
  description: >-
    The Flex API powers HSA/FSA payment processing for healthcare commerce:
    checkout sessions, payment intents, subscriptions, customers, refunds,
    disputes, and eligibility. Authenticate with your partner API key as a
    Bearer token. All endpoints are scoped to your partner account, and test
    mode is fully supported via test API keys.
  version: 0.1.0
servers:
  - url: https://api.withflex.com
security:
  - BearerAuth: []
tags:
  - name: Balance Transactions
  - name: Captures
  - name: Checkout Sessions
  - name: Coupons
  - name: Customers
  - name: Disputes
  - name: Events
  - name: Exports
  - name: Files
  - name: Invoices
  - name: Letters
  - name: Orders
  - name: Payment Intents
  - name: Payment Links
  - name: Payouts
  - name: Prices
  - name: Products
  - name: Promo Codes
  - name: Receipts
  - name: Refunds
  - name: Setup Intents
  - name: Shipping Rates
  - name: Subscriptions
paths:
  /v1/payment_links/{id}:
    get:
      tags:
        - Payment Links
      summary: Get Payment Link
      description: >-
        Retrieves the details of an existing payment link, including its line
        items and applied

        discounts. If the link has no label yet, one is generated from its first
        line item's product

        and persisted before the link is returned.
      operationId: v1.payment_links.get
      parameters:
        - in: path
          name: id
          required: true
          schema:
            examples:
              - fplink_01J9XR8M3K7VZ8N2YB4WJ6T0RA
            type: string
          style: simple
          example: fplink_01J9XR8M3K7VZ8N2YB4WJ6T0RA
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentLinkBody_for_PaymentLink'
              example:
                payment_link:
                  payment_link_id: fplink_01J9XR8M3K7VZ8N2YB4WJ6T0RA
                  label: Example
                  active: false
                  allow_promotion_codes: false
                  shipping_address_collection: false
                  shipping_options: {}
                  metadata:
                    order_id: '8842'
                    channel: shopify
                  url: https://example.com
                  created_at: '2026-06-15T14:30:00Z'
                  payment_intent_data: {}
                  after_completion: {}
                  origin: shopify
                  tax_rate: {}
                  setup_future_use: on_session
                  test_mode: false
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
              example:
                detail:
                  - loc:
                      - string
                    msg: string
                    type: string
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
components:
  schemas:
    PaymentLinkBody_for_PaymentLink:
      description: An envelope wrapping a single payment link object.
      type: object
      required:
        - payment_link
      properties:
        payment_link:
          $ref: '#/components/schemas/PaymentLink'
          description: The payment link.
      example:
        payment_link:
          payment_link_id: fplink_01J9XR8M3K7VZ8N2YB4WJ6T0RA
          label: Example
          active: false
          allow_promotion_codes: false
          shipping_address_collection: false
          shipping_options: {}
          metadata:
            order_id: '8842'
            channel: shopify
          url: https://example.com
          created_at: '2026-06-15T14:30:00Z'
          payment_intent_data: {}
          after_completion: {}
          origin: shopify
          tax_rate: {}
          setup_future_use: on_session
          test_mode: false
    HttpErrorOut:
      title: HttpError
      description: The error response returned when a request cannot be completed.
      type: object
      required:
        - code
        - detail
      properties:
        code:
          description: A short machine-readable error code identifying the type of error.
          type: string
        detail:
          description: A human-readable explanation of what went wrong.
          type: string
      example:
        code: string
        detail: string
    HTTPValidationError:
      description: The error response returned when request validation fails (HTTP 422).
      type: object
      required:
        - detail
      properties:
        detail:
          description: The list of validation errors, one entry per invalid field.
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
      example:
        detail:
          - loc:
              - string
            msg: string
            type: string
    PaymentLink:
      description: >-
        A Payment Link represents a shareable URL that generates a checkout
        session each time a customer opens it. Use it to sell products or
        collect a payment method without building your own checkout page.
      type: object
      required:
        - active
        - after_completion
        - allow_promotion_codes
        - created_at
        - payment_link_id
        - setup_future_use
        - shipping_address_collection
        - test_mode
        - url
      properties:
        payment_link_id:
          description: Unique identifier for the Payment Link
          type: string
          example: fplink_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        label:
          description: Provided or generated label for the payment link.
          type:
            - string
            - 'null'
          example: Example
        active:
          description: >-
            Whether the payment link is currently active. If false, customers
            visiting the URL will be shown a page saying that the link has been
            deactivated.
          type: boolean
          example: false
        line_items:
          description: The line items representing what is being sold.
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/NewLineItem'
        allow_promotion_codes:
          description: Whether promo codes are enabled
          type: boolean
          example: false
        shipping_address_collection:
          description: Whether we want to collect shipping details at checkout time
          type: boolean
          example: false
        shipping_options:
          description: The shipping rate options applied to the session.
          anyOf:
            - $ref: '#/components/schemas/ShippingRateOptions'
            - type: 'null'
        metadata:
          description: Metadata to attach to the payment session
          type:
            - object
            - 'null'
          example:
            order_id: '8842'
            channel: shopify
        url:
          description: The public URL that can be shared with customers.
          type: string
          example: https://example.com
        created_at:
          $ref: '#/components/schemas/Timestamptz'
          description: Time at which the object was created. ISO 8601 format.
          example: '2026-06-15T14:30:00Z'
        payment_intent_data:
          description: >-
            Indicates the parameters to be passed to PaymentIntent creation
            during checkout.
          anyOf:
            - $ref: '#/components/schemas/PaymentIntentData'
            - type: 'null'
        after_completion:
          $ref: '#/components/schemas/AfterCompletion'
          description: Behavior after the purchase is complete.
        origin:
          description: Origin of the payment link
          anyOf:
            - $ref: '#/components/schemas/CheckoutSessionOrigin'
            - type: 'null'
        tax_rate:
          description: Session-level flat tax amount in cents (e.g., 500 = $5.00)
          anyOf:
            - $ref: '#/components/schemas/TaxRate'
            - type: 'null'
        discounts:
          description: >-
            Pre-stored coupon IDs to apply as discounts when generating checkout
            sessions
          type:
            - array
            - 'null'
          items:
            type: string
            example: fcoup_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        setup_future_use:
          $ref: '#/components/schemas/FutureUse'
          description: >-
            How the payment method is saved for future use on checkout sessions
            generated from this link. "off_session" keeps the card on file for
            future merchant-initiated charges; "on_session" requires the
            customer to be present for future payments.
        test_mode:
          description: Whether the payment link was created in test mode
          type: boolean
          example: false
      example:
        payment_link_id: fplink_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        label: Example
        active: false
        allow_promotion_codes: false
        shipping_address_collection: false
        shipping_options:
          shipping_rate_id: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
          shipping_amount: 2500
          display_name: Example
        metadata:
          order_id: '8842'
          channel: shopify
        url: https://example.com
        created_at: '2026-06-15T14:30:00Z'
        payment_intent_data:
          capture_method: automatic
          metadata:
            order_id: '8842'
            channel: shopify
        after_completion:
          type: redirect
          hosted_confirmation: {}
          redirect: {}
        origin: shopify
        tax_rate:
          amount: 2500
        setup_future_use: on_session
        test_mode: false
    ValidationErrorItem:
      description: >-
        Validation errors have their own schema to provide context for invalid
        requests eg. mismatched types and out of bounds values. There may be any
        number of these per 422 UNPROCESSABLE ENTITY error.
      type: object
      required:
        - loc
        - msg
        - type
      properties:
        loc:
          description: >-
            The location as a [`Vec`] of [`String`]s -- often in the form
            `["body", "field_name"]`, `["query", "field_name"]`, etc. They may,
            however, be arbitarily deep.
          type: array
          items:
            type: string
        msg:
          description: The message accompanying the validation error item.
          type: string
        type:
          description: >-
            The type of error, often "type_error" or "value_error", but
            sometimes with more context like as "value_error.number.not_ge"
          type: string
      example:
        loc:
          - string
        msg: string
        type: string
    NewLineItem:
      description: >-
        A line item to add to a Checkout Session, referencing an existing Price
        or supplying inline price data, together with the quantity and any
        per-item shipping or tax.
      type: object
      required:
        - quantity
      properties:
        price:
          description: The ID of the Price object. One of price or price_data is required.
          type:
            - string
            - 'null'
          example: fprice_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        price_data:
          description: >-
            Data used to generate a new Price object inline. One of price or
            price_data is required.
          anyOf:
            - $ref: '#/components/schemas/NewPriceRequest'
            - type: 'null'
        quantity:
          description: The quantity of the line item being purchased.
          type: integer
          format: int32
        shipping_options:
          description: Shipping rate options for the line item.
          anyOf:
            - $ref: '#/components/schemas/ShippingRateOptionsRequest'
            - type: 'null'
        tax_rate:
          description: Tax rate for a specific line item
          anyOf:
            - $ref: '#/components/schemas/TaxRate'
            - type: 'null'
      example:
        price: fprice_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        price_data:
          product: fprod_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        quantity: 0
        shipping_options:
          shipping_rate_id: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        tax_rate:
          amount: 2500
    ShippingRateOptions:
      description: >-
        A resolved shipping option attached to a checkout session or payment
        link, capturing the applied shipping rate and its cost.
      type: object
      required:
        - shipping_amount
        - shipping_rate_id
      properties:
        shipping_rate_id:
          description: ID of the applied shipping rate.
          type: string
          example: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        shipping_amount:
          description: >-
            The shipping cost, in the smallest currency unit (e.g., `500` =
            $5.00 USD). Charged in USD.
          type: integer
          format: int32
          example: 2500
        display_name:
          description: >-
            The display name of the shipping rate (e.g., "Standard Shipping",
            "Express").
          type:
            - string
            - 'null'
          example: Example
      example:
        shipping_rate_id: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        shipping_amount: 2500
        display_name: Example
    Timestamptz:
      description: >-
        A timestamp encoded as an RFC 3339 / ISO 8601 string (e.g.
        `2026-06-15T14:30:00Z`).
      type: string
      example: string
    PaymentIntentData:
      description: >-
        Indicates the parameters to be passed to PaymentIntent creation during
        checkout
      type: object
      required:
        - capture_method
      properties:
        capture_method:
          $ref: '#/components/schemas/PaymentIntentCaptureMethod'
          description: >-
            How the PaymentIntent is captured: `automatic` captures the funds
            immediately after the customer authorizes the payment,
            `automatic_async` captures asynchronously, and `manual` authorizes
            the payment and requires a separate capture. Required when
            `payment_intent_data` is supplied; `automatic` is used when
            `payment_intent_data` is omitted entirely.
        metadata:
          description: >-
            Set of key-value pairs attached to the PaymentIntent created during
            checkout, for storing additional structured information.
          type:
            - object
            - 'null'
          example:
            order_id: '8842'
            channel: shopify
      example:
        capture_method: automatic
        metadata:
          order_id: '8842'
          channel: shopify
    AfterCompletion:
      description: >-
        Configures what the customer sees after completing a checkout session
        generated from a payment link.
      type: object
      required:
        - type
      properties:
        type:
          $ref: '#/components/schemas/AfterCompletionType'
          description: >-
            The behavior to apply after completion: `hosted_confirmation`
            (Default) shows a Flex-hosted confirmation page, and `redirect`
            sends the customer to a URL you specify.
        hosted_confirmation:
          description: >-
            Configuration for the hosted confirmation page. Applies when `type`
            is `hosted_confirmation`; `null` otherwise.
          anyOf:
            - $ref: '#/components/schemas/HostedConfirmation'
            - type: 'null'
        redirect:
          description: >-
            Configuration for the post-completion redirect. Applies when `type`
            is `redirect`; `null` otherwise.
          anyOf:
            - $ref: '#/components/schemas/Redirect'
            - type: 'null'
      example:
        type: redirect
        hosted_confirmation:
          custom_message: Premium SPF 50 mineral sunscreen
        redirect:
          url: https://example.com
    CheckoutSessionOrigin:
      description: Origin of where the checkout session was generated
      type: string
      enum:
        - shopify
        - shopline
        - prepurchase
        - postpurchase
      example: shopify
    TaxRate:
      description: >-
        A fixed tax amount to apply to a Checkout Session or line item. Use this
        to pass a tax figure you have calculated yourself, rather than having
        Flex compute it.
      type: object
      required:
        - amount
      properties:
        amount:
          description: >-
            The tax amount to apply, in the smallest currency unit (e.g., `175`
            = $1.75 USD).
          type: integer
          format: int32
          example: 2500
      example:
        amount: 2500
    FutureUse:
      type: string
      enum:
        - on_session
        - off_session
      x-ms-enum:
        name: FutureUse
        modelAsString: false
        values:
          - value: on_session
            name: OnSession
            description: Standard payments requiring customer auth
          - value: off_session
            name: OffSession
            description: Allows payments without the customer present in the flow
      description: >-
        - `on_session`: Standard payments requiring customer auth

        - `off_session`: Allows payments without the customer present in the
        flow
      example: on_session
    NewPriceRequest:
      description: >-
        Parameters for creating a price. Reference an existing product with
        `product`, or create one inline with `product_data`.
      type: object
      example:
        product: fprod_01J9XR8M3K7VZ8N2YB4WJ6T0RA
      required:
        - unit_amount
      properties:
        description:
          description: A brief description of the price.
          type:
            - string
            - 'null'
          example: Premium SPF 50 mineral sunscreen
        unit_amount:
          description: >-
            A positive integer in cents (or 0 for a free price) representing how
            much to charge.
          type: integer
          format: int64
          minimum: 0
          example: 2500
          maximum: 4294967295
        recurring:
          description: >-
            The recurring components of a price such as interval and trial
            period days.
          anyOf:
            - $ref: '#/components/schemas/Recurring'
            - type: 'null'
        metadata:
          description: Metadata to attach to the price.
          type:
            - object
            - 'null'
          example:
            order_id: '8842'
            channel: shopify
        product:
          description: The ID of the product that this price will belong to.
          type: string
          example: fprod_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        product_data:
          $ref: '#/components/schemas/CreateProductRequest'
          description: Data used to generate a new Product object inline.
    ShippingRateOptionsRequest:
      description: >-
        Specifies the shipping rate to apply, either by referencing an existing
        rate or by providing inline data to create one. Provide one of
        `shipping_rate_id` or `shipping_rate_data`; at least one is required.
      type: object
      properties:
        shipping_rate_id:
          description: >-
            ID of an existing shipping rate to apply. Provide this or
            `shipping_rate_data`.
          type:
            - string
            - 'null'
          example: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        shipping_rate_data:
          description: >-
            Inline shipping rate parameters used to create a new shipping rate.
            Provide this or `shipping_rate_id`.
          anyOf:
            - $ref: '#/components/schemas/CreateShippingRateRequest'
            - type: 'null'
      example:
        shipping_rate_id: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        shipping_rate_data:
          display_name: Example
          amount: 2500
          metadata:
            order_id: '8842'
            channel: shopify
    PaymentIntentCaptureMethod:
      description: >-
        Controls when funds are captured: automatically once the payment is
        confirmed, or manually at a later time.
      type: string
      enum:
        - automatic
        - automatic_async
        - manual
      example: automatic
    AfterCompletionType:
      description: >-
        What happens after a payment link checkout completes: a redirect to your
        URL, or a Flex-hosted confirmation page.
      type: string
      enum:
        - redirect
        - hosted_confirmation
      example: redirect
    HostedConfirmation:
      description: >-
        Hosted confirmation page shown after a completed checkout when
        `after_completion.type` is `hosted_confirmation`.
      type: object
      properties:
        custom_message:
          description: >-
            A custom message displayed to the customer on the hosted
            confirmation page.
          type:
            - string
            - 'null'
          example: Premium SPF 50 mineral sunscreen
      example:
        custom_message: Premium SPF 50 mineral sunscreen
    Redirect:
      description: >-
        Redirect behavior applied after a completed checkout when
        `after_completion.type` is `redirect`.
      type: object
      required:
        - url
      properties:
        url:
          description: The URL the customer is redirected to after completing the checkout.
          type: string
          format: uri
          example: https://example.com
      example:
        url: https://example.com
    Recurring:
      description: >-
        Describes how a recurring price bills over time. Present on prices of
        type `recurring`; `null` for one-time prices.
      type: object
      required:
        - interval
      properties:
        interval:
          $ref: '#/components/schemas/RecurringInterval'
          description: The billing cadence for the price.
        interval_count:
          description: The number of intervals
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
          maximum: 4294967295
        trial_period_days:
          description: >-
            The number of trial period days before the customer is charged for
            the first time. Whole days only. For a precise trial-end timestamp
            (e.g. non-integer days), use `subscription_data.trial_end` on the
            Create Checkout Session request instead.
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
          maximum: 4294967295
      example:
        interval: day
    CreateProductRequest:
      description: >-
        Parameters for creating a product. HSA/FSA eligibility is determined
        automatically by Flex from the name, description, and identifiers you
        provide, and cannot be set directly.
      type: object
      required:
        - name
      properties:
        name:
          description: The product's name, meant to be displayed to the customer.
          type: string
          example: Example
        description:
          description: >-
            The product's description, a short blurb meant to be displayed to
            the customer.
          type:
            - string
            - 'null'
          example: Premium SPF 50 mineral sunscreen
        upc_code:
          description: >-
            The product's UPC code. If provided, this will be used to check
            whether the product is on the eligible product list.
          type:
            - string
            - 'null'
          example: example_value
        gtin:
          description: >-
            The product's GTIN. If provided, this will be used to check whether
            the product is on the eligible product list.
          type:
            - string
            - 'null'
          example: example_value
        reference_gtin:
          description: >-
            If the product is HSA/FSA eligible through private label, this
            should be provided.
          type:
            - string
            - 'null'
          example: example_value
        url:
          description: A URL of a publicly-accessible image of the product.
          type:
            - string
            - 'null'
          example: https://example.com
        client_reference_id:
          description: >-
            An optional identifier for the product set by the client. Immutable
            after creation.
          type:
            - string
            - 'null'
          example: example_value
        metadata:
          description: >-
            Set of key-value pairs that you can attach to a product. This can be
            useful for storing additional information about the product in a
            structured format.
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
          example:
            order_id: '8842'
            channel: shopify
        image_urls:
          description: >-
            URLs of publicly-accessible product images for eligibility
            determination.
          type:
            - array
            - 'null'
          items:
            type: string
          example:
            - https://example.com/image.png
        categories:
          description: Product categories (e.g., "Vitamins", "First Aid").
          type:
            - array
            - 'null'
          items:
            type: string
        components:
          description: Product components or ingredients (e.g., "Vitamin C", "Zinc").
          type:
            - array
            - 'null'
          items:
            type: string
      example:
        name: Example
        description: Premium SPF 50 mineral sunscreen
        upc_code: example_value
        gtin: example_value
        reference_gtin: example_value
        url: https://example.com
        client_reference_id: example_value
        metadata:
          order_id: '8842'
          channel: shopify
        image_urls:
          - https://example.com/image.png
    CreateShippingRateRequest:
      description: Parameters for creating a shipping rate.
      type: object
      required:
        - amount
        - display_name
      properties:
        display_name:
          description: >-
            The name shown to the customer at checkout (e.g., `Standard
            Shipping`). Must be at least 2 characters.
          type: string
          minLength: 2
          example: Example
        amount:
          description: >-
            The shipping cost, in the smallest currency unit (e.g., `500` =
            $5.00 USD). Charged in USD.
          type: integer
          format: int32
          example: 2500
        metadata:
          description: >-
            Set of key-value pairs you can attach to the shipping rate for
            storing additional structured information.
          type:
            - object
            - 'null'
          example:
            order_id: '8842'
            channel: shopify
      example:
        display_name: Example
        amount: 2500
        metadata:
          order_id: '8842'
          channel: shopify
    RecurringInterval:
      description: The frequency at which a recurring price bills.
      type: string
      enum:
        - day
        - week
        - month
        - year
      example: day
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Use a Bearer token to access this API.

````