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

# Get past orders

> Retrieves paginated list of past (processed) billing attempts for a subscription contract or customer. Includes successful orders, failed attempts, and skipped orders.

**Filter Options:**
- By contract ID: Get order history for specific subscription
- By customer ID: Get all orders across all customer subscriptions
- Pagination: Control page size and page number

**Order Information:**
- Billing attempt status (SUCCESS, FAILED, SKIPPED)
- Shopify order ID for successful attempts
- Billing date and processing date
- Order total and line items
- Error messages for failed attempts

**Authentication:** Requires valid X-API-Key header



## OpenAPI

````yaml /subscription/admin-api-swagger.json get /api/external/v2/subscription-billing-attempts/past-orders
openapi: 3.0.1
info:
  description: >-
    Comprehensive API documentation for managing subscriptions, payments, and
    related operations. These APIs allow you to programmatically manage
    subscription lifecycles, handle payments, configure products, and integrate
    subscription functionality into your applications.
  title: Admin APIs
  version: 0.0.1
servers:
  - url: https://subscription-admin.appstle.com
security: []
tags:
  - description: >-
      Core APIs for managing the complete subscription lifecycle including
      creation, updates, pausing, resuming, and cancellation of subscriptions.
    name: Subscription Management
  - description: >-
      APIs for managing subscription payment methods, processing payments,
      handling payment retries, and updating billing information.
    name: Subscription Payments
  - description: >-
      APIs for managing subscription contracts including delivery schedules,
      pricing, order notes, billing cycles, and shipping addresses.
    name: Subscription Contracts
  - description: >-
      APIs for managing products within subscriptions including adding,
      removing, updating quantities, and swapping products.
    name: Subscription Products
  - description: >-
      APIs for handling billing operations, payment processing, and financial
      transactions related to subscriptions.
    name: Billing & Payments
  - description: >-
      APIs for managing discounts and promotional codes applied to
      subscriptions.
    name: Subscription Discounts
  - description: >-
      APIs for managing one-time add-on products that can be purchased alongside
      recurring subscription items.
    name: Subscription One-Time Products
  - description: >-
      APIs for managing subscription plans, pricing tiers, and plan
      configurations.
    name: Subscription Plans
  - description: >-
      APIs for managing customizable product boxes and bundles where customers
      can select multiple items.
    name: Build-a-Box & Bundles
  - description: >-
      APIs for managing the product catalog including product information,
      variants, and inventory.
    name: Product Catalog
  - description: >-
      APIs for managing operational settings, configurations, and administrative
      functions.
    name: Operations & Settings
  - description: >-
      APIs powering the customer-facing portal where subscribers can manage
      their own subscriptions.
    name: Customer Portal
  - description: APIs for managing customer information, profiles, and account details.
    name: Customers
  - description: >-
      APIs for retrieving aggregated subscription data, customer subscription
      history, and account-level subscription information.
    name: Subscription Data
  - description: >-
      APIs for managing delivery profiles, shipping rates, free shipping
      configuration, and delivery method options on subscriptions.
    name: Delivery & Shipping
  - description: >-
      APIs for managing storefront customization including custom CSS, theme
      settings, label translations, and merchant-defined widget configuration.
    name: Customization
  - description: >-
      APIs for configuring cancellation flows, retention offers, cancellation
      reason management, and win-back automation.
    name: Customer Retention
paths:
  /api/external/v2/subscription-billing-attempts/past-orders:
    get:
      tags:
        - Billing & Payments
      summary: Get past orders
      description: >-
        Retrieves paginated list of past (processed) billing attempts for a
        subscription contract or customer. Includes successful orders, failed
        attempts, and skipped orders.


        **Filter Options:**

        - By contract ID: Get order history for specific subscription

        - By customer ID: Get all orders across all customer subscriptions

        - Pagination: Control page size and page number


        **Order Information:**

        - Billing attempt status (SUCCESS, FAILED, SKIPPED)

        - Shopify order ID for successful attempts

        - Billing date and processing date

        - Order total and line items

        - Error messages for failed attempts


        **Authentication:** Requires valid X-API-Key header
      operationId: getPastOrdersV2
      parameters:
        - description: API Key (Deprecated - Use Header X-API-Key instead)
          in: query
          name: api_key
          required: false
          schema:
            type: string
        - in: header
          name: X-API-Key
          required: false
          schema:
            type: string
        - description: Billing Attempt ID
          in: query
          name: contractId
          required: false
          schema:
            format: int64
            type: integer
        - description: Customer ID
          in: query
          name: customerId
          required: false
          schema:
            format: int64
            type: integer
        - description: Pagination parameters (page number and size)
          example:
            page: 0
            size: 5
            sort:
              - id,desc
          in: query
          name: pageable
          required: true
          schema:
            $ref: '#/components/schemas/Pageable'
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/SubscriptionBillingAttemptDTO'
                type: array
          description: Successfully retrieved past orders
        '400':
          content:
            '*/*':
              schema:
                items:
                  $ref: '#/components/schemas/SubscriptionBillingAttemptDTO'
                type: array
          description: Invalid parameters
        '401':
          content:
            '*/*':
              schema:
                items:
                  $ref: '#/components/schemas/SubscriptionBillingAttemptDTO'
                type: array
          description: Authentication required
        '403':
          content:
            '*/*':
              schema:
                items:
                  $ref: '#/components/schemas/SubscriptionBillingAttemptDTO'
                type: array
          description: Insufficient permissions
