post:
  tags:
    - Billing
  summary: Create a customized order form URL
  description: |
    Creates a special order form URL that can be customized for the visitor.
    Allows customizing customer data, prices, and other settings.
    Requires "Billing on demand" right to be enabled for the vendor account.
  security:
    - ApiKeyAuth: []
  parameters:
    - name: purchase_id
      in: query
      required: true
      description: The reference order. Must have been made with a payment method that supports rebilling.
      schema:
        type: string
    - name: product_id
      in: query
      required: true
      description: The product ID in Digistore24
      schema:
        type: string
    - name: payment_plan
      in: query
      required: false
      description: Data for the purchase price/payment plan
      schema:
        type: object
        properties:
          first_amount:
            type: number
            description: The purchase price or first payment amount
          other_amounts:
            type: number
            description: Amount of follow-up payments for subscription/installments
          currency:
            type: string
            minLength: 3
            maxLength: 3
            description: Three-character currency code (e.g. EUR or USD)
          number_of_installments:
            type: integer
            minimum: 1
            description: Number of payments including the first
          first_billing_interval:
            type: string
            description: Time interval between purchase and second installment (e.g. "1_month")
          other_billing_intervals:
            type: string
            description: Time interval for second and further payments
          test_interval:
            type: string
            description: Test interval before payment starts (e.g. "1_month")
          template:
            type: string
            description: ID of payment method used as template
          upgrade_type:
            type: string
            enum: [upgrade, downgrade]
            default: upgrade
            description: Type of upgrade handling
    - name: tracking
      in: query
      required: false
      description: Data for tracking
      schema:
        type: object
        properties:
          custom:
            type: string
            description: Custom value for order reference
          affiliate:
            type: string
            description: Affiliate's Digistore24 ID
          campaignkey:
            type: string
            description: Campaign key of the affiliate
          trackingkey:
            type: string
            description: Vendor's tracking key
    - name: placeholders
      in: query
      required: false
      description: Placeholders for product title and description
      schema:
        type: object
        additionalProperties:
          type: string
    - name: settings
      in: query
      required: false
      description: Additional settings for the order form
      schema:
        type: object
        properties:
          voucher_code:
            type: string
            description: Voucher to apply at payment
          quantity:
            type: integer
            minimum: 1
            default: 1
            description: Quantity of the main product
          product_country:
            type: string
            minLength: 2
            maxLength: 2
            description: Two-letter country code for the product
    - name: addons
      in: query
      required: false
      description: List of add-on products
      schema:
        type: array
        items:
          type: object
          properties:
            product_id:
              type: string
              description: Product ID of the addon
            first_amount:
              type: number
              description: First payment amount for subscription/installment
            other_amounts:
              type: number
              description: Follow-up payment amounts
            single_amount:
              type: number
              description: Purchase amount for single payments
            quantity:
              type: integer
              minimum: 1
              default: 1
              description: Quantity of the addon
            currency:
              type: string
              minLength: 3
              maxLength: 3
              description: Three-character currency code
            is_quantity_editable_after_purchase:
              type: string
              enum: [Y, N]
              default: N
              description: Can buyer change quantity after purchase
            product_country:
              type: string
              minLength: 2
              maxLength: 2
              description: Two-letter country code for the addon
  responses:
    '200':
      description: Order form URL successfully created
      content:
        application/json:
          schema:
            type: object
            properties:
              created_purchase_id:
                type: string
                description: The ID of the new order
              payment_status:
                type: string
                description: The payment status
              payment_status_msg:
                type: string
                description: Payment status in readable form
              billing_status:
                type: string
                description: Status of the new order
              billing_status_msg:
                type: string
                description: Order status in readable form
    '403':
      description: Access denied - Full access required or Billing on demand not enabled
    '400':
      description: Invalid request parameters
