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

# Mint a preview session for a merchant-owned invoice

> Merchant-authenticated. Mints a short-lived, non-payable checkout session for an invoice of any status, including draft, so the dashboard can render the real checkout page as a preview before the invoice is sent. The returned token can never be used to charge the invoice.



## OpenAPI

````yaml /openapi.json post /checkout/sessions/preview
openapi: 3.0.0
info:
  title: PayGood Merchant API
  description: Server-to-server integration surface for merchant API keys.
  version: '1448-03-01'
  contact: {}
servers:
  - url: https://api-sandbox.paygood.co
    description: Sandbox
  - url: https://api.paygood.co
    description: Production
security: []
paths:
  /checkout/sessions/preview:
    post:
      tags:
        - checkout
      summary: Mint a preview session for a merchant-owned invoice
      description: >-
        Merchant-authenticated. Mints a short-lived, non-payable checkout
        session for an invoice of any status, including draft, so the dashboard
        can render the real checkout page as a preview before the invoice is
        sent. The returned token can never be used to charge the invoice.
      operationId: CheckoutSessionsController_createPreview
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInvoicePreviewSessionDto'
      responses:
        '201':
          description: >-
            Preview session minted. Pass the token as a Bearer token to `GET
            /checkout/sessions/:id` to load the payable projection (including
            `logoUrl` when set).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateInvoicePreviewSessionResponseDto'
        '401':
          description: Missing or invalid authentication credentials.
        '403':
          description: >-
            Authenticated principal lacks `invoices.view` capability or merchant
            scope.
        '404':
          description: Invoice was not found for the provided merchant scope.
      security:
        - bearer: []
components:
  schemas:
    CreateInvoicePreviewSessionDto:
      type: object
      properties:
        invoiceId:
          type: string
          minLength: 1
        merchantId:
          type: string
          minLength: 1
      required:
        - invoiceId
        - merchantId
    CreateInvoicePreviewSessionResponseDto:
      type: object
      properties:
        sessionId:
          type: string
          minLength: 1
        token:
          type: string
          minLength: 1
        expiresAt:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
      required:
        - sessionId
        - token
        - expiresAt
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: merchant_<prefix>_<secret>
      type: http
      description: Merchant API key bearer token.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.