components:
  schemas:
    Pageable:
      properties:
        page:
          format: int32
          minimum: 0
          type: integer
        size:
          format: int32
          minimum: 1
          type: integer
        sort:
          items:
            type: string
          type: array
      type: object
    SubscriptionBillingAttemptDTO:
      properties:
        applyUsageCharge:
          type: boolean
        attemptCount:
          format: int32
          type: integer
        attemptTime:
          format: date-time
          type: string
        billingAttemptId:
          type: string
        billingAttemptResponseMessage:
          type: string
        billingDate:
          format: date-time
          type: string
        contractId:
          format: int64
          type: integer
        graphOrderId:
          type: string
        id:
          format: int64
          type: integer
        inventorySkippedAttemptCount:
          format: int32
          type: integer
        inventorySkippedRetryingNeeded:
          type: boolean
        lastShippingUpdatedAt:
          format: date-time
          type: string
        orderAmount:
          format: double
          type: number
        orderAmountContractCurrency:
          format: double
          type: number
        orderAmountShopCurrency:
          format: double
          type: number
        orderAmountUSD:
          format: double
          type: number
        orderAttributes:
          items:
            $ref: '#/components/schemas/AttributeInfo'
          type: array
        orderCancelReason:
          enum:
            - CUSTOMER
            - DECLINED
            - FRAUD
            - INVENTORY
            - STAFF
            - OTHER
            - $UNKNOWN
          type: string
        orderCancelledAt:
          format: date-time
          type: string
        orderClosed:
          type: boolean
        orderClosedAt:
          format: date-time
          type: string
        orderConfirmed:
          type: boolean
        orderDisplayFinancialStatus:
          enum:
            - PENDING
            - AUTHORIZED
            - PARTIALLY_PAID
            - PARTIALLY_REFUNDED
            - VOIDED
            - PAID
            - REFUNDED
            - EXPIRED
            - $UNKNOWN
          type: string
        orderDisplayFulfillmentStatus:
          enum:
            - UNFULFILLED
            - PARTIALLY_FULFILLED
            - FULFILLED
            - RESTOCKED
            - PENDING_FULFILLMENT
            - OPEN
            - IN_PROGRESS
            - ON_HOLD
            - SCHEDULED
            - REQUEST_DECLINED
            - $UNKNOWN
          type: string
        orderId:
          format: int64
          type: integer
        orderName:
          type: string
        orderNote:
          type: string
        orderProcessedAt:
          format: date-time
          type: string
        partialLinesSkipped:
          enum:
            - INVENTORY_MANAGEMENT
            - MANUAL
          type: string
        progressAttemptCount:
          format: int32
          type: integer
        recurringChargeId:
          format: int64
          type: integer
        retryingNeeded:
          type: boolean
        securityChallengeSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - EMAIL_SETTINGS_DISABLED
            - CONTRACT_CANCELLED
          type: string
        shop:
          type: string
        status:
          enum:
            - SUCCESS
            - FAILURE
            - REQUESTING
            - PROGRESS
            - QUEUED
            - SKIPPED
            - SOCIAL_CONNECTION_NULL
            - CONTRACT_CANCELLED
            - CONTRACT_ENDED
            - CONTRACT_PAUSED
            - AUTO_CHARGE_DISABLED
            - SHOPIFY_EXCEPTION
            - SKIPPED_DUNNING_MGMT
            - SKIPPED_INVENTORY_MGMT
            - IMMEDIATE_TRIGGERED
            - SECURITY_CHALLENGE
            - CONTRACT_PAUSED_MAX_CYCLES
            - REFUNDED
            - SKIPPED_DEMO_SHOP
            - SKIPPED_SHOP_INFO_NOT_FOUND
            - SKIPPED_BILLING_DATE_STALE
            - SKIPPED_DUNNING_NOT_CONFIGURED
            - PENDING_CONSOLIDATION
          type: string
        transactionFailedEmailSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - EMAIL_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_CANCELLED
          type: string
        transactionFailedSmsSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - SMS_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_CANCELLED
            - PHONE_NUMBER_EMPTY
          type: string
        transactionRate:
          format: double
          type: number
        upcomingOrderEmailSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - EMAIL_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_CANCELLED
            - STOP_FROM_CONTRACT
            - CONTRACT_PAUSED
          type: string
        upcomingOrderSmsSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - SMS_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_CANCELLED
            - STOP_FROM_CONTRACT
            - CONTRACT_PAUSED
            - PHONE_NUMBER_EMPTY
          type: string
        usageChargeStatus:
          enum:
            - SUCCESS
            - FAILED
            - TO_BE_TRIED
          type: string
        variantList:
          items:
            $ref: '#/components/schemas/VariantQuantity'
          type: array
      required:
        - retryingNeeded
        - shop
      type: object
    AttributeInfo:
      properties:
        key:
          type: string
        value:
          type: string
      type: object
    VariantQuantity:
      properties:
        image:
          type: string
        productId:
          type: string
        productTitle:
          type: string
        quantity:
          format: int32
          type: integer
        swapId:
          format: int64
          type: integer
        title:
          type: string
        variantId:
          format: int64
          type: integer
        variantTitle:
          type: string
      type: object

````