# Retrieve an upcoming order invoice

`GET /orders/{id}/upcoming-invoice`

> This is a subset of the full specification, limited to the `GET /orders/{id}/upcoming-invoice` operation.
>
> You can find the full specification here: /_bundle/docs/dev-docs/api/index.yaml

```yaml
openapi: 3.1.1
info:
  version: latest
  title: Core APIs
  contact:
    name: Rebilly API Support
    url: https://www.rebilly.com/contact/
    email: integrations@rebilly.com
  license:
    name: Rebilly
    url: https://www.rebilly.com/api-license/
  termsOfService: https://www.rebilly.com/terms-of-use/
  x-logo:
    url: https://rebilly-core.redoc.ly/rb_apiLogo.svg
    backgroundColor: '#0044d4'
  description: This is a subset of the full specification, limited to the `GET /orders/{id}/upcoming-invoice` operation.
  x-metadata:
    description: The most common APIs used to automate common workflows.
    redocly_category: API Reference
servers:
  - url: https://api-sandbox.rebilly.com/organizations/{organizationId}
    description: Sandbox server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
  - url: https://api.rebilly.com/organizations/{organizationId}
    description: Live server
    variables:
      organizationId:
        default: '{organizationId}'
        description: |-
          Unique organization identifier.
          An organization is an entity that represents a company.
          For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
security:
  - SecretApiKey: []
  - JWT: []
tags:
  - name: Orders
    description: Use these operations to manage orders that include items with mixed recurring subscription plans.
x-tagGroups:
  - name: Orders & Invoices
    tags:
      - Orders
paths:
  /orders/{id}/upcoming-invoice:
    parameters:
      - $ref: '#/components/parameters/resourceId'
    get:
      x-products:
        - Core
      tags:
        - Orders
      summary: Retrieve an upcoming order invoice
      operationId: GetOrderUpcomingInvoice
      x-sdk-operation-name: getUpcomingInvoice
      description: |-
        Retrieves an upcoming invoice for a specified order.

        An upcoming invoice is an invoice that has not been issued.
        It functions as a preview of the next invoice for the order.
        For more information, see [Invoices](https://www.rebilly.com/docs/dev-docs/invoices/).
      parameters:
        - $ref: '#/components/parameters/collectionExpand'
      responses:
        '200':
          description: Upcoming invoice retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderUpcomingInvoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  securitySchemes:
    JWT:
      description: |-
        JWT is a short lifetime token that can be assigned a specific expiration time.

        Usage format: `Bearer <JWT>`.
      type: http
      scheme: bearer
      bearerFormat: JWT
    SecretApiKey:
      description: |-
        Never share your secret keys.
        Keep them guarded and secure.

        Use your secret API key only to make requests from the server side.
        To authenticate, provide your secret key in the request header.
      name: REB-APIKEY
      type: apiKey
      in: header
  parameters:
    resourceId:
      name: id
      in: path
      description: ID of the resource.
      required: true
      schema:
        type: string
        maxLength: 50
        pattern: ^[@~\-\.\w]+$
    collectionExpand:
      name: expand
      in: query
      description: |-
        Expands a request to include embedded objects within the `_embedded`
        property of the response. This field accepts a comma-separated list of objects.

        For more information, see
        [Embedded resources](https://www.rebilly.com/docs/dev-docs/expand-embedded-resources).
      schema:
        type: string
  schemas:
    CreatedTime:
      type: string
      description: |-
        Date and time when the resource is created.
        This value is set automatically when the resource is created.
      format: date-time
      readOnly: true
      x-sortable: true
      x-label: Creation Time
    UpdatedTime:
      type: string
      description: |-
        Date and time when the resource is updated.
        This value is set automatically when the resource is updated.
      format: date-time
      readOnly: true
      x-sortable: true
      x-label: Last Update Time
    ResourceId:
      type: string
      description: Unique resource ID.
      maxLength: 50
      example: 4f6cf35x-2c4y-483z-a0a9-158621f77a21
    SelfLink:
      type: array
      description: Related links.
      readOnly: true
      items:
        type: object
        properties:
          href:
            description: Link URL.
            type: string
          rel:
            description: Type of link.
            type: string
            enum:
              - self
    BaseProblem:
      type: object
      additionalProperties: true
      minProperties: 1
      description: RFC-7807 [problem details](https://tools.ietf.org/html/rfc7807) JSON object.
      properties:
        type:
          type: string
          description: |-
            Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
            It should provide human-readable documentation for the problem type.
            When this member is not present, its value is assumed to be "about:blank".
          format: uri
        title:
          type: string
          description: |-
            Short, human-readable summary of the problem type.
            Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
        detail:
          type: string
          description: Human-readable explanation that is specific to this occurrence of the problem.
        instance:
          type: string
          description: |-
            URI reference that identifies the specific occurrence of the problem.
            It may or may not yield further information if dereferenced.
    Unauthorized:
      allOf:
        - title: Unauthorized
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 401
              maximum: 401
        - $ref: '#/components/schemas/BaseProblem'
    OrganizationId:
      type: string
      description: |-
        Unique organization identifier.
        An organization is an entity that represents a company.
        For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
      maxLength: 50
      example: org_0YVDM8RC7GDADADSBSMW124JA8
    Forbidden:
      allOf:
        - title: Forbidden
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 403
              maximum: 403
            error:
              type: string
              description: |-
                Message that describes why the request is forbidden.
                Most responses use a descriptive message, such as `Not allowed to change security settings`.
                If the organization requires multi-factor authentication (MFA) and MFA verification has not been completed for the session, this value is `mfa_required`.
                If MFA verification has not been completed for the session and the operation requires a confirmed session, this value is `mfa_required_for_caller`.
                This includes turning on `requireMfa` and resetting MFA for a user.
                If the organization restricts access to a list of IP addresses and the request comes from an IP address that is not in the list, this value is `ip_not_allowed`.
            organizationId:
              description: |-
                ID of the organization that requires MFA or does not allow the IP address of the request.
                This property is present only if `error` is `mfa_required` or `ip_not_allowed`.
                The organization is the organization of the request or another organization that the request acts on.
              $ref: '#/components/schemas/OrganizationId'
        - $ref: '#/components/schemas/BaseProblem'
    NotFound:
      allOf:
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 404
              maximum: 404
        - $ref: '#/components/schemas/BaseProblem'
    CurrencyCode:
      type: string
      description: Currency code in ISO 4217 format.
      minLength: 3
      maxLength: 3
      example: USD
      x-label: Currency
    DiscountContext:
      type: string
      description: Context in which the discount applies.
      default: items
      x-label: Context
      x-sortable: true
      x-basic: true
      x-enumDescriptions:
        items: items (less discounts)
        shipping: shipping (less discounts)
        items-and-shipping: items and shipping (less discounts)
      enum:
        - items
        - shipping
        - items-and-shipping
    ServerTimestamp:
      type: string
      description: Read-only timestamp in ISO 8601 date-time format.
      format: date-time
      readOnly: true
    ManualShipping:
      description: Manually set shipping amount.
      type: object
      required:
        - amount
        - calculator
      properties:
        amount:
          x-type: Money
          type: number
          format: double
          description: Shipping amount.
        calculator:
          description: Shipping calculator.
          type: string
          enum:
            - manual
    RebillyShipping:
      description: Rebilly-based shipping which is calculated by shipping rates.
      type: object
      required:
        - calculator
      properties:
        calculator:
          description: Shipping calculator.
          type: string
          enum:
            - rebilly
        rateId:
          description: |-
            ID of the shipping rate.
            If this value is not set,
            the cheapest applicable shipping rate is used.
          type:
            - string
            - 'null'
          maxLength: 50
          example: shipping-123-456
        amount:
          type: number
          format: double
          readOnly: true
          description: Shipping amount which is calculated from [Shipping rates](https://www.rebilly.com/catalog/all/shipping-rates).
    Shipping:
      description: Shipping settings.
      type: object
      discriminator:
        propertyName: calculator
        mapping:
          manual: '#/components/schemas/ManualShipping'
          rebilly: '#/components/schemas/RebillyShipping'
      oneOf:
        - $ref: '#/components/schemas/ManualShipping'
        - $ref: '#/components/schemas/RebillyShipping'
    TaxItem:
      type: object
      required:
        - amount
        - description
      properties:
        amount:
          description: Amount of the tax.
          type: number
          format: double
        description:
          type: string
          description: Description of the tax.
        rate:
          description: Overall sales tax rate which includes state, county, city and district tax.
          type:
            - number
            - 'null'
          format: double
          readOnly: true
        stateAmount:
          description: Amount of sales tax to collect for the state.
          type:
            - number
            - 'null'
          format: double
          example: 0.94
          readOnly: true
        countyAmount:
          description: Amount of sales tax to collect for the county.
          type:
            - number
            - 'null'
          format: double
          example: 0.04
          readOnly: true
        cityAmount:
          description: Amount of sales tax to collect for the city.
          type:
            - number
            - 'null'
          format: double
          example: 0
          readOnly: true
        specialDistrictAmount:
          description: Amount of sales tax to collect for the special district.
          type:
            - number
            - 'null'
          format: double
          example: 0.38
          readOnly: true
        stateRate:
          description: State sales tax rate for given location.
          type:
            - number
            - 'null'
          format: double
          readOnly: true
        countyRate:
          description: County sales tax rate for given location.
          type:
            - number
            - 'null'
          format: double
          readOnly: true
        cityRate:
          description: City sales tax rate for given location.
          type:
            - number
            - 'null'
          format: double
          readOnly: true
        specialDistrictRate:
          description: Special district sales tax rate for given location.
          type:
            - number
            - 'null'
          format: double
          readOnly: true
        jurisdictions:
          description: Jurisdiction names for the invoice.
          type:
            - object
            - 'null'
          readOnly: true
          properties:
            country:
              description: Two-letter ISO country code for the provided location.
              type:
                - string
                - 'null'
              example: US
              readOnly: true
            state:
              description: Postal abbreviated state name for the provided location.
              type:
                - string
                - 'null'
              example: CA
              readOnly: true
            county:
              description: County name for the provided location.
              type:
                - string
                - 'null'
              example: LOS ANGELES
              readOnly: true
            city:
              description: City name for the provided location.
              type:
                - string
                - 'null'
              example: LOS ANGELES
              readOnly: true
    ManualTax:
      type: object
      description: Manual tax calculator.
      required:
        - calculator
        - items
      properties:
        calculator:
          description: Type of tax calculator.
          type: string
          enum:
            - manual
        amount:
          type: number
          format: double
          x-type: Money
          x-sortable: true
          description: Total amount of taxes.
          readOnly: true
        items:
          type: array
          description: Taxes applied.
          items:
            $ref: '#/components/schemas/TaxItem'
    RebillyTaxJarTax:
      type: object
      description: TaxJar tax calculator.
      required:
        - calculator
      properties:
        calculator:
          description: Type of tax calculator.
          type: string
          enum:
            - rebilly-taxjar
        amount:
          type: number
          format: double
          x-type: Money
          x-sortable: true
          description: Total amount of taxes.
          readOnly: true
        items:
          type: array
          description: Taxes applied and calculated based on the `taxCategoryId` of the related product.
          items:
            $ref: '#/components/schemas/TaxItem'
    RebillyAvalaraTax:
      type: object
      description: Avalara tax calculator.
      required:
        - calculator
      properties:
        calculator:
          description: Type of tax calculator.
          type: string
          enum:
            - rebilly-avalara
        amount:
          type: number
          format: double
          x-type: Money
          x-sortable: true
          description: Total amount of taxes.
          readOnly: true
        items:
          type: array
          description: Taxes applied and calculated based on the `taxCategoryId` of the related product.
          items:
            $ref: '#/components/schemas/TaxItem'
    Taxes:
      description: Taxes.
      type: object
      discriminator:
        propertyName: calculator
        mapping:
          manual: '#/components/schemas/ManualTax'
          rebilly-taxjar: '#/components/schemas/RebillyTaxJarTax'
          rebilly-avalara: '#/components/schemas/RebillyAvalaraTax'
      oneOf:
        - $ref: '#/components/schemas/ManualTax'
        - $ref: '#/components/schemas/RebillyTaxJarTax'
        - $ref: '#/components/schemas/RebillyAvalaraTax'
    OrderUpcomingInvoiceItem:
      type: object
      readOnly: true
      properties:
        id:
          type: string
          description: ID of the upcoming invoice item.
          maxLength: 50
          example: ii_0YVFDEQS2KCFTBN9HXWJFY55GV
        isInterim:
          description: Specifies if the line item is added to an interim invoice.
          type: boolean
        description:
          description: Description of the upcoming invoice item.
          type: string
          maxLength: 1000
        unitPrice:
          description: Unit price of the upcoming invoice item.
          type: number
          format: double
        quantity:
          description: Quantity of the upcoming invoice item.
          type: integer
        price:
          description: Total price of the upcoming invoice item.
          type: number
          format: double
        productId:
          type:
            - string
            - 'null'
          description: ID of the product.
          maxLength: 50
          example: prod_0YV7DES3WPC5J8JD8QTVNZBZNZ
        planId:
          type:
            - string
            - 'null'
          description: ID of the plan.
          maxLength: 50
          example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X
        orderId:
          type: string
          description: ID of the order.
          maxLength: 50
          example: ord_01HVKA5975PJBSQ1SX72G3MSZC
        periodStartTime:
          description: Date and time when the billing period starts.
          type: string
          format: date-time
        periodEndTime:
          description: Date and time when the billing period ends.
          type: string
          format: date-time
        periodNumber:
          description: |-
            Billing period number that is associated with the invoice item.
            For example, an invoice item for a service is included in billing period number 3.
            The invoice item is only applied to billing period number 3.
          type: integer
        tax:
          description: Invoice item tax.
          $ref: '#/components/schemas/TaxItem'
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          $ref: '#/components/schemas/SelfLink'
    OrderUpcomingInvoice:
      type: object
      readOnly: true
      properties:
        id:
          description: |-
            ID of the upcoming invoice.
            This value is persisted in the future renewal invoice.
          type: string
          readOnly: true
          maxLength: 50
          example: in_0YVF9605RKC62BP14NE2R7V2XT
        currency:
          x-sortable: true
          x-basic: true
          $ref: '#/components/schemas/CurrencyCode'
        revision:
          description: |-
            Number of times the upcoming invoice data has changed.

            Use the revision number when analyzing webhook data to
            determine if a change should take precedence over the current
            representation.
          type: integer
        items:
          type: array
          description: Upcoming invoice items array.
          items:
            $ref: '#/components/schemas/OrderUpcomingInvoiceItem'
        amount:
          description: Amount of the invoice.
          type: number
          x-type: Money
          x-sortable: true
          x-basic: true
          format: double
          readOnly: true
        amountDue:
          description: Amount that is due on the invoice.
          type: number
          x-type: Money
          x-sortable: true
          format: double
          readOnly: true
        subtotalAmount:
          description: Subtotal amount of the invoice.
          type: number
          x-type: Money
          format: double
          readOnly: true
        discountAmount:
          description: Discount amount that is applied to the invoice.
          type: number
          x-type: Money
          format: double
          readOnly: true
        shipping:
          $ref: '#/components/schemas/Shipping'
        tax:
          $ref: '#/components/schemas/Taxes'
        discounts:
          type: array
          description: Discounts applied.
          readOnly: true
          items:
            type: object
            readOnly: true
            properties:
              couponId:
                type: string
                description: ID of the coupon.
                maxLength: 50
                example: cpn_0YVCNKF81GD778N4YNVGDJK558
              redemptionId:
                description: ID of the redemption.
                $ref: '#/components/schemas/ResourceId'
              amount:
                description: Total amount discounted by this coupon.
                type: number
                format: double
              description:
                type: string
                description: Description of the discount.
              context:
                $ref: '#/components/schemas/DiscountContext'
        issuedTime:
          description: Date and time when the invoice is issued.
          x-label: Date Issued
          x-sortable: true
          x-basic: true
          $ref: '#/components/schemas/ServerTimestamp'
        isNewOrder:
          description: Specifies if the order is a new order.
          type: boolean
          readOnly: true
          example: true
        dueTime:
          description: Date and time when the invoice is due for payment.
          type: string
          x-sortable: true
          format: date-time
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          $ref: '#/components/schemas/SelfLink'
  responses:
    Unauthorized:
      description: |-
        Unauthorized access.
        Invalid credentials used.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    Forbidden:
      description: |-
        Access forbidden.
        If the organization requires multi-factor authentication (MFA) and the session has not passed MFA, `error` is `mfa_required`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Forbidden'
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFound'
```
