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

# Create hosted checkout link

> Creates a one-hour hosted checkout URL for an existing BillingServ customer. `customer_id` is required and must reference a customer account (`account_type` 2). When the customer opens the returned URL, BillingServ signs them into a checkout-only session, shows a checkout-only page, allows saved payment methods such as Stripe cards, and redirects back to `callback_url` after payment.



## OpenAPI

````yaml /api-reference/openapi.json post /checkout/create
openapi: 3.1.0
info:
  title: BillingServ API V2
  description: >-
    Resources and tools for developers to integrate with the BillingServ v2 API.
    v1 is deprecated; use the v2 base URL and bearer-token authentication unless
    an endpoint states otherwise.
  version: '2.0'
servers:
  - url: https://demo.onlinebillingform.com/api/v2
    description: BillingServ demo API
security:
  - bearerAuth: []
tags:
  - name: Customer
  - name: Package
  - name: Group
  - name: Country
  - name: County
  - name: VPN
  - name: Invoice
  - name: Order
  - name: Module
  - name: Report
  - name: Marketing
  - name: Setting
  - name: Checkout
  - name: Usage
  - name: Support
paths:
  /checkout/create:
    post:
      tags:
        - Checkout
      summary: Create hosted checkout link
      description: >-
        Creates a one-hour hosted checkout URL for an existing BillingServ
        customer. `customer_id` is required and must reference a customer
        account (`account_type` 2). When the customer opens the returned URL,
        BillingServ signs them into a checkout-only session, shows a
        checkout-only page, allows saved payment methods such as Stripe cards,
        and redirects back to `callback_url` after payment.
      operationId: POST_checkout_create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                package_id:
                  type: integer
                  description: Package/order group package ID to add to checkout.
                cycle_id:
                  type: integer
                  description: Billing cycle ID for the selected package.
                callback_url:
                  type: string
                  format: uri
                  description: >-
                    URL BillingServ redirects to after hosted checkout succeeds
                    or fails.
                customer_id:
                  type: integer
                  description: >-
                    Existing BillingServ customer user ID. Required; the user
                    must have account_type 2.
              additionalProperties: true
              required:
                - package_id
                - cycle_id
                - callback_url
                - customer_id
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                package_id:
                  type: integer
                  description: Package/order group package ID to add to checkout.
                cycle_id:
                  type: integer
                  description: Billing cycle ID for the selected package.
                callback_url:
                  type: string
                  format: uri
                  description: >-
                    URL BillingServ redirects to after hosted checkout succeeds
                    or fails.
                customer_id:
                  type: integer
                  description: >-
                    Existing BillingServ customer user ID. Required; the user
                    must have account_type 2.
              additionalProperties: true
              required:
                - package_id
                - cycle_id
                - callback_url
                - customer_id
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
              example:
                success: true
                message: Successfully
                url: >-
                  https://demo.onlinebillingform.com/checkout/00000000-0000-0000-0000-000000000000
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                errors: Invalid API Key
        '403':
          description: Authenticated key does not have permission for this endpoint
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                errors: Insufficient permissions for this endpoint.
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              example:
                success: false
                errors:
                  customer_id:
                    - The customer id field is required.
      security:
        - bearerAuth: []
components:
  schemas:
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        errors:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
            - type: object
              additionalProperties: true
      additionalProperties: true
    ValidationErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        errors:
          oneOf:
            - type: array
              items:
                type: string
            - type: object
              additionalProperties: true
            - type: string
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: 'Use `Authorization: Bearer <live_api_key>`.'

````