# Renewal invoice issued

`POST orders-experimental-renewal-invoice-issued`

> This is a subset of the full specification, limited to the `POST orders-experimental-renewal-invoice-issued` 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 `POST orders-experimental-renewal-invoice-issued` operation. Components more than 3 `$ref` hops away are not included.
  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: {}
webhooks:
  orders-experimental-renewal-invoice-issued:
    post:
      summary: Renewal invoice issued
      operationId: orders-experimental-renewal-invoice-issued
      x-products:
        - Core
      tags:
        - Orders
      requestBody:
        $ref: '#/components/requestBodies/RenewalInvoiceIssued'
      responses:
        2xx:
          description: Returns any 2xx status to indicate that data is received.
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
  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
    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
    CustomerId:
      type: string
      description: ID of the customer resource.
      maxLength: 50
      example: cus_0YV7DDSDD1C8DA64KHH2W33CPF
      x-basic: true
    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
    WebsiteId:
      type: string
      description: |-
        ID of the website.
        A website is where an organization obtains a customer.
        For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
      maxLength: 50
      example: web_0YV7DE4Z26DQSA1AC92FBJ7SEG
    ContactObject:
      type: object
      description: Contact's information.
      properties:
        firstName:
          description: Contact's first name.
          type:
            - string
            - 'null'
          pattern: ^[\u0000-\uFFFF]+$
          maxLength: 45
          example: Benjamin
        lastName:
          description: Contact's last name.
          type:
            - string
            - 'null'
          pattern: ^[\u0000-\uFFFF]+$
          maxLength: 45
          example: Franklin
        organization:
          description: Contact's organization.
          type:
            - string
            - 'null'
          pattern: ^[\u0000-\uFFFF]+$
          maxLength: 255
          example: Rebilly
        address:
          description: First line of the contact's street address.
          type:
            - string
            - 'null'
          pattern: ^[\u0000-\uFFFF]+$
          maxLength: 60
          example: 36 Craven St
        address2:
          description: Second line of the contact's street address.
          type:
            - string
            - 'null'
          pattern: ^[\u0000-\uFFFF]+$
          maxLength: 60
        city:
          description: Contact's city of residence.
          type:
            - string
            - 'null'
          pattern: ^[\u0000-\uFFFF]+$
          maxLength: 45
          example: Austin
        region:
          description: Contact's region of residence.
          type:
            - string
            - 'null'
          pattern: ^[\u0000-\uFFFF]+$
          maxLength: 45
          example: Texas
        country:
          description: |-
            Contact's country of residence in ISO 3166 alpha-2 country code.
            For examples, see [ISO.org](https://www.iso.org/obp/ui/#search/code/).
          type:
            - string
            - 'null'
          pattern: ^[A-Z]{2}$
          maxLength: 2
          example: GB
        postalCode:
          description: Contact's postal code.
          type:
            - string
            - 'null'
          pattern: ^[\w\s\-]+$
          maxLength: 10
          example: WC2N 5NF
        phoneNumbers:
          $ref: '#/components/schemas/ContactPhoneNumbers'
        emails:
          $ref: '#/components/schemas/ContactEmails'
        dob:
          description: Contact's date of birth in ISO-8601 `YYYY-MM-DD` format.
          type:
            - string
            - 'null'
          format: date
          example: '1980-04-01'
        jobTitle:
          description: Contact's job title.
          type:
            - string
            - 'null'
          pattern: ^[\u0000-\uFFFF]+$
          maxLength: 255
          example: CEO
        hash:
          description: |-
            Hash value for the contact.
            Use this value to compare contacts for identical attribute values.
          type: string
          maxLength: 40
          example: 056ae6d97c788b9e98b049ebafd7b229bf852221
          readOnly: true
    ServerTimestamp:
      type: string
      description: Read-only timestamp in ISO 8601 date-time format.
      format: date-time
      readOnly: true
    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'
    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'
    InvoiceItem:
      type: object
      required:
        - type
        - unitPrice
      properties:
        id:
          type: string
          description: ID of the invoice item.
          readOnly: true
          maxLength: 50
          example: ii_0YVFDEQS2KCFTBN9HXWJFY55GV
        type:
          description: Type of invoice item.
          type: string
          x-basic: true
          enum:
            - debit
            - credit
        description:
          description: Description of the invoice item.
          type: string
          maxLength: 1000
        unitPrice:
          description: Unit price of the invoice item.
          type: number
          format: double
        quantity:
          description: Quantity of the invoice item.
          type: integer
        price:
          description: Total price of the invoice item.
          type: number
          format: double
          readOnly: true
        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
          readOnly: true
          example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X
        subscriptionId:
          type:
            - string
            - 'null'
          description: ID of the order.
          maxLength: 50
          readOnly: true
          example: sub_01HRF27SATGE4Z6PBJE6PD8328
        periodStartTime:
          description: Date and time when the billing period starts.
          type:
            - string
            - 'null'
          format: date-time
        periodEndTime:
          description: Date and time when the billing period ends.
          type:
            - string
            - 'null'
          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
            - 'null'
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        tax:
          description: Invoice item tax.
          readOnly: true
          oneOf:
            - $ref: '#/components/schemas/TaxItem'
            - type: 'null'
        _links:
          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
                  - product
                  - subscription
                  - plan
        _embedded:
          type: object
          description: Embedded objects that are requested by the `expand` query parameter.
          readOnly: true
          properties:
            product:
              type: object
            plan:
              type: object
    CreditMemoInvoiceAllocation:
      type: object
      properties:
        invoiceId:
          type: string
          description: ID of invoice to which the credit memo is allocated.
          maxLength: 50
          example: in_0YVF9605RKC62BP14NE2R7V2XT
        amount:
          description: |-
            Amount of credit that is allocated from the credit memo to the invoice.
            When a credit memo is updated, the specified `amount` replaces the existing allocation to the invoice.
            It is not added to the existing allocation.
            If the credit memo is already allocated to the invoice,
            the unused amount of the credit memo and the amount due on the invoice both include the existing allocation.
            If the `amount` value is not supplied or exceeds the unused amount of the credit memo or the invoice due amount, the lesser of the following two values is used:
            - The unused amount of the credit memo.
            - The invoice due amount.
          type: number
          format: double
        currency:
          readOnly: true
          $ref: '#/components/schemas/CurrencyCode'
        createdTime:
          description: Date and time at which a credit memo is allocated.
          $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
    Transaction:
      type: object
      description: Transaction information.
      properties:
        id:
          readOnly: true
          $ref: '#/components/schemas/TransactionId'
        websiteId:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/WebsiteId'
        customerId:
          x-basic: true
          x-sortable: true
          allOf:
            - $ref: '#/components/schemas/CustomerId'
        type:
          description: Type of transaction.
          type: string
          x-basic: true
          readOnly: true
          enum:
            - 3ds-authentication
            - authorize
            - capture
            - credit
            - refund
            - sale
            - setup
            - void
        status:
          description: Status of the transaction.
          type: string
          readOnly: true
          enum:
            - completed
            - conn-error
            - disputed
            - never-sent
            - offsite
            - partially-refunded
            - pending
            - refunded
            - sending
            - timeout
            - voided
            - waiting-approval
            - waiting-capture
            - waiting-gateway
            - waiting-refund
        result:
          description: Result of the transaction.
          type: string
          x-basic: true
          readOnly: true
          enum:
            - abandoned
            - approved
            - canceled
            - declined
            - unknown
        amount:
          x-type: Money
          x-sortable: true
          x-basic: true
          description: Total amount of the transaction.
          type: number
          format: double
          readOnly: true
        currency:
          readOnly: true
          $ref: '#/components/schemas/CurrencyCode'
        purchaseAmount:
          description: |-
            Amount by which the purchase is completed.
            If an adjustment occurs, the purchased amount may differ from the requested amount.
          type: number
          format: double
          x-type: Money
          x-currency-field: purchaseCurrency
          x-sortable: true
          readOnly: true
        purchaseCurrency:
          readOnly: true
          $ref: '#/components/schemas/CurrencyCode'
        requestAmount:
          description: |-
            Amount of the payment request.
            If an adjustment occurs,
            the purchase amount may differ from the billing amount.
          type: number
          x-type: Money
          x-currency-field: requestCurrency
          format: double
          readOnly: true
        requestCurrency:
          readOnly: true
          $ref: '#/components/schemas/CurrencyCode'
        parentTransactionId:
          description: ID of the parent transaction.
          type:
            - string
            - 'null'
          $ref: '#/components/schemas/TransactionId'
        childTransactions:
          description: IDs of child transactions.
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/ResourceId'
        invoiceIds:
          description: Related invoice IDs.
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/ResourceId'
        subscriptionIds:
          description: Subscription IDs of invoices that are related to the transaction.
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/ResourceId'
        planIds:
          description: Plan IDs of orders that are related to the transaction.
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/ResourceId'
        isRebill:
          description: Specifies if the transaction is one of a number of recurring payments in a subscription, excluding trials or setup fees.
          type: boolean
          readOnly: true
        rebillNumber:
          description: |-
            Rebill number of the transaction.
            A rebill number is the number of recurring payments in a subscription, excluding trials or setup fees.
          type: integer
          readOnly: true
          x-sortable: true
        billingAddress:
          description: Billing address.
          $ref: '#/components/schemas/ContactObject'
        has3ds:
          description: Specifies if the transaction uses 3D Secure.
          type: boolean
          readOnly: true
        3ds:
          type: object
          description: |-
            Authentication object.
            For more information, see [3D Secure (3DS)](https://www.rebilly.com/docs/settings/3ds/).
          readOnly: true
          properties:
            server:
              description: Name of the 3D Secure server.
              type: string
            version:
              description: Version of 3D Secure.
              type: string
              enum:
                - 1.0.2
                - 2.1.0
                - 2.2.0
            enrolled:
              description: Specifies if the cardholder is enrolled in 3D Secure.
              type: string
              enum:
                - 'yes'
                - 'no'
                - invalid card/timeout
                - unavailable
            authenticated:
              description: Authentication response status for 3D Secure.
              type: string
              enum:
                - 'yes'
                - 'no'
                - not applicable
                - attempted
            liability:
              type: string
              enum:
                - protected
                - not protected
                - protected (attempt)
            flow:
              description: Authentication flow for 3D Secure 2.
              type: string
              enum:
                - frictionless
                - challenge
            isDowngraded:
              description: Specifies if 3D Secure 2 is attempted and downgraded to 3D Secure 1.
              type: boolean
              default: false
              deprecated: true
        redirectUrl:
          description: |-
            URL where the end-user is redirected to when an offsite transaction is completed.
            The default value is the website URL.
          type:
            - string
            - 'null'
          maxLength: 2083
          format: uri
        retryNumber:
          type: integer
          readOnly: true
          description: Position of the transaction in the sequence of retries.
          x-sortable: true
        isRetry:
          type: boolean
          readOnly: true
          description: Specifies if a transaction is a retry.
        billingDescriptor:
          type:
            - string
            - 'null'
          readOnly: true
          description: |-
            Billing descriptor that appears on the periodic billing statement.
            For a credit card statement, this field commonly contains 12 or fewer characters.
        description:
          type: string
          description: Description of the payment.
          maxLength: 255
        requestId:
          description: |-
            Request ID of the transaction.
            This ID must be unique within a 24-hour period.
            Use this field to prevent duplicate transactions.
          type: string
          x-sortable: true
        hasAmountAdjustment:
          description: Specifies if the transaction has amount adjustment.
          type: boolean
          readOnly: true
        gatewayName:
          readOnly: true
          description: |-
            Name of the payment gateway that processed, or is selected to process, the transaction.
            This value is only available after a gateway is selected for the transaction.
          x-label: Gateway
          x-basic: true
          allOf:
            - $ref: '#/components/schemas/GatewayName'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        processedTime:
          description: Date and time when the transaction is processed.
          x-sortable: true
          x-basic: true
          $ref: '#/components/schemas/ServerTimestamp'
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        gatewayAccountId:
          type:
            - string
            - 'null'
          description: ID of the gateway account that processed the transaction.
          maxLength: 50
          example: gw_acc_0YVCXMF26DDNKAERE5NW727S34
          readOnly: true
        gatewayTransactionId:
          description: ID of the gateway transaction.
          readOnly: true
          type:
            - string
            - 'null'
          maxLength: 50
          example: txn_0YVDTQJ8YWDGQACV2N2N5SPWQ0
        gateway:
          type: object
          description: Related gateway information.
          readOnly: true
          properties:
            response:
              description: Gateway response.
              type: object
              properties:
                code:
                  description: Gateway response code.
                  type:
                    - string
                    - 'null'
                message:
                  description: Gateway response message.
                  type:
                    - string
                    - 'null'
                type:
                  description: Gateway response type.
                  type:
                    - string
                    - 'null'
                originalCode:
                  description: Raw, unmapped gateway response code.
                  type:
                    - string
                    - 'null'
                originalMessage:
                  description: Raw, unmapped gateway response message.
                  type:
                    - string
                    - 'null'
            avsResponse:
              description: Gateway Address Verification System (AVS) response.
              type: object
              properties:
                code:
                  description: Response code.
                  type:
                    - string
                    - 'null'
                message:
                  description: Response message.
                  type:
                    - string
                    - 'null'
                originalCode:
                  description: Raw response code.
                  type:
                    - string
                    - 'null'
                originalMessage:
                  description: Raw response message.
                  type:
                    - string
                    - 'null'
            cvvResponse:
              description: Gateway Card Verification Value (CVV) response.
              type: object
              properties:
                code:
                  description: Response code.
                  type:
                    - string
                    - 'null'
                message:
                  description: Response message.
                  type:
                    - string
                    - 'null'
                originalCode:
                  description: Raw response code.
                  type:
                    - string
                    - 'null'
                originalMessage:
                  description: Raw response message.
                  type:
                    - string
                    - 'null'
        acquirerName:
          readOnly: true
          description: |-
            Acquirer name.
            This value is only available when a transaction uses a payment gateway.
            If a transaction does not use a payment gateway, this value is `null`.
          allOf:
            - $ref: '#/components/schemas/AcquirerName'
        method:
          deprecated: true
          description: |-
            Payment method.

            >**Note:** Use `paymentInstrument.method` instead.
          allOf:
            - $ref: '#/components/schemas/PaymentMethod'
        velocity:
          description: Number of transactions by the same customer in the past 24 hours.
          type: integer
        revision:
          description: |-
            Number of times the transaction data has been modified.

            This revision number is useful when analyzing webhook data to determine if the change takes precedence over the current representation.
          type: integer
          readOnly: true
        referenceData:
          description: Transaction reference data.
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
          example:
            gatewayTransactionId: GAT123
          readOnly: true
        bin:
          description: Payment card Bank Identification Number (BIN).
          x-label: BIN
          type:
            - string
            - 'null'
          format: bin
          readOnly: true
        paymentInstrumentFingerprint:
          description: |-
            Unique value that is used to identify the payment instrument of the transaction.
            This value is `null` if the transaction has no payment instrument,
            or the payment instrument has no fingerprint.
          type:
            - string
            - 'null'
          readOnly: true
        paymentInstrument:
          type: object
          oneOf:
            - $ref: '#/components/schemas/VaultedInstrument'
            - $ref: '#/components/schemas/AlternativePaymentInstrument'
            - $ref: '#/components/schemas/CashInstrument'
            - $ref: '#/components/schemas/CheckInstrument'
        hasDcc:
          description: Specifies if Dynamic Currency Conversion (DCC) applies to the transaction.
          type: boolean
          readOnly: true
        dcc:
          description: |-
            Detailed Dynamic currency conversion (DCC).
            If DCC is not applied to the transaction, this value is `null`.
          type:
            - object
            - 'null'
          readOnly: true
          properties:
            base:
              description: Initial amount and currency to convert from.
              $ref: '#/components/schemas/Money'
            quote:
              description: Suggested amount and currency to convert to.
              $ref: '#/components/schemas/Money'
            usdMarkup:
              description: Markup amount converted to USD.
              $ref: '#/components/schemas/MoneyAmount'
            outcome:
              type: string
              description: Dynamic currency conversion outcome.
              enum:
                - unprocessed
                - rejected
                - selected
            isForceDcc:
              description: Specifies if Dynamic Currency Conversion (DCC) is forced for the transaction.
              type: boolean
        riskScore:
          description: Risk score for the transaction.
          type: integer
          readOnly: true
          x-sortable: true
        riskMetadata:
          oneOf:
            - $ref: '#/components/schemas/RiskMetadata'
            - type: 'null'
        notificationUrl:
          description: |-
            URL where a server-to-server POST notification is sent.
            This notification is sent when the transaction result is finalized after a timeout or an offsite interaction.

            Do not interpret this notification as a confirmation,
            complete a `GET` request to confirm the result of the transaction.
            To ensure the request is not reattempted,
            when the result is confirmed, respond with a `2xx` HTTP status code.

            The following placeholders are available to use in this URI: `{id}` and `{result}`.
            These placeholders are replaced the with the transaction ID and result accordingly.
          type:
            - string
            - 'null'
          maxLength: 2083
          format: uri
        isDisputed:
          description: Specifies if a transaction is disputed.
          type: boolean
          readOnly: true
        disputeTime:
          description: |-
            Date and time when the dispute is created.
            If the transaction is not disputed, this value is `null`.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
          x-sortable: true
        disputeStatus:
          description: Status of the dispute.
          type:
            - string
            - 'null'
          readOnly: true
          enum:
            - null
            - response-needed
            - under-review
            - forfeited
            - won
            - lost
            - unknown
        isReconciled:
          description: Specifies if the transaction is verified with gateway batch data.
          type: boolean
          readOnly: true
        isProcessedOutside:
          description: Specifies if the transaction is processed outside of Rebilly.
          type: boolean
        isMerchantInitiated:
          description: Specifies if the transaction is initiated by the merchant.
          type: boolean
        hadDiscrepancy:
          description: Specifies if the transaction is updated due to a discrepancy with its source of truth.
          type: boolean
          readOnly: true
        orderId:
          deprecated: true
          description: |-
            Order ID of the transaction.
            This ID must be unique within a 24 hour period.

            > **Note:** Use the `requestId` field instead.
          type: string
          x-sortable: true
        arn:
          x-label: ARN
          type:
            - string
            - 'null'
          readOnly: true
          description: Acquirer reference number.
          example: '74836950144358910018150'
        reportAmount:
          description: Transaction amount converted to the report currency of the organization.
          type: number
          x-type: Money
          x-sortable: true
          x-currency-field: reportCurrency
          format: double
          readOnly: true
        reportCurrency:
          readOnly: true
          $ref: '#/components/schemas/CurrencyCode'
        settlementTime:
          type:
            - string
            - 'null'
          description: Date and time when the transaction is settled by the banking institution.
          format: date-time
          readOnly: true
          x-sortable: true
        discrepancyTime:
          type:
            - string
            - 'null'
          description: Date and time of the most recent discrepancy on the transaction.
          format: date-time
          readOnly: true
          x-sortable: true
        limits:
          $ref: '#/components/schemas/TransactionLimitAmount'
        organizationId:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/OrganizationId'
        depositRequestId:
          readOnly: true
          type:
            - string
            - 'null'
          description: |-
            ID of the deposit request if applicable.
            The created transaction is based on the properties of this deposit request.
          maxLength: 50
          example: dep_req_0YVJ65BSGYC3EAT58SEX8KY6J7
        transferId:
          readOnly: true
          type:
            - string
            - 'null'
          description: |-
            ID of the ledger transfer if applicable.
            The transaction is linked to this transfer when processed in the wallet ledger.
          maxLength: 50
          example: tb_0YVDTQJ8YWDGQACV2N2N5SPWQ0
        payoutRequestId:
          readOnly: true
          type:
            - string
            - 'null'
          description: |-
            ID of the payout request if applicable.
            The created transaction is based on the properties of this payout request.
          maxLength: 50
          example: pout_req_0YVDMDE2BMC6KBB5MX76RF6T80
        _links:
          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
                  - attachments
                  - website
                  - customer
                  - gatewayAccount
                  - paymentCard
                  - parentTransaction
                  - leadSource
                  - approvalUrl
                  - refundUrl
                  - updateUrl
                  - disputes
                  - invoices
                  - queryUrl
                  - redirectUrl
        _embedded:
          type: object
          description: Embedded objects that are requested by the `expand` query parameter.
          readOnly: true
          properties:
            parentTransaction:
              type: object
            childTransactions:
              type: array
              maxItems: 10
              description: Most recent child transactions.
            gatewayAccount:
              type: object
            customer:
              type: object
            leadSource:
              type: object
            website:
              type: object
            invoices:
              type: array
              maxItems: 10
              description: Most recent related invoices.
            organization:
              type: object
            dispute:
              type: object
            paymentCard:
              type: object
            bankAccount:
              type: object
    InvoiceRetryScheduleInstruction:
      type: object
      description: Specifies when the payment retry instruction is performed.
      discriminator:
        propertyName: method
        mapping:
          date-interval: '#/components/schemas/SchedulingMethodDateInterval'
          day-of-month: '#/components/schemas/SchedulingMethodDayOfMonth'
          day-of-week: '#/components/schemas/SchedulingMethodDayOfWeek'
          immediately: '#/components/schemas/SchedulingMethodImmediately'
          intelligent: '#/components/schemas/SchedulingMethodIntelligent'
      oneOf:
        - $ref: '#/components/schemas/SchedulingMethodDateInterval'
        - $ref: '#/components/schemas/SchedulingMethodDayOfMonth'
        - $ref: '#/components/schemas/SchedulingMethodDayOfWeek'
        - $ref: '#/components/schemas/SchedulingMethodImmediately'
        - $ref: '#/components/schemas/SchedulingMethodIntelligent'
    InvoiceRetryAmountAdjustmentInstruction:
      type: object
      description: Specifies if the payment amount must be adjusted for the retry.
      discriminator:
        propertyName: method
        mapping:
          partial: '#/components/schemas/AmountAdjustmentInstructionPartial'
          none: '#/components/schemas/AmountAdjustmentInstructionNone'
      oneOf:
        - $ref: '#/components/schemas/AmountAdjustmentInstructionPartial'
        - $ref: '#/components/schemas/AmountAdjustmentInstructionNone'
    Invoice:
      required:
        - customerId
        - currency
        - websiteId
      properties:
        id:
          type: string
          description: ID of the invoice.
          readOnly: true
          maxLength: 50
          example: in_0YVF9605RKC62BP14NE2R7V2XT
        websiteId:
          $ref: '#/components/schemas/WebsiteId'
        invoiceNumber:
          description: Auto-incrementing number based on the sequence of invoices for any particular customer.
          readOnly: true
          type: integer
          x-basic: true
        orderId:
          description: ID of the order (experimental).
          readOnly: true
          example: ord_01HVKA5975PJBSQ1SX72G3MSZC
          type:
            - string
            - 'null'
        subscriptionId:
          type: string
          description: |-
            ID of the related subscription order, if available.
            This field is `null` if there are no related subscription orders.
          readOnly: true
          maxLength: 50
          example: sub_01HRF27SATGE4Z6PBJE6PD8328
        quoteId:
          type:
            - string
            - 'null'
          description: |-
            ID of the related quote, if available.
            This field is `null` if there are no related quotes.
          readOnly: true
          maxLength: 50
          example: qt_01HXBZMEGPETPHJZH6V4RHBMA8
        currency:
          x-sortable: true
          x-basic: true
          $ref: '#/components/schemas/CurrencyCode'
        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:
          description: |-
            Shipping settings of the invoice.
            The `calculator` property is `manual` when the shipping amount is provided
            and `rebilly` when the amount is calculated from shipping rates.
            If `calculator` is `manual` and an issued invoice is recalculated or its items change,
            the shipping amount is not changed, even if no invoice item requires shipping.
            If `calculator` is `manual` and no invoice item requires shipping, the shipping amount is 0 in these cases:

            - A draft invoice is issued with the [Issue an invoice](https://www.rebilly.com/catalog/all/invoices/postinvoiceissuance) operation, a renewal invoice is issued, or a scheduled draft invoice is recalculated.
            - An order is created or previewed, a quote is created, or a `pending` order is updated.
              This applies to the order invoice. The order keeps its shipping amount.

            To change the shipping amount of an issued invoice, use the [Upsert an invoice](https://www.rebilly.com/catalog/all/invoices/putinvoice) operation.
          $ref: '#/components/schemas/Shipping'
        tax:
          $ref: '#/components/schemas/Taxes'
        organizationTaxIdNumber:
          description: Organization tax ID number that is displayed on the invoice.
          type:
            - object
            - 'null'
          required:
            - type
            - value
          properties:
            type:
              type: string
              description: Type of the tax ID number.
              enum:
                - eu-vat
                - other
              example: eu-vat
            value:
              type: string
              description: Value of the tax ID number.
              example: GB980780684
        customerTaxIdNumber:
          description: Customer tax ID number that is displayed on the invoice.
          type:
            - object
            - 'null'
          required:
            - type
            - value
          properties:
            type:
              type: string
              description: Type of the tax ID number.
              enum:
                - eu-vat
                - other
              example: eu-vat
            value:
              type: string
              description: Value of the tax ID number.
              example: GB980780684
        billingAddress:
          description: |-
            Billing address of the invoice.
            After the first payment is made for an invoice, this value cannot be changed.
          $ref: '#/components/schemas/ContactObject'
        deliveryAddress:
          description: Delivery address of the invoice.
          $ref: '#/components/schemas/ContactObject'
        poNumber:
          description: Purchase order number that is displayed on the invoice.
          type:
            - string
            - 'null'
          example: PO123456
          maxLength: 50
        notes:
          description: Notes for the customer that are displayed on the invoice.
          type: string
          maxLength: 65535
        items:
          type: array
          description: Invoice items array.
          readOnly: true
          items:
            $ref: '#/components/schemas/InvoiceItem'
        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'
        autopayScheduledTime:
          description: Date and time when an automatic payment (autopay) is scheduled.
          type:
            - string
            - 'null'
          x-sortable: true
          format: date-time
        autopayRetryNumber:
          description: Number of times that an automatic payment (autopay) has been attempted on an invoice.
          readOnly: true
          type: integer
          x-sortable: true
          minimum: 0
          default: 0
        status:
          type: string
          description: Status of the invoice.
          x-basic: true
          readOnly: true
          enum:
            - draft
            - quotation
            - unpaid
            - paid
            - partially-paid
            - past-due
            - abandoned
            - voided
            - partially-refunded
            - refunded
            - disputed
        delinquentCollectionPeriod:
          type: integer
          description: Length of time, in days, between when the invoice is due and when the invoice is paid.
          x-sortable: true
          readOnly: true
        collectionPeriod:
          type: integer
          x-sortable: true
          description: Length of time, in days, between when the invoice is issued and when the invoice is paid.
          readOnly: true
        abandonedTime:
          description: Date and time when the invoice is abandoned.
          x-sortable: true
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        voidedTime:
          description: Date and time when the invoice is voided.
          x-sortable: true
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        paidTime:
          x-label: Payment Date
          x-sortable: true
          x-basic: true
          description: Date and time when the invoice is paid.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        dueTime:
          description: Date and time when the invoice is due for payment.
          type: string
          x-sortable: true
          format: date-time
        issuedTime:
          description: Date and time when the invoice is issued.
          x-label: Date Issued
          x-sortable: true
          x-basic: true
          $ref: '#/components/schemas/ServerTimestamp'
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        paymentFormUrl:
          type:
            - string
            - 'null'
          readOnly: true
          format: uri
          description: |-
            URL where the customer is redirected to pay the invoice
            using one of the methods which are available to the customer.
            This is an alternative to creating a new transaction with empty
            `methods`.
        creditMemoAllocations:
          type: array
          description: Credit memo allocations to an invoice.
          readOnly: true
          items:
            $ref: '#/components/schemas/CreditMemoInvoiceAllocation'
        isNewOrder:
          description: Specifies if the order is a new order.
          type: boolean
          readOnly: true
          example: true
        customerId:
          x-basic: true
          allOf:
            - $ref: '#/components/schemas/CustomerId'
        transactions:
          type: array
          description: |-
            Up to 10 of the most recent transactions for the invoice.
            To retrieve transactions for an invoice, use [Retrieve transactions](https://www.rebilly.com/catalog/all/transactions/gettransactioncollection) with the `invoiceIds` filter.
            Search results can lag briefly behind a write.
          maxItems: 10
          readOnly: true
          items:
            $ref: '#/components/schemas/Transaction'
        retryInstruction:
          description: |-
            Invoice payment retry instruction.
            This object specifies how to proceed if a payment related to the invoice fails.
          type:
            - object
            - 'null'
          properties:
            attempts:
              type: array
              description: Describes the retry instruction.
              minItems: 1
              items:
                type: object
                properties:
                  scheduleInstruction:
                    $ref: '#/components/schemas/InvoiceRetryScheduleInstruction'
                  amountAdjustmentInstruction:
                    $ref: '#/components/schemas/InvoiceRetryAmountAdjustmentInstruction'
                  tryBackupInstruments:
                    description: Specifies whether to use backup payment instruments on an invoice payment retry.
                    type: boolean
                    default: false
                required:
                  - scheduleInstruction
            afterAttemptPolicies:
              description: Describes the action to take when a payment attempt concludes, and payment is not collected.
              type: array
              items:
                type: string
                enum:
                  - change-subscription-renewal-time
            afterRetryEndPolicies:
              description: Describes the action to take when all scheduled payment retries, in a retry instruction, have concluded and payment is not collected.
              type: array
              items:
                type: string
                enum:
                  - abandon-invoice
                  - cancel-subscription
          required:
            - attempts
            - afterAttemptPolicies
            - afterRetryEndPolicies
        revision:
          description: |-
            Number of times the invoice data has been modified.

            Use the revision number when analyzing webhook data to
            determine if a change should take precedence over the current
            representation.
          type: integer
          readOnly: true
        type:
          description: Type of invoice.
          type: string
          enum:
            - initial
            - renewal
            - interim
            - cancellation
            - one-time
            - refund
            - charge
            - one-time-sale
          readOnly: true
        dueReminderTime:
          description: Date and time when a past due reminder event is triggered.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        dueReminderNumber:
          description: Number of past due reminder events that have been triggered.
          type:
            - integer
            - 'null'
          readOnly: true
        organizationId:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/OrganizationId'
        delinquencyTime:
          description: |-
            Date and time when the related order is considered delinquent, and is canceled.
            If this value is `null`, no delinquency time is configured.
            When the invoice `dueTime` is changed to a later date and time, `delinquencyTime` increases by the same amount.
            If `dueTime` is changed to an earlier date and time or `delinquencyTime` is `null`, `delinquencyTime` remains unchanged.
            Changing `dueTime` to an earlier date and time increases the gap between `dueTime` and `delinquencyTime`.
            This wider gap is preserved if `dueTime` subsequently changes to a later date and time.
            If the request also specifies `delinquencyTime`, the specified value takes precedence.
            If `delinquencyTime` is earlier than the invoice `dueTime`, it is set to the same value as `dueTime`.

            If an invoice is not related to an order, this field can only be `null`.
          type:
            - string
            - 'null'
          format: date-time
          default: null
        _links:
          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
                  - website
                  - customer
                  - organization
                  - attachments
                  - leadSource
                  - transactionAllocations
                  - recalculateInvoice
                  - subscription
        _embedded:
          type: object
          description: Embedded objects that are requested by the `expand` query parameter.
          readOnly: true
          properties:
            customer:
              type: object
            website:
              type: object
            organization:
              type: object
            leadSource:
              type: object
            shippingRate:
              type: object
    Subscription:
      type: object
      required:
        - orderType
        - customerId
        - websiteId
        - items
      properties:
        id:
          type: string
          description: ID of the order.
          readOnly: true
          maxLength: 50
          example: sub_01HRF27SATGE4Z6PBJE6PD8328
        orderType:
          description: |-
            Specifies the type of order.
            An order may be a subscription or a one-time purchase.

            > **Note:** The order type cannot be changed after creation.
          type: string
          x-basic: true
          enum:
            - subscription-order
        customerId:
          $ref: '#/components/schemas/CustomerId'
        renewalReminderTime:
          description: Date and time when the renewal reminder event triggers.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        renewalReminderNumber:
          description: Number of triggered renewal reminder events.
          type:
            - integer
            - 'null'
          readOnly: true
        abandonReminderTime:
          description: Date and time when the abandon order reminder event triggers.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        abandonReminderNumber:
          description: Number of abandon order reminder events that are triggered.
          type:
            - integer
            - 'null'
          readOnly: true
        organizationId:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/OrganizationId'
        status:
          description: |-
            Status of the subscription service.
            A subscription starts in the `pending` status, and becomes `active` when the service period begins.
          type: string
          readOnly: true
          enum:
            - pending
            - active
            - abandoned
            - canceled
            - churned
            - paused
            - voided
            - completed
            - trial-ended
        inTrial:
          description: Specifies if the subscription is currently in a trial period.
          type: boolean
          readOnly: true
        trial:
          type: object
          description: |-
            Details of the trial.
            To use plan defaults, omit the `trial` key or set this value to `null`.
          properties:
            enabled:
              description: |-
                Specifies if there is a trial for this order.
                Plans without trial prices are free trials.
                If the order is active, all order items are in a trial, and `isTrialOnly` is `false`, setting this value to `false` ends the trial immediately.
                If the request that sets this value to `false` also changes `renewalTime`, the order renews at that time.
                If the request does not change `renewalTime`, the order renews immediately.
                In the response, this field remains `true`, and `endTime` contains the date and time when the trial ended.
                If only some items of an active order are in a trial, changing this value from `true` to `false` returns a 409 error.
              type: boolean
            endTime:
              description: |-
                Time and date when the trial ends.
                If the order churns during the trial, this value is the time when the order churned.
                If a trial is enabled on this subscription, a value must be provided.

                If the specified trial end time is in the past, the current time is used.
              type:
                - string
                - 'null'
              format: date-time
        isTrialOnly:
          description: |-
            Specifies if a subscription ends after a trial period.
            If this value is `true`, recurring settings are ignored.
          type: boolean
          default: false
        trialConversionTime:
          description: |-
            Date and time when the subscription had a trial conversion.
            Trial conversion occurs when the first successful payment is made after a trial period.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        invoiceTimeShift:
          description: |-
            Shifts issue time and due time of invoices for this subscription.

            This setting overrides plan settings.
            To use plan settings, set this value to `null`.

            To use multiple plans in one subscription,
            all plans must have the same billing period,
            this property enables the customer to subscribe to different plans.
          $ref: '#/components/schemas/InvoiceTimeShift'
        autopay:
          description: |-
            Specifies if payment attempts are made automatically.
            If autopay is enabled, the payment is retrieved from the customer on the renewal date using the payment instrument that is set at `paymentInstrumentId`,
            or the default payment instrument on the subscription.
          type: boolean
          default: true
        startTime:
          description: |-
            Date and time when the subscription starts.
            If this value is `null`, the current time is used.
            This value cannot be more than one service period in the past.
          type:
            - string
            - 'null'
          x-sortable: true
          x-basic: true
          example: null
          default: null
          format: date-time
        churnTime:
          description: Date and time when the subscription is deactivated.
          x-sortable: true
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        renewalTime:
          description: |-
            Date and time when the subscription renews.
            If the order has no trial, the first service period ends at the date and time specified in the request that creates the order.
            If the order has a trial, the specified date and time are ignored, and the subscription renews when the trial ends.
            If the order is in a trial, the date and time specified in a request that updates the order are ignored, unless that request also sets `trial.enabled` to `false`.
          type:
            - string
            - 'null'
          x-sortable: true
          x-basic: true
          format: date-time
        currentPeriodStart:
          description: Date and time of the current service period start.
          type: string
          format: date-time
          readOnly: true
        currentPeriodEnd:
          description: Date and time of the current service period end.
          type: string
          format: date-time
          readOnly: true
        rebillNumber:
          description: Current billing period number.
          type:
            - integer
            - 'null'
          readOnly: true
          x-sortable: true
        lineItems:
          description: Subscription line items which queue until the next renewal, or interim, invoice is issued for the subscription.
          readOnly: true
          type: array
          deprecated: true
          items:
            type: object
            description: |-
              Invoice line item.
              Use the `isInterim` property of upcoming invoice items instead.
            deprecated: true
            properties:
              type:
                description: Type of invoice line item.
                type: string
                enum:
                  - debit
                  - credit
              description:
                description: Description of the line item.
                type: string
                maxLength: 1000
              unitPriceAmount:
                description: Unit price of the line item.
                type: number
                format: double
                example: 49.95
              unitPriceCurrency:
                $ref: '#/components/schemas/CurrencyCode'
              quantity:
                description: Quantity of the line item.
                type: integer
                example: 1
              periodStartTime:
                description: Date and time when the service period begins for this item.
                type: string
                format: date-time
              periodEndTime:
                description: Date and time when the service period ends for this item.
                type: string
                format: date-time
              createdTime:
                $ref: '#/components/schemas/CreatedTime'
              updatedTime:
                $ref: '#/components/schemas/UpdatedTime'
        lineItemSubtotal:
          type: object
          readOnly: true
          deprecated: true
          description: |-
            Subtotal of line items in this subscription (signed value).
            If credits exceed debits, this value is a negative number.
          properties:
            currency:
              $ref: '#/components/schemas/CurrencyCode'
            amount:
              type: number
              x-type: Money
              x-sortable: true
              description: Amount of the subtotal.
              format: double
              example: 49.95
        mrr:
          description: Monthly recurring revenue of the order.
          type: number
          x-type: Money
          x-sortable: true
          format: double
          readOnly: true
          example: 49.95
        paymentInstrumentId:
          type:
            - string
            - 'null'
          description: |-
            ID of the payment instrument to use for autopay.
            If this value is not provided, or if the payment instrument is inactive,
            the customer's default payment instrument is used.
          maxLength: 50
          example: inst_0YVB8KPKNXCBR9EDX7JHSED75N
        billingStatus:
          description: |-
            Billing status of the most recent invoice.
            This value is used to determine whether to change the service status of the service,
            such as suspending the service.
          type: string
          readOnly: true
          enum:
            - draft
            - unpaid
            - past-due
            - abandoned
            - paid
            - voided
            - refunded
            - disputed
            - partially-refunded
            - partially-paid
        websiteId:
          type: string
          description: |-
            ID of the website.
            A website is where an organization obtains a customer.
            For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).

            > **Note:** The ID of the website cannot be changed after creation.
          maxLength: 50
          example: web_0YV7DE4Z26DQSA1AC92FBJ7SEG
          x-sortable: true
          x-basic: true
        currency:
          description: Currency of the order.
          readOnly: true
          $ref: '#/components/schemas/CurrencyCode'
        initialInvoiceId:
          description: ID of the initial invoice.
          readOnly: true
          type:
            - string
            - 'null'
          maxLength: 50
          example: in_0YVF9605RKC62BP14NE2R7V2XT
        recentInvoiceId:
          description: |-
            ID of the most recently issued invoice.
            The invoice might not be `paid` yet.
          readOnly: true
          type:
            - string
            - 'null'
          maxLength: 50
          example: in_0YVF9605RKC62BP14NE2R7V2XT
        items:
          description: Details of items in the order.
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/SubscriptionOrOneTimeSaleItem'
        deliveryAddress:
          description: |-
            Delivery address of the order.
            Changes to the delivery address apply to the upcoming invoice and to invoices created after the change.
            Issued invoices are not updated unless the order is `pending`.
            To change the delivery address on an unpaid, past-due, or partially paid invoice, use the [upsert an invoice API operation](https://www.rebilly.com/catalog/all/invoices/putinvoice#invoices/putinvoice/t=request&path=deliveryaddress).
          oneOf:
            - $ref: '#/components/schemas/ContactObject'
            - type: 'null'
        billingAddress:
          description: |-
            Billing address of the order.
            Changes to the billing address apply to the upcoming invoice and to invoices created after the change.
            Issued invoices are not updated unless the order is `pending`.
            To change the billing address on an issued invoice that has no payment attempts or applied credits, use the [upsert an invoice API operation](https://www.rebilly.com/catalog/all/invoices/putinvoice#invoices/putinvoice/t=request&path=billingaddress).
          oneOf:
            - $ref: '#/components/schemas/ContactObject'
            - type: 'null'
        activationTime:
          description: Date and time when the order is activated.
          x-sortable: true
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        voidTime:
          description: Date and time when the order is voided.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        abandonTime:
          type:
            - string
            - 'null'
          description: |-
            Date and time when the pending order is automatically abandoned.
            If this value is not passed during order creation,
            a [pending order TTL](https://www.rebilly.com/catalog/all/organizations/patchorganization#organizations/patchorganization/t=request&path=settings/billing/pendingorderttl) setting is used to calculate the value.
          format: date-time
        delinquencyPeriod:
          type:
            - string
            - 'null'
          description: |-
            Length of time, in ISO-8601 durations format,
            which is added to the due time of the order when setting the delinquency time for all related invoices.
            When the delinquency time of an invoice is reached, the order is automatically canceled.

            - If the `delinquencyPeriod` value is `null`, the order does not change state and remains active.
              You must explicitly configure the delinquency period to enable automatic cancellation of unpaid orders.
            - If you add a delinquency period to an active order, it is applied to all new invoices created for the order. It is not applied to the unpaid and past-due invoices. To apply a delinquency period to unpaid and past-due invoices, set the `delinquencyTime` parameter using the [upsert an invoice API operation](https://www.rebilly.com/catalog/all/invoices/putinvoice#invoices/putinvoice/t=request&path=delinquencytime).

            If this value is not passed during order creation,
            an [order delinquency period](https://www.rebilly.com/catalog/all/organizations/patchorganization#organizations/patchorganization/t=request&path=settings/billing/orderdelinquencyperiod) setting is used to calculate the value.
          example: P7D
          default: null
        couponIds:
          type:
            - array
            - 'null'
          description: |-
            List of coupons to redeem on the customer and restrict to this order.

            For more information, see [Coupons](https://www.rebilly.com/docs/settings/coupons-and-discounts/).

            This parameter uses the following logic:

            - If this parameter is not supplied, applied coupons are not changed.
            - If an empty array is supplied, all applied coupon redemptions are canceled.
            - If a list of coupons is supplied, unapplied coupons in the list are applied.
              Coupons that have already been applied do not change state.
              Applied coupons that are not supplied in list are canceled.

            If the list of applied coupons on a pending order is changed by this parameter during an order update, the invoice for the order is reissued.
          writeOnly: true
          items:
            type: string
            description: ID of the coupon.
        poNumber:
          description: Purchase order number displayed on the issued invoices.
          type:
            - string
            - 'null'
          example: PO123456
        sandboxRetention:
          $ref: '#/components/schemas/SandboxRetention'
        shipping:
          description: |-
            Shipping settings of the order.
            Changes to shipping apply to the upcoming invoice and to invoices created after the change.
            Issued invoices are not updated unless the order is `pending`.
            To change shipping on an unpaid, past-due, or partially paid invoice, use the [upsert an invoice API operation](https://www.rebilly.com/catalog/all/invoices/putinvoice#invoices/putinvoice/t=request&path=shipping).
          $ref: '#/components/schemas/Shipping'
        notes:
          description: Notes for the customer displayed on the order invoice.
          type: string
        canceledTime:
          description: Date and time when a subscription is canceled.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        canceledBy:
          description: Specifies who initiated the cancellation.
          type:
            - string
            - 'null'
          readOnly: true
          enum:
            - merchant
            - customer
            - rebilly
            - null
        cancelCategory:
          description: |-
            Category of the cancellation.

            The `sandbox-retention` value is set only in the sandbox environment when a recurring order is canceled 90 days after creation.
          type:
            - string
            - 'null'
          readOnly: true
          enum:
            - billing-failure
            - delinquency
            - did-not-use
            - did-not-want
            - missing-features
            - bugs-or-problems
            - do-not-remember
            - risk-warning
            - contract-expired
            - too-expensive
            - never-started
            - switched-plan
            - organization-deactivated
            - sandbox-retention
            - other
            - null
        cancelDescription:
          description: Description of the cancellation reason in free form.
          type:
            - string
            - 'null'
          readOnly: true
          maxLength: 255
        revision:
          description: |-
            Number of times the order data has been modified.

            The revision is useful when analyzing webhook data to determine if the
            change takes precedence over the current representation.
          type: integer
          readOnly: true
        riskMetadata:
          description: |-
            Risk metadata.
            If this value is `null`, this field uses risk metadata that is captured when creating the payment token.
          oneOf:
            - $ref: '#/components/schemas/RiskMetadata'
            - type: 'null'
        billingPortalToken:
          description: |-
            Customer JWT to access a billing portal.
            This field is presented only if a billing portal exists.
            This is an experimental field and can be changed or removed in the future.
          type:
            - string
            - 'null'
          readOnly: true
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          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
                  - website
                  - customer
                  - initialInvoice
                  - recentInvoice
                  - approvalUrl
                  - attachments
                  - leadSource
        _embedded:
          type: object
          description: Embedded objects that are requested by the `expand` query parameter.
          readOnly: true
          properties:
            recentInvoice:
              type: object
            initialInvoice:
              type: object
            customer:
              type: object
            website:
              type: object
            leadSource:
              type: object
            shippingRate:
              type: object
            paymentInstrument:
              type: object
            upcomingInvoice:
              type: object
    OneTimeSale:
      type: object
      required:
        - orderType
        - customerId
        - websiteId
        - items
      properties:
        id:
          type: string
          description: ID of the one-time sale.
          readOnly: true
          maxLength: 50
          example: ots_01HRF27SATGE4Z6PBJE6PD8328
        orderType:
          description: |-
            Specifies the type of order.
            An order may be a subscription or a one-time purchase.
          type: string
          x-basic: true
          enum:
            - one-time-order
        customerId:
          $ref: '#/components/schemas/CustomerId'
        organizationId:
          deprecated: true
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/OrganizationId'
        status:
          description: Status of the one-time order.
          type: string
          readOnly: true
          enum:
            - pending
            - abandoned
            - completed
            - canceled
        billingStatus:
          description: |-
            Billing status of the most recent invoice.
            This value is used to determine whether to change the service status of the service,
            such as suspending the service.
          type: string
          readOnly: true
          enum:
            - draft
            - unpaid
            - past-due
            - abandoned
            - paid
            - voided
            - refunded
            - disputed
            - partially-refunded
            - partially-paid
        websiteId:
          x-sortable: true
          x-basic: true
          allOf:
            - $ref: '#/components/schemas/WebsiteId'
        currency:
          description: Currency of the order.
          readOnly: true
          $ref: '#/components/schemas/CurrencyCode'
        initialInvoiceId:
          description: ID of the initial invoice (`null` for one-time orders).
          readOnly: true
          type:
            - string
            - 'null'
          maxLength: 50
          example: in_0YVF9605RKC62BP14NE2R7V2XT
        recentInvoiceId:
          description: |-
            ID of the most recently issued invoice.
            The invoice might not be `paid` yet.
          readOnly: true
          type:
            - string
            - 'null'
          maxLength: 50
          example: in_0YVF9605RKC62BP14NE2R7V2XT
        items:
          description: Details of items in the order.
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/SubscriptionOrOneTimeSaleItem'
        deliveryAddress:
          description: Delivery address of the order.
          oneOf:
            - $ref: '#/components/schemas/ContactObject'
            - type: 'null'
        billingAddress:
          description: Billing address of the order.
          oneOf:
            - $ref: '#/components/schemas/ContactObject'
            - type: 'null'
        activationTime:
          description: Date and time when the order is activated.
          x-sortable: true
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        voidTime:
          description: Date and time when the order is voided.
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
        abandonTime:
          type:
            - string
            - 'null'
          description: |-
            Date and time when the pending order is automatically abandoned.
            If this value is not passed during order creation,
            a [pending order TTL](https://www.rebilly.com/catalog/all/organizations/patchorganization#organizations/patchorganization/t=request&path=settings/billing/pendingorderttl) setting is used to calculate the value.
          format: date-time
        couponIds:
          type:
            - array
            - 'null'
          description: |-
            List of coupons to redeem on the customer and restrict to this order.

            For more information, see [Coupons](https://www.rebilly.com/docs/settings/coupons-and-discounts/).

            This parameter uses the following logic:

            - If this parameter is not supplied, applied coupons are not changed.
            - If an empty array is supplied, all applied coupon redemptions are canceled.
            - If a list of coupons is supplied, unapplied coupons in the list are applied.
              Coupons that have already been applied do not change state.
              Applied coupons that are not supplied in list are canceled.

            If the list of applied coupons on a pending order is changed by this parameter during an order update, the invoice for the order is reissued.
          writeOnly: true
          items:
            type: string
            description: ID of the coupon.
        poNumber:
          description: Purchase order number displayed on the issued invoices.
          type:
            - string
            - 'null'
          example: PO123456
        shipping:
          $ref: '#/components/schemas/Shipping'
        notes:
          description: Notes for the customer displayed on the order invoice.
          type: string
        revision:
          description: |-
            Number of times the order data has been modified.

            The revision is useful when analyzing webhook data to determine if the
            change takes precedence over the current representation.
          type: integer
          readOnly: true
        riskMetadata:
          description: |-
            Risk metadata.
            If this value is `null`, this field uses risk metadata that is captured when creating the payment token.
          oneOf:
            - $ref: '#/components/schemas/RiskMetadata'
            - type: 'null'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        createdTime:
          $ref: '#/components/schemas/CreatedTime'
        updatedTime:
          $ref: '#/components/schemas/UpdatedTime'
        _links:
          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
                  - website
                  - customer
                  - initialInvoice
                  - recentInvoice
                  - approvalUrl
                  - attachments
                  - leadSource
        _embedded:
          type: object
          description: Embedded objects that are requested by the `expand` query parameter.
          readOnly: true
          properties:
            recentInvoice:
              type: object
            customer:
              type: object
            website:
              type: object
            leadSource:
              type: object
            shippingRate:
              type: object
            paymentInstrument:
              type: object
    SubscriptionOrOneTimeSale:
      type: object
      description: Subscription details.
      discriminator:
        propertyName: orderType
        mapping:
          subscription-order: '#/components/schemas/Subscription'
          one-time-order: '#/components/schemas/OneTimeSale'
      oneOf:
        - $ref: '#/components/schemas/Subscription'
        - $ref: '#/components/schemas/OneTimeSale'
  requestBodies:
    RenewalInvoiceIssued:
      content:
        application/json:
          schema:
            properties:
              subscriptionId:
                type: string
                description: ID of the order.
                example: sub_01HRF27SATGE4Z6PBJE6PD8328
              invoiceId:
                type: string
                description: ID of the invoice.
                maxLength: 50
                example: in_0YVF9605RKC62BP14NE2R7V2XT
              eventType:
                type: string
                description: Type of event that triggered the webhook.
                enum:
                  - renewal-invoice-issued
              _embedded:
                type: object
                description: Embedded objects related to the renewal invoice event.
                properties:
                  subscription:
                    $ref: '#/components/schemas/SubscriptionOrOneTimeSale'
                  invoice:
                    $ref: '#/components/schemas/Invoice'
              _links:
                type: array
                description: Links to related resources.
                items:
                  type: object
                  properties:
                    href:
                      description: URL of the link.
                      type: string
                    rel:
                      description: Relationship type of the link.
                      type: string
                      enum:
                        - subscription
                        - invoice
      description: Payload of renewal invoice-related webhook event.
```
