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

# Generate PayFast Checkout Identifier

> Generate a PayFast checkout for the cart. An onsite payment identifier (for the PayFast modal) is attempted first; if that is unavailable the response falls back to a redirect URL. The cart must have billing information (name and email) before calling this.



## OpenAPI

````yaml /api-reference/openapi.json post /carts/{cartId}/payfast/identifier
openapi: 3.0.0
info:
  title: Marzipan API
  version: 1.0.0
servers:
  - url: https://api.marzipan.co/v1
security:
  - tenantAuth: []
tags:
  - name: Account
    description: >-
      Account management endpoints including registration, login, and user
      details
  - name: Carts
    description: Shopping cart management endpoints
  - name: Products
    description: Product catalog and search endpoints
  - name: Subscriptions
    description: Subscription management and renewal endpoints
  - name: CMS
    description: Content management system endpoints
  - name: Messaging
    description: Message and communication endpoints
  - name: Search
    description: Search functionality endpoints
  - name: Settings
    description: >-
      Storefront settings and market detection used to configure the web
      components and checkout.
  - name: Analytics
    description: Storefront visit and attribution tracking.
  - name: Rewards
    description: >-
      Loyalty and rewards programme endpoints for the authenticated customer,
      covering points balance, tier status, perks, exclusive products and
      transaction history.
  - name: Forms
    description: Render and submit dynamic storefront forms defined in the CMS.
  - name: Events
    description: >-
      Check event availability, browse occurrences and recurring dates, generate
      ticket QR codes, and manage event waitlists (join, leave, check status,
      and claim promoted spots).
paths:
  /carts/{cartId}/payfast/identifier:
    parameters:
      - name: cartId
        in: path
        required: true
        description: The unique identifier for the cart
        schema:
          type: string
          format: uuid
        example: 893ff86d-4453-4134-9f62-5c9b7a70d74e
    post:
      tags:
        - Carts
      summary: Generate PayFast Checkout Identifier
      description: >-
        Generate a PayFast checkout for the cart. An onsite payment identifier
        (for the PayFast modal) is attempted first; if that is unavailable the
        response falls back to a redirect URL. The cart must have billing
        information (name and email) before calling this.
      parameters: []
      responses:
        '200':
          description: >-
            A PayFast checkout was generated. The `mode` field indicates whether
            to open the onsite modal or redirect the customer.
          content:
            application/json:
              schema:
                type: object
                properties:
                  mode:
                    type: string
                    enum:
                      - onsite
                      - redirect
                    description: Which checkout flow to use.
                  identifier:
                    type: string
                    description: >-
                      The PayFast onsite payment identifier (present when mode
                      is `onsite`).
                  engineUrl:
                    type: string
                    format: uri
                    description: >-
                      The PayFast onsite engine script URL (present when mode is
                      `onsite`).
                  redirectUrl:
                    type: string
                    format: uri
                    description: >-
                      The PayFast redirect checkout URL (present when mode is
                      `redirect`).
              example:
                mode: onsite
                identifier: 01ab23cd45ef67ab89cd01ef23ab45cd
                engineUrl: https://www.payfast.co.za/onsite/engine.js
        '400':
          description: The cart is missing required billing information.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Cart is missing required billing information
        '404':
          description: Cart not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: No query results for model [Cart].
components:
  schemas:
    Error:
      type: object
      properties:
        message:
          type: string
          description: Error message
      required:
        - message
  securitySchemes:
    tenantAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your API token.
      bearerFormat: JWT

````