# Create an invoice

`POST /invoices`

> This is a subset of the full specification, limited to the `POST /invoices` 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 /invoices` 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: Invoices
    description: |-
      Use invoices to bill for the goods or services that you provide.
      If your invoice includes subscription items, it also includes the corresponding service periods and prices.
x-tagGroups:
  - name: Orders & Invoices
    tags:
      - Invoices
paths:
  /invoices:
    post:
      x-products:
        - Core
      tags:
        - Invoices
      summary: Create an invoice
      operationId: PostInvoice
      x-sdk-operation-name: create
      description: Creates an invoice.
      requestBody:
        $ref: '#/components/requestBodies/Invoice'
      responses:
        '201':
          description: Invoice created.
          headers:
            Location:
              $ref: '#/components/headers/Location'
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      x-codeSamples:
        - lang: PHP
          label: PHP-SDK-2.0
          source: |
            $invoiceForm = new Rebilly\Entities\Invoice();
            $invoiceForm->setCustomerId('customerId');
            $invoiceForm->setWebsiteId('websiteId');
            $invoiceForm->setCurrency('USD');
            $invoiceForm->setBillingAddress([
                'firstName' => 'John',
                'lastName' => 'Doe',
                'organization' => 'Test LTD',
                'address' => 'Test street 5',
                'address2' => 'Test house 5',
                'city' => 'New York',
                'region' => 'Long Island',
                'country' => 'US',
                'postalCode' => '123456',
                'emails' => [
                    [
                        'label' => 'main',
                        'value' => 'johndoe@testemail.com',
                        'primary' => true,
                    ],
                    [
                        'label' => 'secondary',
                        'value' => 'otheremail@testemail.com',
                    ],
                ],
                'phoneNumbers' => [
                    [
                        'label' => 'work',
                        'value' => '+123456789',
                        'primary' => true,
                    ],
                    [
                        'label' => 'home',
                        'value' => '+9874654321',
                    ],
                ],
            ]);

            try {
                $invoice = $client->invoices()->create($invoiceForm);
            } catch (Rebilly\Http\Exception\DataValidationException $e) {
                print_r($e->getValidationErrors());
            }
        - lang: JavaScript
          source: |-
            // first set the properties for the new invoice
            const data = {
                customerId: 'foobar-0001',
                websiteId: 'my-main-website',
                currency: 'USD',
                billingAddress: {
                    firstName: 'Johnny',
                    lastName: 'Brown',
                    emails: [{
                        label: 'main',
                        value: 'johnny+test@grr.la',
                        primary: true
                    }],
                },
                deliveryAddress: {
                    firstName: 'Johnny',
                    lastName: 'Brown',
                    emails: [{
                        label: 'main',
                        value: 'johnny+test@grr.la',
                        primary: true
                    }],
                },
                notes: `customer's first invoice`,
            };

            // the ID is optional
            const firstInvoice = await api.invoices.create({data});

            // or you can provide one
            const secondInvoice = await api.invoices.create({id: 'my-second-id', data});
        - lang: PHP
          source: |-
            $service = new \Rebilly\Sdk\Service($client);

            $invoice = \Rebilly\Sdk\Model\Invoice::from()
                ->setCustomerId('customerId')
                ->setWebsiteId('websiteId')
                ->setCurrency('USD')
                ->setBillingAddress([
                    'firstName' => 'John',
                    'lastName' => 'Doe',
                    'organization' => 'Test LTD',
                    'address' => 'Test street 5',
                    'address2' => 'Test house 5',
                    'city' => 'New York',
                    'region' => 'Long Island',
                    'country' => 'US',
                    'postalCode' => '123456',
                    'emails' => [
                        [
                            'label' => 'main',
                            'value' => 'johndoe@testemail.com',
                            'primary' => true,
                        ],
                        [
                            'label' => 'secondary',
                            'value' => 'otheremail@testemail.com',
                        ],
                    ],
                    'phoneNumbers' => [
                        [
                            'label' => 'work',
                            'value' => '+123456789',
                            'primary' => true,
                        ],
                        [
                            'label' => 'home',
                            'value' => '+9874654321',
                        ],
                    ],
                ]);

            try {
                $invoice = $service->invoices()->create($invoice);
            } catch (\Rebilly\Sdk\Exception\DataValidationException $e) {
                print_r($e->getValidationErrors());
            }
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
  headers:
    Location:
      description: Location of the related resource.
      schema:
        type: string
        format: uri
      example: https://api.rebilly.com/example
    Rate-Limit-Limit:
      description: |-
        Maximum number of requests available at one time for this rate limit.
        For more information, see [Rate limits](#section/Rate-limits).
      schema:
        type: integer
      example: 500
    Rate-Limit-Remaining:
      description: |-
        Number of requests still available for this rate limit.
        For more information, see [Rate limits](#section/Rate-limits).
      schema:
        type: integer
      example: 499
    Rate-Limit-Retry-After:
      description: Number of seconds to wait before retrying the request.
      schema:
        type: integer
      example: 1
  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
    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'
    InvalidFields:
      type: array
      description: Invalid field details.
      items:
        type: object
        properties:
          field:
            type: string
            description: |-
              Name of the field.
              Dot notation is used for nested object field names.
          message:
            description: Message field.
            type: string
      example:
        - field: field1
          message: field1 is invalid
        - field: subObject.field2
          message: field2 is invalid
        - field: subObject.field2
          message: another error in the field2
    ValidationError:
      allOf:
        - title: Validation error
        - type: object
          properties:
            status:
              type: integer
              description: HTTP status code.
              minimum: 422
              maximum: 422
        - $ref: '#/components/schemas/BaseProblem'
        - type: object
          properties:
            invalidFields:
              $ref: '#/components/schemas/InvalidFields'
    TooManyRequests:
      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
          example: about:blank
        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.
          example: Rate Limit Exceeded
        status:
          type: integer
          description: HTTP status code.
          minimum: 429
          maximum: 429
        detail:
          type: string
          description: Human-readable explanation that is specific to this occurrence of the problem.
          example: A request cannot be executed because the user has sent too many requests within a certain period of time
        instance:
          type: string
          description: |-
            URI reference that identifies the specific occurrence of the problem.
            It may or may not yield further information if dereferenced.
    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
    PaymentMethod:
      type: string
      description: Payment method.
      enum:
        - payment-card
        - ach
        - cash
        - check
        - paypal
        - AdvCash
        - Aera
        - Affirm
        - Afterpay
        - Aircash
        - Airpay
        - Alfa-click
        - Alipay
        - AmazonPay
        - Apple Pay
        - AstroPay Card
        - AstroPay-GO
        - BankSEND
        - BankReferenced
        - bank-transfer
        - bank-transfer-2
        - bank-transfer-3
        - bank-transfer-4
        - bank-transfer-5
        - bank-transfer-6
        - bank-transfer-7
        - bank-transfer-8
        - bank-transfer-9
        - Baloto
        - Beeline
        - Belfius-direct-net
        - bitcoin
        - Bizum
        - Blik
        - Boleto
        - Boleto-2
        - Boleto-3
        - cash-deposit
        - CASHlib
        - CashToCode
        - CCAvenue
        - China UnionPay
        - Clearpay
        - Cleo
        - CODVoucher
        - Commas-Checkout
        - Conekta-oxxo
        - Conekta-spei
        - cryptocurrency
        - Cupon-de-pagos
        - CyberSource
        - Dimoco-pay-smart
        - Directa24Card
        - domestic-cards
        - Efecty
        - echeck
        - ecoPayz
        - ecoPayzTurkey
        - ecoVoucher
        - EPS
        - ePay.bg
        - Ethereum
        - e-wallet
        - ezyEFT
        - eZeeWallet
        - FasterPay
        - Flexepin
        - Fyntra-Checkout
        - Giropay
        - Google Pay
        - Gpaysafe
        - iCashOne Voucher
        - iDebit
        - iDEAL
        - ING-homepay
        - INOVAPAY-pin
        - INOVAPAY-wallet
        - InstaDebit
        - InstantPayments
        - instant-bank-transfer
        - Interac-online
        - Interac-eTransfer
        - Interac-express-connect
        - Interac
        - invoice
        - iWallet
        - Jeton
        - JetonCash
        - jpay
        - KakaoPay
        - Khelocard
        - Klarna
        - KNOT
        - Litecoin
        - loonie
        - LPG-online
        - LPG-payment-card
        - Matrix
        - MaxiCash
        - Megafon
        - MercadoPago
        - MiFinity-eWallet
        - miscellaneous
        - MobilePay
        - Mollie
        - Multibanco
        - Bancontact
        - Bancontact-mobile
        - MTS
        - MuchBetter
        - MuchBetterVoucher
        - MyFatoorah
        - Neosurf
        - Netbanking
        - Neteller
        - Nordea-Solo
        - NordikCoin
        - OchaPay
        - online-bank-transfer
        - Onlineueberweisen
        - oriental-wallet
        - OXXO
        - P24
        - Pagadito
        - PagoEffectivo
        - Pagsmile-lottery
        - Pagsmile-deposit-express
        - PayCash
        - Payco
        - Payeer
        - PaymentAsia-crypto
        - Paysafecard
        - PayTabs
        - Pay4Fun
        - Paynote
        - Paymero
        - Paymero-QR
        - PayU
        - PayULatam
        - Perfect-money
        - Piastrix
        - PIX
        - PIX-Automatico
        - PinPay
        - phone
        - PhonePe
        - POLi
        - PostFinance-card
        - PostFinance-e-finance
        - QIWI
        - QPay
        - QQPay
        - Quickpay
        - rapyd-checkout
        - rebilly-hosted-payment-form
        - Resurs
        - reverse-withdrawal
        - Ripple
        - SafetyPay
        - Samsung Pay
        - SEPA
        - Siirto
        - Skrill
        - Skrill Rapid Transfer
        - SMSVoucher
        - Sofort
        - SparkPay
        - SPEI
        - swift-dbt
        - Tele2
        - Telr
        - Terminaly-RF
        - Tether
        - Thunes-Checkout
        - ToditoCash-card
        - Trustly
        - Tupay
        - TWINT
        - UniCrypt
        - UPayCard
        - UPI
        - USD-coin
        - VCreditos
        - VegaWallet
        - VenusPoint
        - Viva
        - voucher
        - voucher-2
        - voucher-3
        - voucher-4
        - Wallet88
        - Webmoney
        - Webpay
        - Webpay-2
        - Webpay Card
        - WeChat Pay
        - XPay-P2P
        - XPay-QR
        - Yandex-money
        - Zotapay
        - Zimpler
        - Zip
    ResourceCustomFields:
      description: |-
        Use custom fields to extend a resource scheme to include custom data that is not provided as a common field.
        For more information, see [Custom fields](https://www.rebilly.com/catalog/all/custom-fields).
      type: object
      default: {}
      example:
        foo: bar
    ContactPhoneNumbers:
      description: List of phone numbers associated with the contact.
      type: array
      items:
        type: object
        required:
          - label
          - value
        properties:
          label:
            description: Phone number label or name.
            type: string
            maxLength: 45
            example: main
          value:
            description: Phone number value.
            type: string
            minLength: 1
            maxLength: 50
            example: 1-512-777-0269
          primary:
            description: Specifies if the phone number is the contact's primary phone number.
            type: boolean
            example: true
    ContactEmails:
      description: List of email addresses associated with the contact.
      type: array
      items:
        type: object
        required:
          - label
          - value
        properties:
          label:
            description: Email label or name.
            type: string
            maxLength: 45
            example: main
          value:
            description: Email address value.
            type: string
            format: email
            maxLength: 255
            example: rebilly@example.com
          primary:
            description: Specifies if the email address is the contact's primary email address.
            type: boolean
            example: true
    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
    TransactionId:
      type: string
      description: ID of the transaction.
      maxLength: 50
      example: txn_0YVDTQJ8YWDGQACV2N2N5SPWQ0
    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'
    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'
    GatewayName:
      description: Payment gateway name.
      type:
        - string
        - 'null'
      enum:
        - A1Gateway
        - ACI
        - Adyen
        - Aera
        - Aircash
        - Airpay
        - Airwallex
        - AsiaPay
        - AmazonPay
        - AmexVPC
        - Antom
        - ApcoPay
        - AsiaPaymentGateway
        - AstroPayCard
        - AuthorizeNet
        - Awepay
        - Bambora
        - BankSEND
        - BitPay
        - BlueSnap
        - BoomFi
        - BraintreePayments
        - Buckaroo
        - BVNK
        - Cardknox
        - Cashflows
        - CASHlib
        - Cashterminal
        - CashToCode
        - CauriPayment
        - Cayan
        - CCAvenue
        - Chase
        - CheckoutCom
        - Chillstock
        - Circle
        - Citadel
        - Clearhaus
        - Cleo
        - CODVoucher
        - Coinbase
        - CoinGate
        - CoinPayments
        - Commas
        - Conekta
        - Coppr
        - Cps
        - Credorax
        - Cryptomus
        - Cryptonator
        - CyberSource
        - DataCash
        - Dengi
        - Dimoco
        - Directa24
        - dLocal
        - Dragonphoenix
        - Dropayment
        - EasyPayDirect
        - EBANX
        - ecoPayz
        - ecoPayzTurkey
        - EcorePay
        - Elavon
        - Euteller
        - eMerchantPay
        - EMS
        - ePay
        - EPG
        - EPro
        - Ezeebill
        - eZeeWallet
        - ezyEFT
        - FasterPay
        - Finrax
        - Flexepin
        - FinTecSystems
        - FundSend
        - Forte
        - Fyntra
        - gate2way
        - GET
        - Gigadat
        - GlobalOnePay
        - GoCardless
        - Gooney
        - Gpaysafe
        - Greenbox
        - HiPay
        - iCashOne
        - iCanPay
        - ICEPAY
        - iCheque
        - iDebit
        - Ilixium
        - IMerchant
        - Ingenico
        - INOVAPAY
        - Inovio
        - Intuit
        - InstaDebit
        - IpayOptions
        - Isx
        - JetPay
        - Jeton
        - JPMOrbital
        - Khelocard
        - Klarna
        - Konnektive
        - Kushki
        - LaCore
        - Limepay
        - Loonio
        - loonie
        - LPG
        - MaxiCash
        - MercadoPago
        - MiFinity
        - Mollie
        - MobilePay
        - Moneris
        - Monolo
        - MonRem
        - MtaPay
        - MuchBetter
        - MuchBetterGateway
        - MyFatoorah
        - Naewe
        - Neosurf
        - Netbanking
        - Neteller
        - NGenius
        - NinjaWallet
        - NMI
        - NordikCoin
        - NOWPayments
        - NuaPay
        - OchaPay
        - OmniMatrix
        - Onlineueberweisen
        - OnRamp
        - Orbital
        - Pagadito
        - Pagsmile
        - Panamerican
        - ParamountCommerce
        - ParamountEft
        - ParamountInterac
        - PandaGateway
        - Pay4Fun
        - Paybilt
        - PayCash
        - Paycly
        - PayClub
        - PayCom
        - PayEcards
        - Payeezy
        - Payflow
        - PayGlocal
        - Paynote
        - PaymentAsia
        - PaymenTechnologies
        - PaymentsOS
        - Paymero
        - PayPal
        - Payper
        - Payr
        - PayRedeem
        - PayRetailers
        - Paysafe
        - Paysafecard
        - Paysafecash
        - PayTabs
        - PayU
        - PayULatam
        - Payvision
        - PayXpert
        - PharosPayments
        - Piastrix
        - Pin4Pay
        - Plugnpay
        - PostFinance
        - Powertranz
        - PPRO
        - Prosa
        - PSiGate
        - Quickpay
        - Rapyd
        - Realex
        - Realtime
        - Redsys
        - Rotessa
        - RPN
        - Safecharge
        - SaltarPay
        - Sagepay
        - SeamlessChex
        - SecureTrading
        - SecurionPay
        - Skrill
        - SmartInvoice
        - SMSVoucher
        - Sofort
        - SparkPay
        - Splitit
        - StaticGateway
        - STPMexico
        - Stripe
        - Tabby
        - Telr
        - TestProcessor
        - Thunes
        - ToditoCash
        - Triple000
        - Truevo
        - TrustsPay
        - Trustly
        - TWINT
        - Txn
        - Unlimit
        - UPayCard
        - USAePay
        - VantivLitle
        - vegaaH
        - VCreditos
        - VegaWallet
        - Viva
        - Wallet88
        - Walpay
        - WesternUnion
        - Wirecard
        - WorldlineAtosFrankfurt
        - Worldpay
        - XPay
        - Zimpler
        - Zotapay
    AcquirerName:
      description: Acquirer name.
      type:
        - string
        - 'null'
      enum:
        - Adyen
        - ACI
        - Aera
        - Alipay
        - AIB
        - Aircash
        - Airpay
        - AmazonPay
        - ApcoPay
        - AsiaPaymentGateway
        - AstroPay Card
        - Awepay
        - Ipay Options
        - B+S
        - Bambora
        - BitPay
        - BoomFi
        - Bank of America
        - Bank of Moscow
        - Bank of Rebilly
        - Bank One
        - BankSEND
        - BMO Harris Bank
        - Borgun
        - BraintreePayments
        - Buckaroo
        - BVNK
        - Cardknox
        - CASHlib
        - Cashterminal
        - CashToCode
        - Catalunya Caixa
        - CCAvenue
        - Chase
        - CheckoutCom
        - Chillstock
        - ChinaUnionPay
        - CIM
        - Circle
        - Citadel
        - Clearhaus
        - Cleo
        - CODVoucher
        - Coinbase
        - CoinGate
        - CoinPayments
        - Commas
        - Conekta
        - Coppr
        - Cps
        - Credorax
        - Cryptonator
        - CyberSource
        - Dimoco
        - dLocal
        - Dragonphoenix
        - Dropayment
        - EasyPayDirect
        - EBANX
        - ecoPayz
        - EcorePay
        - Elavon
        - EMS
        - ePay
        - EPG
        - Euteller
        - Ezeebill
        - eZeeWallet
        - ezyEFT
        - Fifth Third Bank
        - Finrax
        - First Data Buypass
        - First Data Nashville
        - First Data North
        - First Data Omaha
        - FinTecSystems
        - Flexepin
        - Forte
        - FundSend
        - Fyntra
        - gate2way
        - Gigadat
        - Global East
        - Gooney
        - Gpaysafe
        - Heartland
        - HiPay
        - HSBC
        - iCashOne
        - iCanPay
        - ICEPAY
        - iCheque
        - Ilixium
        - Ingenico
        - INOVAPAY
        - Intuit
        - Isx
        - Jeton
        - JPMOrbital
        - Khelocard
        - Klarna
        - Konnektive
        - Kushki
        - Limepay
        - Loonio
        - loonie
        - LPG
        - Masapay
        - MaxiCash
        - MercadoPago
        - Merrick
        - Mission Valley Bank
        - MiFinity
        - MobilePay
        - Moneris
        - Monolo
        - MonRem
        - MuchBetter
        - MuchBetterGateway
        - MyFatoorah
        - NATWEST
        - Neosurf
        - Netbanking
        - Neteller
        - NinjaWallet
        - NMI
        - NordikCoin
        - NOWPayments
        - NuaPay
        - Nuvei
        - OchaPay
        - OmniMatrix
        - Onlineueberweisen
        - OnRamp
        - Orbital
        - Other
        - Panamerican
        - Panda Bank
        - Paramount
        - ParamountCommerce
        - ParamountEft
        - ParamountInterac
        - Pay4fun
        - Paybilt
        - PayCash
        - PayClub
        - PayEcards
        - PayGlocal
        - PaymentAsia
        - PaymenTechnologies
        - PaymentsOS
        - Paymero
        - Paynetics
        - PayPal
        - Payper
        - Payr
        - PayRedeem
        - PayRetailers
        - PayTabs
        - PayU
        - PayULatam
        - Payvision
        - PharosPayments
        - Piastrix
        - Pin4Pay
        - Peoples Trust Company
        - PostFinance
        - PPRO
        - Privatbank
        - Prosa
        - PSiGate
        - QQPay
        - Rapyd
        - RBC
        - RBS WorldPay
        - RealTime
        - Rotessa
        - Safecharge
        - SaltarPay
        - SecureTrading
        - SecurionPay
        - Skrill
        - SmartInvoice
        - SMSVoucher
        - Sofort
        - SparkPay
        - State Bank of Mauritius
        - STPMexico
        - Stripe
        - Tabby
        - TBI
        - Telr
        - TestProcessor
        - Thunes
        - ToditoCash
        - Triple000
        - Truevo
        - Trustly
        - TrustPay
        - TrustsPay
        - TSYS
        - TWINT
        - Txn
        - UPayCard
        - Vantiv
        - VCreditos
        - VegaWallet
        - VoicePay
        - Wallet88
        - WeChat Pay
        - Wells Fargo
        - Wing Hang Bank
        - Wirecard
        - WorldPay
        - XPay
        - Zimpler
        - Zotapay
    VaultedInstrument:
      title: Vaulted payment instrument
      description: |-
        Vaulted payment instrument.

        To use this payment instrument for automatic subscription renewals,
        and for transactions when no specific payment instrument is provided by the user,
        set this as the default payment instrument.
      required:
        - method
        - paymentInstrumentId
      properties:
        method:
          description: |-
            Payment method supported vault.
            For more information, see [Payment instrument](https://www.rebilly.com/catalog/all/payment-instruments).
          type: string
          enum:
            - payment-card
            - ach
            - paypal
        paymentInstrumentId:
          type: string
          description: ID of the payment instrument.
          maxLength: 50
          example: inst_0YVB8KPKNXCBR9EDX7JHSED75N
    AlternativePaymentInstrument:
      title: Alternative instrument
      description: |-
        Alternative payment method instrument.

        To use this payment instrument for automatic subscription renewals,
        and for transactions when no specific payment instrument is provided by the user,
        set this as the default payment instrument.
      type: object
      required:
        - method
      properties:
        method:
          allOf:
            - $ref: '#/components/schemas/PaymentMethod'
            - not:
                enum:
                  - payment-card
                  - ach
                  - paypal
                  - cash
                  - check
        paymentInstrumentId:
          type: string
          description: ID of the payment instrument.
          maxLength: 50
          example: inst_0YVB8KPKNXCBR9EDX7JHSED75N
        reference:
          description: |-
            Reference data.
            This field is available only for the `bank-transfer` payment method.
          type:
            - string
            - 'null'
    CashInstrument:
      title: Cash
      description: |-
        Cash payment instrument object.

        To use this payment instrument for automatic subscription renewals,
        and for transactions when no specific payment instrument is provided by the user,
        set this as the default payment instrument.
      type: object
      required:
        - method
      properties:
        method:
          type: string
          enum:
            - cash
        receivedBy:
          description: Individual or entity that received the payment.
          type: string
    CheckInstrument:
      title: Check
      description: |-
        Check payment instrument object.

        To use this payment instrument for automatic subscription renewals,
        and for transactions when no specific payment instrument is provided by the user,
        set this as the default payment instrument.
      type: object
      required:
        - method
      properties:
        method:
          type: string
          enum:
            - check
        reference:
          description: Reference data.
          type: string
    MoneyAmount:
      type: number
      format: double
      example: 10
      x-type: Money
    Money:
      type: object
      required:
        - amount
        - currency
      properties:
        amount:
          $ref: '#/components/schemas/MoneyAmount'
        currency:
          $ref: '#/components/schemas/CurrencyCode'
    RiskMetadata:
      type: object
      title: Risk metadata
      description: Risk metadata used for 3D Secure and risk scoring.
      properties:
        ipAddress:
          description: Customer's IP address.
          type:
            - string
            - 'null'
          format: ipv4 or ipv6
          example: 93.92.91.90
        fingerprint:
          description: |-
            Customer's device fingerprint.
            A device fingerprint is a unique token that is used to identify the customer.
            The device fingerprint is generated based on device attributes, such as: hardware,
            software, IP address, language, browser, and more.
          type:
            - string
            - 'null'
          maxLength: 50
          example: pIUt3xbgX3l9g3YDiLbx
        httpHeaders:
          oneOf:
            - $ref: '#/components/schemas/HttpHeaders'
            - type: 'null'
        browserData:
          type:
            - object
            - 'null'
          description: Browser data used for 3D Secure and risk scoring.
          required:
            - colorDepth
            - isJavaEnabled
            - language
            - screenWidth
            - screenHeight
            - timeZoneOffset
          properties:
            colorDepth:
              description: |-
                Browser color depth in bits per pixel.
                This value is obtained using the `screen.colorDepth` property.
              type: integer
              minimum: 1
              maximum: 48
              example: 24
            isJavaEnabled:
              description: |-
                Specifies if Java is enabled in a browser.
                This value is obtained from the `navigator.javaEnabled` property.
              type: boolean
            language:
              description: |-
                Browser language settings.
                This value is obtained from the `navigator.language` property.
              type: string
              example: en-US
              maxLength: 8
            screenWidth:
              description: |-
                Width of the browser screen.
                This value is obtained from the `screen.width` property.
              type: integer
              minimum: 0
              maximum: 65535
              example: 1920
            screenHeight:
              description: |-
                Height of the browser screen.
                This value is obtained from the `screen.height` property.
              type: integer
              minimum: 0
              maximum: 65535
              example: 1080
            timeZoneOffset:
              description: |-
                Browser time zone offset in minutes from UTC.
                A positive offset indicates that the local time is behind UTC.
                A negative offset indicates that the local time is ahead of UTC.
                You can find this value using the `(new Date()).getTimezoneOffset()` property.
              type: integer
              minimum: -1410
              maximum: 1410
              example: 300
            isAdBlockEnabled:
              description: Specifies if the usage of ad block has been detected in the browser.
              type:
                - boolean
                - 'null'
        extraData:
          type:
            - object
            - 'null'
          description: Third-party data used for risk scoring.
          properties:
            kountFraudSessionId:
              description: Alpha-numeric `fraudSessionId` as provided by the Kount SDK.
              type:
                - string
                - 'null'
              minLength: 10
              maxLength: 32
              example: abcdefg12345abababab123456789012
            payPalMerchantSessionId:
              description: PayPal `MerchantSessionID` as generated by the PayPal Fraudnet SDK.
              type:
                - string
                - 'null'
              minLength: 1
              maxLength: 64
              example: dd65ratxc5qv15iph3vyoq7l6davuowa
            threatMetrixSessionId:
              description: Temporary identifier that is unique to the visitor session and passed to ThreatMetrix.
              pattern: '[a-zA-Z0-9_-]+'
              type:
                - string
                - 'null'
              minLength: 1
              maxLength: 128
              example: dd65ratxc5qv15iph3vyoq7l6davuowadd65ratxc5qv15iph3vyoq7l6davuowa
        isProxy:
          description: Specifies if the customer's IP address is related to a proxy.
          type: boolean
          readOnly: true
        isVpn:
          description: Specifies if the customer's IP address is related to a VPN.
          type: boolean
          readOnly: true
        isTor:
          description: Specifies if the customer's IP address is related to TOR.
          type: boolean
          readOnly: true
        isHosting:
          description: Specifies if the customer's IP address is related to hosting.
          type: boolean
          readOnly: true
        hostingName:
          description: Name of the data center or hosting provider, if available.
          type:
            - string
            - 'null'
          readOnly: true
        isp:
          description: Internet Service Provider (ISP) name, if available.
          type:
            - string
            - 'null'
          readOnly: true
        country:
          description: Country ISO Alpha-2 code of the specified IP address.
          maxLength: 2
          type:
            - string
            - 'null'
          readOnly: true
          example: US
        region:
          description: Region of the specified IP address.
          type:
            - string
            - 'null'
          readOnly: true
          example: NY
        city:
          description: City of the specified IP address.
          type:
            - string
            - 'null'
          readOnly: true
          example: New York
        latitude:
          description: Latitude of the specified IP address.
          type:
            - number
            - 'null'
          format: double
          readOnly: true
        longitude:
          description: Longitude of the specified IP address.
          type:
            - number
            - 'null'
          format: double
          readOnly: true
        postalCode:
          description: Postal code of the specified IP address.
          type:
            - string
            - 'null'
          maxLength: 10
          readOnly: true
        timeZone:
          description: Time zone of the specified IP address.
          type:
            - string
            - 'null'
          readOnly: true
          example: America/New_York
        accuracyRadius:
          description: Accuracy radius of the specified IP address, in kilometers.
          type:
            - integer
            - 'null'
          readOnly: true
        distance:
          description: Distance between the customer's IP address and the billing address geolocation, in kilometers.
          type:
            - integer
            - 'null'
          readOnly: true
        hasMismatchedBillingAddressCountry:
          description: Specifies if the customer's billing address country and geo-IP address are not the same.
          type: boolean
          readOnly: true
        hasMismatchedBankCountry:
          description: Specifies if the customer's bank country and geo-IP address are not the same.
          type: boolean
          readOnly: true
        hasMismatchedTimeZone:
          description: Specifies if the customer's browser time zone and the IP address associated time zone are not the same.
          type: boolean
          readOnly: true
        hasMismatchedHolderName:
          description: Specifies if the customer's billing address name and primary address name are not the same.
          type: boolean
          readOnly: true
        hasFakeName:
          description: Specifies if the holder name seems fake.
          type: boolean
          readOnly: true
        isHighRiskCountry:
          description: Specifies if the geo-IP country, or the customer's billing country, is considered a high risk country.
          type: boolean
          readOnly: true
        paymentInstrumentVelocity:
          description: Number of transactions for this payment instrument, based on fingerprint, in the last 24 hours.
          type: integer
          readOnly: true
        declinedPaymentInstrumentVelocity:
          description: Number of declined transactions for this payment instrument fingerprint in the last 24 hours.
          type: integer
          readOnly: true
        deviceVelocity:
          description: Number of transactions for this device, based on fingerprint, in the last 24 hours.
          type: integer
          readOnly: true
        ipVelocity:
          description: Number of transactions for this IP address in the last 24 hours.
          type: integer
          readOnly: true
        emailVelocity:
          description: Number of transactions for this email address in the last 24 hours.
          type: integer
          readOnly: true
        billingAddressVelocity:
          description: Number of transactions for this billing address in the last 24 hours.
          type: integer
          readOnly: true
        paymentInstrumentApprovedTransactionCount:
          description: Number of approved transactions for this payment instrument.
          type: integer
          readOnly: true
        score:
          description: |-
            Computed risk score based on IP risk data,
            such as: `isVpn`, `isTor`, and `isProxy`.
          type: integer
          readOnly: true
    TransactionLimitAmount:
      type:
        - object
        - 'null'
      title: LimitAmount
      description: Transaction amount limit information.
      properties:
        amount:
          type: number
          format: double
          example: 275.35
          description: Limit amount.
        currency:
          $ref: '#/components/schemas/CurrencyCode'
        resetTime:
          type:
            - string
            - 'null'
          format: date-time
          description: |-
            Date and time in which the limit amount resets.
            This value may be used for user interfaces.
    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
    SchedulingMethodDayOfMonth:
      type: object
      properties:
        method:
          type: string
          enum:
            - day-of-month
        day:
          type: integer
          minimum: 1
          maximum: 31
          description: |-
            Day of the month in which the event occurs.
            If the month has less days, the last day of the month is selected.
        time:
          $ref: '#/components/schemas/TimeIso8601Extended'
      required:
        - day
        - method
    SchedulingMethodDayOfWeek:
      type: object
      properties:
        method:
          type: string
          enum:
            - day-of-week
        day:
          description: Day of the week when the event occurs.
          type: string
          enum:
            - Sunday
            - Monday
            - Tuesday
            - Wednesday
            - Thursday
            - Friday
            - Saturday
        week:
          type: string
          enum:
            - next
            - first-in-month
            - last-in-month
        time:
          $ref: '#/components/schemas/TimeIso8601Extended'
      required:
        - day
        - week
        - method
    SchedulingMethodDateInterval:
      type: object
      properties:
        method:
          type: string
          enum:
            - date-interval
        duration:
          type: integer
          description: Number of time units.
          minimum: 1
        unit:
          description: Unit of time.
          oneOf:
            - $ref: '#/components/schemas/TimeUnit'
            - $ref: '#/components/schemas/TimePluralUnit'
        anchor:
          $ref: '#/components/schemas/PeriodAnchor'
      required:
        - duration
        - unit
        - method
    SchedulingMethodImmediately:
      type: object
      required:
        - method
      properties:
        method:
          type: string
          enum:
            - immediately
    SchedulingMethodIntelligent:
      type: object
      properties:
        method:
          type: string
          enum:
            - intelligent
        duration:
          type: integer
          description: |-
            Latest point in time at which the event should occur.
            The event occurs at a random time between the initial time and duration time.
          minimum: 1
        unit:
          description: Unit of time.
          oneOf:
            - $ref: '#/components/schemas/TimeUnit'
            - $ref: '#/components/schemas/TimePluralUnit'
      required:
        - duration
        - unit
        - method
    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'
    AmountAdjustmentInstructionPartial:
      type: object
      required:
        - method
        - value
        - type
      properties:
        method:
          type: string
          enum:
            - partial
        value:
          description: Amount of the payment.
          type: number
          format: float
        type:
          description: Payment amount type.
          type: string
          enum:
            - percent
            - fixed
        afterApprovalPolicy:
          description: After an approved payment retry for an adjusted amount, this field specifies whether to discount the remaining invoice amount.
          discriminator:
            propertyName: method
            mapping:
              none: '#/components/schemas/AmountAdjustmentPoliciesNone'
              discount-amount-remaining: '#/components/schemas/AmountAdjustmentPoliciesDiscountAmountRemaining'
          oneOf:
            - $ref: '#/components/schemas/AmountAdjustmentPoliciesNone'
            - $ref: '#/components/schemas/AmountAdjustmentPoliciesDiscountAmountRemaining'
    AmountAdjustmentInstructionNone:
      type: object
      required:
        - method
      properties:
        method:
          type: string
          enum:
            - none
    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
  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'
    ValidationError:
      description: Invalid data sent.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    TooManyRequests:
      description: Request rate limit exceeded.
      headers:
        Rate-Limit-Limit:
          $ref: '#/components/headers/Rate-Limit-Limit'
        Rate-Limit-Remaining:
          description: |-
            Number of requests still available for this rate limit.
            For more information, see [Rate limits](#section/Rate-limits).
          schema:
            type: integer
          example: 0
        Rate-Limit-Retry-After:
          $ref: '#/components/headers/Rate-Limit-Retry-After'
        Retry-After:
          description: Number of seconds to wait before retrying the request.
          schema:
            type: integer
          example: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TooManyRequests'
  requestBodies:
    Invoice:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Invoice'
      description: Invoice resource.
      required: true
```
