get:
  tags:
    - Purchases
  summary: Get purchase details
  description: Returns details for one or more orders
  security:
    - ApiKeyAuth: []
  parameters:
    - name: purchase_id
      in: query
      required: true
      description: Single Digistore24 order ID or comma-separated list of order IDs
      schema:
        type: string
  responses:
    '200':
      description: Successful operation
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/PurchaseResponse'
              - type: object
                additionalProperties:
                  $ref: '#/components/schemas/PurchaseResponse'
    '401':
      description: Unauthorized - Invalid or missing API key
    '403':
      description: Forbidden - Insufficient access rights
    '404':
      description: Not found - Purchase with specified ID does not exist
components:
  schemas:
    PurchaseResponse:
      type: object
      properties:
        other_amounts:
          type: number
          format: float
          description: Amount of follow-up payments
        other_vat_amounts:
          type: number
          format: float
          description: VAT amount for follow-up payments
        id:
          type: string
          description: Purchase ID
        amount:
          type: number
          format: float
          description: Purchase amount
        currency:
          type: string
          description: Currency code
        number_of_installments:
          type: integer
          description: Number of installments (0 for subscriptions)
        vat_country:
          type: string
          description: Two-letter country code for VAT
        vat_amount:
          type: number
          format: float
          description: VAT amount
        vat_rate:
          type: number
          format: float
          description: VAT rate percentage
        created_at:
          type: string
          format: date-time
          description: Purchase creation timestamp
        billing_type:
          type: string
          enum: [single_payment, subscription, installment]
          description: Type of billing
        billing_type_msg:
          type: string
          description: Billing type in readable form
        billing_status:
          type: string
          enum: [paying, completed, aborted, unpaid, reminding]
          description: Current billing status
        billing_status_msg:
          type: string
          description: Billing status in readable form
        renew_url:
          type: string
          format: uri
          description: URL to renew payment
        receipt_url:
          type: string
          format: uri
          description: URL to download receipt
        invoice_url:
          type: string
          format: uri
          description: URL to download invoice
        has_custom_forms:
          type: string
          enum: [Y, N]
          description: Whether purchase has custom forms
        has_etickets:
          type: string
          enum: [Y, N]
          description: Whether purchase has e-tickets
        transaction_list:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: Transaction ID
              amount:
                type: number
                format: float
                description: Transaction amount
              currency:
                type: string
                description: Currency code
              purchase_id:
                type: string
                description: Associated purchase ID
              pay_method:
                type: string
                description: Payment method code
              pay_method_msg:
                type: string
                description: Payment method in readable form
              created_at:
                type: string
                format: date-time
                description: Transaction timestamp
              type:
                type: string
                enum: [payment, refund]
                description: Transaction type
              type_msg:
                type: string
                description: Transaction type in readable form
              invoice_url:
                type: string
                format: uri
                description: URL to download invoice
        buyer:
          type: object
          properties:
            id:
              type: integer
              description: Buyer ID
            created_at:
              type: string
              format: date-time
              description: Account creation timestamp
            email:
              type: string
              format: email
              description: Email address
            first_name:
              type: string
              description: First name
            last_name:
              type: string
              description: Last name
            salutation:
              type: string
              description: Salutation (e.g. Mr.)
            title:
              type: string
              description: Academic title
            company:
              type: string
              description: Company name
            street:
              type: string
              description: Street address
            street2:
              type: string
              description: Additional address line
            zipcode:
              type: string
              description: Postal code
            city:
              type: string
              description: City
            state:
              type: string
              description: State/province
            country:
              type: string
              description: Two-letter country code
            phone_no:
              type: string
              description: Phone number
        items:
          type: array
          items:
            type: object
            properties:
              product_name:
                type: string
                description: Product name
              product_id:
                type: integer
                description: Product ID
              quantity:
                type: integer
                description: Quantity purchased
              variant_key:
                type: string
                description: Product variant key
              variant_name:
                type: string
                description: Product variant name
              no:
                type: integer
                description: Item number in order
              count:
                type: integer
                description: Total number of items
              id:
                type: integer
                description: Purchase item ID
        placeholders:
          type: object
          description: Placeholders used in createBuyUrl
        refund_policy:
          type: object
          properties:
            purchase_id:
              type: string
              description: Purchase ID
            reason_code:
              type: string
              enum: [business, consumer, common, vendor]
              description: Reason for applied refund policy
            refund_days:
              type: integer
              description: Number of days allowed for refund
            is_reminder_allowed:
              type: string
              enum: [Y, N]
              description: Whether reminders are allowed
            policy_id:
              type: integer
              description: Refund policy ID
            product_type_id:
              type: integer
              description: Product type ID
            delivery_type:
              type: string
              enum: [digital, shipping, service, event]
              description: Type of delivery
            checkbox_text:
              type: string
              description: Text of refund waiver checkbox
        cancel_policy:
          type: string
          description: Subscription cancellation policy (e.g. "12m_3m")
        can_cancel_before:
          type: string
          format: date
          description: Date when cancellation becomes effective
        upsell_no:
          type: integer
          description: Upsell number indicating the position in the upsell sequence
        upsell_position:
          type: string
          description: Conversion cockpit flow position path (e.g., "ynyynn") representing the buyer's journey through upsells
