openapi: 3.0.3
info:
  version: '2.1'
  title: Combined API
  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: '#0033A0'
  description: >
    # Introduction

    The Rebilly API is built on HTTP.  Our API is RESTful.  It has predictable

    resource URLs.  It returns HTTP response codes to indicate errors.  It also

    accepts and returns JSON in the HTTP body.  You can use your favorite

    HTTP/REST library for your programming language to use Rebilly's API, or

    you can use one of our SDKs (currently available in
    [PHP](https://github.com/Rebilly/rebilly-php)

    and [Javascript](https://github.com/Rebilly/rebilly-js-sdk)).


    We have other APIs that are also available.  Every action from our
    [app](https://app.rebilly.com)

    is supported by an API which is documented and available for use so that you

    may automate any workflows necessary.  This document contains the most
    commonly

    integrated resources.


    # Authentication


    When you sign up for an account, you are given your first secret API key.

    You can generate additional API keys, and delete API keys (as you may

    need to rotate your keys in the future). You authenticate to the

    Rebilly API by providing your secret key in the request header.


    Rebilly offers three forms of authentication:  secret key, publishable key,
    JSON Web Tokens, and public signature key.

    - [Secret API key](#section/Authentication/SecretApiKey): used for requests
    made
      from the server side. Never share these keys. Keep them guarded and secure.
    - [Publishable API key](#section/Authentication/PublishableApiKey): used
    for
      requests from the client side. For now can only be used to create
      a [Payment Token](#operation/PostToken) and
      a [File token](#operation/PostFile).
    - [JWT](#section/Authentication/JWT): short lifetime tokens that can be
    assigned a specific expiration time.


    Never share your secret keys. Keep them guarded and secure.


    <!-- ReDoc-Inject: <security-definitions> -->


    # Errors

    Rebilly follow's the error response format proposed in [RFC
    7807](https://tools.ietf.org/html/rfc7807) also known as Problem Details for
    HTTP APIs.  As with our normal API responses, your client must be prepared
    to gracefully handle additional members of the response.


    ## Forbidden

    <RedocResponse pointer={"#/components/responses/Forbidden"} />


    ## Conflict

    <RedocResponse pointer={"#/components/responses/Conflict"} />


    ## NotFound

    <RedocResponse pointer={"#/components/responses/NotFound"} />


    ## Unauthorized

    <RedocResponse pointer={"#/components/responses/Unauthorized"} />


    ## ValidationError

    <RedocResponse pointer={"#/components/responses/ValidationError"} />


    # SDKs


    Rebilly offers a Javascript SDK and a PHP SDK to help interact with

    the API.  However, no SDK is required to use the API.


    Rebilly also offers
    [FramePay](https://docs.rebilly.com/docs/developer-docs/framepay/),
     a client-side iFrame-based solution to help
    create payment tokens while minimizing PCI DSS compliance burdens

    and maximizing the customizability.
    [FramePay](https://docs.rebilly.com/docs/developer-docs/framepay/)

    is interacting with the [payment tokens creation
    operation](#operation/PostToken).


    ## Javascript SDK


    The [Javascript SDK](https://github.com/Rebilly/rebilly-js-sdk) is
    maintained

    within Github, and contains the installation and usage instructions.


    ## PHP SDK

    For all PHP SDK examples provided in these docs you will need to configure
    the `$client`.

    You may do it like this:


    ```php

    $client = new Rebilly\Client([
        'apiKey' => 'YourApiKeyHere',
        'baseUrl' => 'https://api.rebilly.com',
    ]);

    ```


    # Using filter with collections

    Rebilly provides collections filtering. You can use `?filter` param on
    collection to define which records should be shown in the response.


    Here is filter format description:


    - Fields and values in filter are separated with `:`:
    `?filter=firstName:John`.


    - Fields in filter are separated with `;`:
    `?filter=firstName:John;lastName:Doe`.


    - You can use multiple values using `,` as values separator:
    `?filter=firstName:John,Bob`.


    - To negate the filter use `!`: `?filter=firstName:!John`. Note that you can
    negate multiple values like this: `?filter=firstName:!John,Bob`. This filter
    rule will exclude all Johns and Bobs from the response.


    - You can use range filters like this: `?filter=amount:1..10`.


    - You can use gte (greater than or equals) filter like this:
    `?filter=amount:1..`, or lte (less than or equals) than filter like this:
    `?filter=amount:..10`.


    - You can create some [predefined values
    lists](https://user-api-docs.rebilly.com/#tag/Lists) and use them in filter:
    `?filter=firstName:@yourListName`. You can also exclude list values:
    `?filter=firstName:!@yourListName`


    # Expand to include embedded objects

    Rebilly provides the ability to pre-load additional

    objects with a request.


    You can use `?expand` param on most requests to expand

    and include embedded objects within the

    `_embedded` property of the response.


    The `_embedded` property contains an array of

    objects keyed by the expand parameter value(s).


    You may expand multiple objects by passing them

    as comma-separated to the expand value like so:


    ```

    ?expand=recentInvoice,customer

    ```


    And in the response, you would see:


    ```

    "_embedded": [
        "recentInvoice": {...},
        "customer": {...}
    ]

    ```

    Expand may be utilitized not only on `GET` requests but also on `PATCH`,
    `POST`, `PUT` requests too.



    # Getting started guide


    Rebilly's API has over 300 operations.  That's more than you'll

    need to implement your use cases.  If you have a use

    case you would like to implement, please consult us for

    feedback on the best API operations for the task.


    Our getting started guide will demonstrate a basic order form use

    case.  It will allow us to highlight core resources

    in Rebilly that will be helpful for many other use cases

    too.


    Within 25 minutes, you'll have sent API requests (via our console)

    to create a subscription order.


    [Click here to visit our API Guide
    Tutorial](https://api-guides.rebilly.com/).
servers:
  - url: 'https://api.rebilly.com/v2.1'
    description: Live Server
  - url: 'https://api-sandbox.rebilly.com/v2.1'
    description: Sandbox Server
tags:
  - name: 3D Secure
    description: |
      3D Secure is a way to authenticate and protect transactions.  Typically,
      it's only possible to protect the initial transaction in a subscription
      with 3D Secure.
  - name: Bank Accounts
    description: |
      Bank Accounts are a type of payment instrument used to collect
      ACH (echeck) payments, similar to how a payment
      card would be used to for a credit card payment.
  - name: Blacklists
    description: |
      Your blacklists contains values of customerIds, email addresses,
      ipAddresses, bank identification numbers, countries or payment cards that
      you do NOT want to do business with. They are a good tool for managing
      risk. A blacklist entry that expires after a period of time we call a
      greylist.
  - name: Coupons
    description: >
      Coupons allows to apply different types of discounts to Invoices,
      Subscriptions and Plans. Redeemed Coupons will be applied only to Invoices
      with the same currency.
  - name: Customers
    description: |
      Customers are your customers, sometimes known as accounts, clients,
      members, patrons, or players in other systems.
  - name: Customers Timeline
    description: >
      The customers timeline keeps an audit trail of changes and activity for
      each customer.
  - name: KYC Documents
    description: >
      Customer KYC files uploaded on behalf of a customer, tagged with a
      document type and submitted for validation.
  - name: Customer Authentication
    description: >
      Create authentication credentials, login, logout, and verify your
      customers.
  - name: Custom Fields
    description: |
      Create additional custom fields for particular resources.  You may name,
      describe, and determine the type of the schema.
  - name: Disputes
    description: |
      Handle disputes (chargebacks and retrievals).
  - name: Files
    description: >
      A File is an entity that can store a physical file and some metadata. It
      also provides an easy access to

      its size, mime-type, user-defined tags and description thus allowing easy
      sorting and searching among stored

      files.

      There are several methods of file uploading available: multipart/form-data
      encoded form, RAW POST (by sending

      file contents as POST body), fetching from URL (by providing the file URL
      via 'url' param)

      Attachment is an entity that is used to link a File to one or multiple
      objects like Customer, Dispute, Payment,

      Transaction, Subscription, Plan, Product, Invoice, Note. That allows to
      quickly find and use files related to

      those specific entities.
  - name: Invoices
    description: >
      Invoices leave a record for both you and your customer of the products
      sold.
  - name: Payment Cards
    description: >
      Payment cards are a type of payment instrument used for credit and debit
      card

      sales.  Rebilly securely vaults the full payment card number, and can pass
      it

      onward securely to any gateway account to transact business.
  - name: PayPal Accounts
    description: >
      PayPal Accounts are used for paying with PayPal.  We can generate a BAID
      (billing

      agreement id) which will allow for recurring billing.
  - name: Payment Tokens
    description: >
      Payment tokens are used to reduce the scope of PCI DSS compliance.  A
      payment

      token can be made using a different authentication scheme (refer to the
      public key

      authentication scheme in the Authentication section), which allows you to

      create a payment token directly from the browser, bypassing the need to
      send

      sensitive cardholder info to your servers.  We recommend using this with
      our

      Rebilly.js library, which helps you wire a form into this API resource and
      create

      payment tokens.
  - name: Plans
    description: >
      Plans are a template for making a subscription.  For example, you may have
      a plan

      that has a 30-day free trial followed by a recurring charge of $19.95 per
      month

      until canceled.  The combination of the plan and a request to make a
      subscription

      will apply those instructions to create the invoices according to the
      plan's

      schedule.
  - name: Products
    description: |
      A product describes what you sell (goods or services).
      A product determines how what you sell appears on invoices and receipts.
      The pricing for products is set in Plans.  One product can have many
      plans.
  - name: Reports
    description: >
      The Rebilly Reporting API is currently experimental. You may see

      the [Reports API Documentation
      here](https://reports-api-docs.rebilly.com).
  - name: Search
    description: |
      Search data including customers, invoices, orders, transactions and more.
  - name: Shipping Zones
    description: >
      A shipping zone contains regions and countries that you ship to. Each
      shipping zone has its own shipping rates.
  - name: Subscriptions
    description: >
      A subscription applies a plan's template to create invoices for a customer
      at the

      appropriate scheduled intervals.  A subscription may also determine if the
      payment

      is collected automatically (with autopay set true).
  - name: Taxes
    description: |
      You can map a product to a tax category.  The tax category is used by
      tax providers to calculate taxes for invoices.
  - name: Transactions
    description: |
      Get and refund transactions.
  - name: Users
    description: >
      The Rebilly User API is primarily for our GUI apps.  You may see

      the [User API Documentation here](https://user-api-docs.rebilly.com).

      A User represents a person who can login to Rebilly, and take actions
      subject to

      their granted permissions.  It has resources less commonly integrated by

      3rd parties.
security:
  - SecretApiKey: []
  - JWT: []
components:
  securitySchemes:
    JWT:
      description: >
        You can create a JSON Web Token (JWT) via our [JWT Session
        resource](https://user-api-docs.rebilly.com/#operation/PostSigninRequest).

        Usage format: `Bearer <JWT>`
      type: http
      scheme: bearer
      bearerFormat: JWT
    PublishableApiKey:
      description: >
        Only for the Tokens resource.

        You can create a Publishable API Key via our [API Keys
        resource](https://user-api-docs.rebilly.com/#tag/API-Keys), by
        specifying the type as `publishable`.
      name: Authorization
      type: apiKey
      in: header
    SecretApiKey:
      description: >
        When you sign up for an account, you are given your first secret API
        key.

        To do so please [follow this link.](https://app.rebilly.com/signup)

        Also you can generate additional API keys, and delete API keys (as you
        may

        need to rotate your keys in the future). All API keys can be restricted
        to a

        small set of permissions (restricted API keys).
      name: REB-APIKEY
      type: apiKey
      in: header
  schemas:
    ResourceId:
      type: string
      description: The resource ID. Defaults to UUID v4
      maxLength: 50
      example: 4f6cf35x-2c4y-483z-a0a9-158621f77a21
    CurrencyCode:
      type: string
      description: ISO 4217 alphabetic currency code
      minLength: 3
      maxLength: 3
      example: USD
    ServerTimestamp:
      type: string
      description: 'Read-only timestamp, automatically assigned on back-end.'
      format: date-time
      readOnly: true
    Link:
      type: object
      properties:
        href:
          description: The link URL
          type: string
      required:
        - href
    SelfLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - self
      required:
        - rel
    ThreeDSecure:
      type: object
      required:
        - enrolled
        - enrollmentEci
        - customerId
        - gatewayAccountId
        - paymentCardId
        - websiteId
        - currency
        - amount
      properties:
        id:
          description: The 3D Secure entry identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        customerId:
          description: Related customer ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        gatewayAccountId:
          description: Related gateway account ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        paymentCardId:
          description: Related payment card ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        websiteId:
          description: Related Website ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        enrolled:
          description: Is the cardholder enrolled in 3DSecure
          type: string
          enum:
            - 'Y'
            - 'N'
            - U
        enrollmentEci:
          description: The 3D Secure entry enrollment eci
          type: string
        eci:
          description: The 3D Secure entry electronic commerce indicator
          type: integer
        cavv:
          description: The 3D Secure entry cardholder authentication verification value
          type: string
        xid:
          description: The 3D Secure entry transaction Id
          type: string
        payerAuthResponseStatus:
          description: The 3D Secure entry Auth Response Status
          type: string
          enum:
            - 'Y'
            - 'N'
            - U
            - A
        signatureVerification:
          description: If signature was verified
          type: string
          enum:
            - 'Y'
            - 'N'
        amount:
          description: Transaction amount
          type: number
          format: double
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        createdTime:
          description: The 3D Secure entry created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    BlankProblem:
      description: >-
        The Problem Details JSON Object
        [[RFC7807](https://tools.ietf.org/html/rfc7807)].
      type: object
      minProperties: 1
      additionalProperties: true
      properties:
        status:
          type: integer
          description: The HTTP status code.
          minimum: 400
          maximum: 599
        title:
          type: string
          description: >-
            A short, human-readable summary of the problem type. It SHOULD NOT
            change from occurrence to occurrence of the problem, except for
            purposes of localization.
    DocumentedProblem:
      type: object
      allOf:
        - properties:
            type:
              type: string
              description: >-
                A URI reference [[RFC3986](https://tools.ietf.org/html/rfc3986)]
                that identifies the problem type. 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
        - $ref: '#/components/schemas/BlankProblem'
    DetailedProblem:
      type: object
      allOf:
        - $ref: '#/components/schemas/BlankProblem'
        - properties:
            detail:
              type: string
              description: >-
                A human-readable explanation specific to this occurrence of the
                problem.
    Problem:
      type: object
      allOf:
        - $ref: '#/components/schemas/DocumentedProblem'
        - $ref: '#/components/schemas/DetailedProblem'
    Error:
      type: object
      allOf:
        - $ref: '#/components/schemas/Problem'
        - properties:
            error:
              deprecated: true
              type: string
    ValidationErrorExtensions:
      type: object
      properties:
        invalidFields:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                description: >-
                  The field name. Dot notation is used for nested object field
                  names.
              message:
                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
    InvalidError:
      description: Invalid data was sent
      allOf:
        - $ref: '#/components/schemas/Error'
        - $ref: '#/components/schemas/ValidationErrorExtensions'
    FileLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - file
      required:
        - rel
    AttachmentResourceLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - customer
            - dispute
            - invoice
            - payment
            - plan
            - product
            - subscription
            - transaction
      required:
        - rel
    FileDownloadLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - download
      required:
        - rel
    SignedLinkLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - signedLink
      required:
        - rel
    PermalinkLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - permalink
      required:
        - rel
    File:
      type: object
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        name:
          description: Original File name
          type: string
        extension:
          description: The File extension
          type: string
        description:
          description: The File description
          type: string
        tags:
          description: The tags list
          type: array
          items:
            type: string
        mime:
          description: The mime type
          type: string
          readOnly: true
          enum:
            - image/png
            - image/jpeg
            - image/gif
            - application/pdf
            - audio/mpeg
        size:
          description: The File size in bytes
          type: integer
          readOnly: true
        width:
          description: 'Image width, applicable to images only'
          type: integer
          readOnly: true
        height:
          description: 'Image height, applicable to images only'
          type: integer
          readOnly: true
        sha1:
          description: Hash sum of the file
          type: string
          readOnly: true
        createdTime:
          description: The upload date/time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The latest update date/time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        isPublic:
          description: >-
            Is the file available publicly (without authentication). If true,
            the permalink in the _links section contains the public URL.
          type: boolean
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 3
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/FileDownloadLink'
              - $ref: '#/components/schemas/SignedLinkLink'
              - $ref: '#/components/schemas/PermalinkLink'
    FileEmbed:
      type: object
      description: File object
      readOnly: true
      properties:
        file:
          $ref: '#/components/schemas/File'
    Attachment:
      type: object
      required:
        - fileId
        - relatedId
        - relatedType
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        fileId:
          description: Linked File object id
          type: string
        relatedType:
          description: Linked object type
          type: string
          enum:
            - customer
            - dispute
            - gateway-timeline-comment
            - invoice
            - organization
            - payment
            - plan
            - product
            - subscription
            - transaction
            - customer-timeline-comment
            - transaction-timeline-comment
            - order-timeline-comment
        relatedId:
          description: Linked object Id
          type: string
        name:
          description: The Original Attachment name
          type: string
        description:
          description: The Attachment description
          type: string
        createdTime:
          description: Creation date/time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Latest update date/time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 3
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/FileLink'
              - $ref: '#/components/schemas/AttachmentResourceLink'
        _embedded:
          type: array
          description: >-
            Any embedded objects available that are requested by the `expand`
            querystring parameter.
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/FileEmbed'
    AuthenticationOptions:
      type: object
      properties:
        passwordPattern:
          description: Allowed password pattern
          type: string
        credentialTtl:
          description: The default lifetime of the credential in seconds
          type: integer
        authTokenTtl:
          description: The default lifetime of the auth-token in seconds
          type: integer
        resetTokenTtl:
          description: The default lifetime of the reset-token in seconds
          type: integer
        otpRequired:
          description: Should OTP be required to exchange token
          type: boolean
    AuthenticationToken:
      type: object
      discriminator:
        propertyName: mode
        mapping:
          password: '#/components/schemas/password'
          passwordless: '#/components/schemas/passwordless'
      properties:
        token:
          description: The token identifier string
          type: string
          readOnly: true
        mode:
          description: The token's generation mode
          type: string
          enum:
            - password
            - passwordless
          writeOnly: true
          default: password
        otpRequired:
          description: Should OTP be required to exchange this token
          type: boolean
        credentialId:
          description: The credential's ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
    AuthenticationTokenMetadata:
      type: object
      properties:
        expiredTime:
          description: Token's expired time
          type: string
          format: date-time
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    password:
      required:
        - username
        - password
      allOf:
        - $ref: '#/components/schemas/AuthenticationToken'
        - properties:
            username:
              description: The token's username
              type: string
            password:
              description: The token's password
              type: string
              format: password
              writeOnly: true
            customerId:
              description: The token's customer ID
              readOnly: true
              allOf:
                - $ref: '#/components/schemas/ResourceId'
        - $ref: '#/components/schemas/AuthenticationTokenMetadata'
    passwordless:
      required:
        - customerId
      allOf:
        - $ref: '#/components/schemas/AuthenticationToken'
        - properties:
            customerId:
              description: The token's customer ID
              allOf:
                - $ref: '#/components/schemas/ResourceId'
        - $ref: '#/components/schemas/AuthenticationTokenMetadata'
    CustomerLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - customer
      required:
        - rel
    CustomerJWT:
      type: object
      properties:
        id:
          description: The session identifier string
          allOf:
            - $ref: '#/components/schemas/ResourceId'
          readOnly: true
        type:
          description: Session type
          type: string
          readOnly: true
          enum:
            - customer
        token:
          description: The session's token used for authentication
          type: string
          readOnly: true
        invalidate:
          description: Whether to invalidate token after exchange or not
          type: boolean
          default: true
          example: true
          writeOnly: true
        oneTimePassword:
          description: The one time password sent via an email. Should contain digits only.
          type: string
          pattern: '^[0-9]{6}$'
          example: '123456'
          writeOnly: true
        customerId:
          description: The customer's ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        createdTime:
          description: Session created time
          type: string
          format: date-time
          readOnly: true
        updatedTime:
          description: Session updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        expiredTime:
          description: Session expired time. Defaults to one hour
          type: string
          format: date-time
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/CustomerLink'
    ContactPhoneNumbers:
      description: The list of phone numbers
      type: array
      items:
        type: object
        required:
          - label
          - value
        properties:
          label:
            description: The phone label
            type: string
            example: main
          value:
            description: The phone value
            type: string
            example: 512-710-1640
          primary:
            description: True if phone is primary
            type: boolean
            example: true
    ContactEmails:
      description: The list of emails
      type: array
      items:
        type: object
        required:
          - label
          - value
        properties:
          label:
            description: The email label
            type: string
            example: main
          value:
            description: The email value
            type: string
            example: rebilly@example.com
          primary:
            description: True if email is primary
            type: boolean
            example: true
    ContactObject:
      type: object
      properties:
        firstName:
          description: The contact first name
          type: string
          example: Benjamin
          nullable: true
        lastName:
          description: The contact last name
          type: string
          example: Franklin
          nullable: true
        organization:
          description: The contact organization
          type: string
          nullable: true
          example: null
        address:
          description: The contact street address
          type: string
          maxLength: 60
          example: 36 Craven St
          nullable: true
        address2:
          description: The contact street address (second line)
          type: string
          maxLength: 60
          nullable: true
        city:
          description: The contact city
          type: string
          maxLength: 45
          nullable: true
          example: London
        region:
          description: The contact region (state)
          type: string
          maxLength: 45
          nullable: true
          example: London
        country:
          description: The contact country ISO Alpha-2 code
          type: string
          pattern: '^[A-Z]{2}$'
          nullable: true
          example: GB
        postalCode:
          description: The contact postal code
          type: string
          maxLength: 10
          nullable: true
          example: WC2N 5NF
        phoneNumbers:
          $ref: '#/components/schemas/ContactPhoneNumbers'
        emails:
          $ref: '#/components/schemas/ContactEmails'
        hash:
          description: >-
            A hash that can be used to compare multiple contacts for identical
            attribute values
          type: string
          maxLength: 40
          example: 056ae6d97c788b9e98b049ebafd7b229bf852221
          readOnly: true
    BrowserData:
      type: object
      title: Browser data
      description: Browser data used for 3DS and risk scoring.
      required:
        - colorDepth
        - javaEnabled
        - language
        - screenHeight
        - screenWidth
        - timeZoneOffset
      properties:
        acceptHeader:
          description: The browser's accept header value.
          type: string
          maxLength: 2048
          example: >-
            text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
        colorDepth:
          description: >-
            The browser's color depth in bits per pixel obtained using the
            `screen.colorDepth` property.
          type: integer
          enum:
            - 1
            - 4
            - 8
            - 15
            - 16
            - 24
            - 32
            - 48
          example: 24
        ipAddress:
          description: The browser's IP address (ipv4 or ipv6).
          type: string
          format: ipv4 or ipv6
          example: 93.92.91.90
        javaEnabled:
          description: >-
            Whether Java is enabled in a browser or not. Value is returned from
            the `navigator.javaEnabled` property.
          type: boolean
        language:
          description: >-
            The browser's language settings returned from the
            `navigator.language` property.
          type: string
          example: en-US
          maxLength: 8
        screenHeight:
          description: >-
            The browser's screen height returned from the `screen.height`
            property.
          type: integer
          example: 900
        screenWidth:
          description: >-
            The browser's screen width returned from the `screen.width`
            property.
          type: integer
          example: 1440
        timeZoneOffset:
          description: >
            The browser's time zone offset in minutes from UTC.

            A positive offset indicates the local time is behind UTC, and
            negative is ahead.

            Can find it with `(new Date()).getTimezoneOffset()` property.
          type: integer
          minimum: -1410
          maximum: 1410
          example: 300
        userAgent:
          description: The user-agent header.
          type: string
          maxLength: 2048
          example: >
            Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36
            (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
        deviceFingerprintHash:
          description: >-
            The device fingerprint hash. See [Valve's
            fingerprintjs2](https://github.com/Valve/fingerprintjs2).
          type: string
          example: pIUt3xbgX3l9g3YDiLbx
    ResourceCustomFields:
      description: >
        "Custom Fields list as a map `{"custom field name": "custom field
        value", ...}"`.

        The format must follow the saved format (see Custom Fields section for
        the formats).
      type: object
    Method:
      type: string
      description: The payment method
      enum:
        - payment-card
        - ach
        - bank-account
        - cash
        - check
        - paypal
        - Alipay
        - ApplePay
        - AstroPay Card
        - bank-transfer
        - bitcoin
        - Boleto
        - cash-deposit
        - CASHlib
        - CashToCode
        - China UnionPay
        - CODVoucher
        - Conekta-oxxo
        - cryptocurrency
        - Cupon-de-pagos
        - domestic-cards
        - echeck
        - ecoPayz
        - ecoVoucher
        - EPS
        - ePay.bg
        - Flexepin
        - Giropay
        - Google Pay
        - Gpaysafe
        - iDebit
        - iDEAL
        - INOVAPAY-pin
        - INOVAPAY-wallet
        - InstaDebit
        - instant-bank-transfer
        - Interac-online
        - Interac-eTransfer
        - Interac-express-connect
        - Interac
        - invoice
        - Jeton
        - Klarna
        - LPG-online
        - LPG-payment-card
        - miscellaneous
        - Neosurf
        - Netbanking
        - Neteller
        - Nordea-Solo
        - OchaPay
        - online-bank-transfer
        - Onlineueberweisen
        - OXXO
        - Pagsmile-lottery
        - Pagsmile-deposit-express
        - PayCash
        - Paysafecard
        - Pay4Fun
        - PinPay
        - phone
        - POLi
        - Przelewy24
        - QQPay
        - Resurs
        - SEPA
        - Skrill
        - Skrill Rapid Transfer
        - SMSVoucher
        - SparkPay
        - swift-dbt
        - ToditoCash-card
        - Trustly
        - UPayCard
        - voucher
        - Webpay
        - WeChat Pay
        - Zotapay
    PaymentInstrument:
      type: object
      required:
        - method
      discriminator:
        propertyName: method
        mapping:
          ach: '#/components/schemas/achInstrument'
          Alipay: '#/components/schemas/AlipayInstrument'
          AstroPay Card: '#/components/schemas/AstroPay-CardInstrument'
          bank-account: '#/components/schemas/bank-accountInstrument'
          bitcoin: '#/components/schemas/bitcoinInstrument'
          Boleto: '#/components/schemas/BoletoInstrument'
          cash: '#/components/schemas/cashInstrument'
          check: '#/components/schemas/checkInstrument'
          China UnionPay: '#/components/schemas/China-UnionPayInstrument'
          ePay.bg: '#/components/schemas/ePay-bgInstrument'
          EPS: '#/components/schemas/EPSInstrument'
          Flexepin: '#/components/schemas/FlexepinInstrument'
          iDEAL: '#/components/schemas/iDEALInstrument'
          Klarna: '#/components/schemas/KlarnaInstrument'
          payment-card: '#/components/schemas/payment-cardInstrument'
          paypal: '#/components/schemas/paypalInstrument'
          QQPay: '#/components/schemas/QQPayInstrument'
          Skrill Rapid Transfer: '#/components/schemas/Skrill-Rapid-TransferInstrument'
          SMSVoucher: '#/components/schemas/SMSVoucherInstrument'
          UPayCard: '#/components/schemas/UPayCardInstrument'
          WeChat Pay: '#/components/schemas/WeChat-PayInstrument'
          AlipayInstrument: '#/components/schemas/AlipayInstrument'
          AstroPay-CardInstrument: '#/components/schemas/AstroPay-CardInstrument'
          BoletoInstrument: '#/components/schemas/BoletoInstrument'
          China-UnionPayInstrument: '#/components/schemas/China-UnionPayInstrument'
          EPSInstrument: '#/components/schemas/EPSInstrument'
          FlexepinInstrument: '#/components/schemas/FlexepinInstrument'
          KlarnaInstrument: '#/components/schemas/KlarnaInstrument'
          QQPayInstrument: '#/components/schemas/QQPayInstrument'
          SMSVoucherInstrument: '#/components/schemas/SMSVoucherInstrument'
          Skrill-Rapid-TransferInstrument: '#/components/schemas/Skrill-Rapid-TransferInstrument'
          UPayCardInstrument: '#/components/schemas/UPayCardInstrument'
          WeChat-PayInstrument: '#/components/schemas/WeChat-PayInstrument'
          achInstrument: '#/components/schemas/achInstrument'
          bank-accountInstrument: '#/components/schemas/bank-accountInstrument'
          bitcoinInstrument: '#/components/schemas/bitcoinInstrument'
          cashInstrument: '#/components/schemas/cashInstrument'
          checkInstrument: '#/components/schemas/checkInstrument'
          ePay-bgInstrument: '#/components/schemas/ePay-bgInstrument'
          iDEALInstrument: '#/components/schemas/iDEALInstrument'
          payment-cardInstrument: '#/components/schemas/payment-cardInstrument'
          paypalInstrument: '#/components/schemas/paypalInstrument'
      properties:
        method:
          $ref: '#/components/schemas/Method'
    achInstrument:
      description: ACH payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
        - type: object
          required:
            - bankAccountId
          properties:
            bankAccountId:
              description: The bank account identifier string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
    AlipayInstrument:
      description: Alipay payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    AstroPay-CardInstrument:
      description: AstroPay Card payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    bank-accountInstrument:
      description: ACH payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
        - type: object
          required:
            - bankAccountId
          properties:
            bankAccountId:
              description: The bank account identifier string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
    bitcoinInstrument:
      description: Bitcoin payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    BoletoInstrument:
      description: Boleto payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    cashInstrument:
      description: Cash payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
        - type: object
          properties:
            receivedBy:
              description: The receiver's name
              type: string
    checkInstrument:
      description: Check payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
        - type: object
          properties:
            reference:
              description: Reference data
              type: string
    China-UnionPayInstrument:
      description: China UnionPay payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    ePay-bgInstrument:
      description: ePay.bg payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    EPSInstrument:
      description: EPS payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    FlexepinInstrument:
      description: Flexepin payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    iDEALInstrument:
      description: iDEAL payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    KlarnaInstrument:
      description: Klarna payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    payment-cardInstrument:
      description: Payment card payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
        - type: object
          required:
            - paymentCardId
          properties:
            paymentCardId:
              description: The payment card identifier string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
    paypalInstrument:
      description: PayPal payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
        - type: object
          required:
            - payPalAccountId
          properties:
            payPalAccountId:
              description: The PayPal account identifier string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
    QQPayInstrument:
      description: QQPay payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    Skrill-Rapid-TransferInstrument:
      description: Skrill Rapid Transfer payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    SMSVoucherInstrument:
      description: SMSVoucher payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    UPayCardInstrument:
      description: SMSVoucher payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    WeChat-PayInstrument:
      description: WeChat Pay payment instrument object
      allOf:
        - $ref: '#/components/schemas/PaymentInstrument'
    CustomerAverageValue:
      type: object
      readOnly: true
      properties:
        currency:
          description: Merchant's reporting currency
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        amount:
          description: Average approved payment amount in Merchant's reporting currency
          type: number
          format: double
        amountUsd:
          description: Average approved payment amount in USD
          type: number
          format: double
    CustomerLifetimeRevenue:
      type: object
      readOnly: true
      properties:
        currency:
          description: Merchant's reporting currency
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        amount:
          description: Revenue amount in Merchant's reporting currency
          type: number
          format: double
        amountUsd:
          description: Revenue amount in USD
          type: number
          format: double
    Tag:
      type: object
      description: Tag
      required:
        - name
      properties:
        id:
          description: The tag's identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        name:
          description: 'The tag''s unique name, which is case-insensitive.'
          type: string
          maxLength: 255
          pattern: '^[@~\-\.\w\s]+$'
          example: New
        createdTime:
          description: The tag's created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The tag's updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
    DefaultPaymentInstrumentLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - defaultPaymentInstrument
      required:
        - rel
    LeadSourceLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - leadSource
      required:
        - rel
    WebsiteLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - website
      required:
        - rel
    LeadSourceData:
      type: object
      properties:
        medium:
          description: 'Lead Source''s medium (eg search, display)'
          type: string
        source:
          description: 'Lead Source''s source (eg google, yahoo)'
          type: string
        campaign:
          description: Lead Source's campaign (eg go-big-123)
          type: string
        term:
          description: Lead Source's term (eg salt shakers)
          type: string
        content:
          description: Lead Source's content (eg smiley faces)
          type: string
        affiliate:
          description: 'Lead Source''s affiliate (eg 123, Bob Smith)'
          type: string
        subAffiliate:
          description: >-
            Lead Source's sub-affiliate also called a sub-id or click id in some
            circles (eg 123456)
          type: string
        salesAgent:
          description: Lead Source's sales agent (eg James Bond)
          type: string
        clickId:
          description: Lead Source's click id (may come from an ad server)
          type: string
        path:
          description: Lead Source's path url (eg www.example.com/some/landing/path)
          type: string
        referrer:
          description: >-
            Lead Source's [`referer`
            url](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer)
            as determined (eg www.example.com/some/landing/path)
          type: string
        createdTime:
          description: LeadSource created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/CustomerLink'
    LeadSource:
      allOf:
        - $ref: '#/components/schemas/LeadSourceData'
        - type: object
          properties:
            original:
              readOnly: true
              allOf:
                - $ref: '#/components/schemas/LeadSourceData'
    LeadSourceEmbed:
      type: object
      description: Lead Source object
      readOnly: true
      properties:
        leadSource:
          $ref: '#/components/schemas/LeadSource'
    Customer:
      type: object
      properties:
        id:
          description: The customer identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        websiteId:
          description: The website's ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        paymentToken:
          type: string
          writeOnly: true
          description: |
            A write-only payment token; if supplied, it will be converted into a
            payment instrument and be set as the `defaultPaymentInstrument`. The
            value of this property will override the `defaultPaymentInstrument`
            in the case that both are supplied. The token may only be used once
            before it is expired.
        defaultPaymentInstrument:
          $ref: '#/components/schemas/PaymentInstrument'
        createdTime:
          description: The customer created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The customer updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        primaryAddress:
          $ref: '#/components/schemas/ContactObject'
        averageValue:
          $ref: '#/components/schemas/CustomerAverageValue'
        paymentCount:
          description: The number of approved payments for the customer
          readOnly: true
          type: integer
        lastPaymentTime:
          description: The most recent time of an approved payment for the customer
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        lifetimeRevenue:
          $ref: '#/components/schemas/CustomerLifetimeRevenue'
        invoiceCount:
          description: >-
            An auto-incrementing number based on the sequence of invoices. If
            set to 0, then this record is a Lead, otherwise is a Customer
          readOnly: true
          type: integer
        tags:
          description: A list of customer's tags
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/Tag'
        revision:
          description: >
            The number of times the customer data has been modified.

            The revision is useful when analyzing webhook data to determine if
            the change takes precedence over the current representation.
          type: integer
          readOnly: true
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 3
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/DefaultPaymentInstrumentLink'
              - $ref: '#/components/schemas/LeadSourceLink'
              - $ref: '#/components/schemas/WebsiteLink'
        _embedded:
          type: array
          description: >-
            Any embedded objects available that are requested by the `expand`
            querystring parameter.
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/LeadSourceEmbed'
    CustomerEmbed:
      type: object
      description: Customer object
      readOnly: true
      properties:
        customer:
          $ref: '#/components/schemas/Customer'
    BankAccount:
      type: object
      title: Bank Account
      required:
        - customerId
      properties:
        id:
          description: The bank account identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        customerId:
          description: The Customer's ID.
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        method:
          description: The method of payment instrument
          type: string
          readOnly: true
          enum:
            - bank-account
        bankName:
          description: Bank's name.
          type: string
        routingNumber:
          description: Bank's Routing Number.
          type: string
        accountNumberType:
          description: >-
            Bank's Account Number type. A valid value is basic bank account
            number (BBAN) or international bank account number (IBAN).
          type: string
          default: BBAN
          enum:
            - BBAN
            - IBAN
        accountType:
          description: Bank's Account type.
          type: string
          enum:
            - checking
            - savings
            - other
        bic:
          description: Bank Identifier Code
          type: string
        address:
          description: The Address.
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        fingerprint:
          description: >-
            A unique value to identify the Bank Account. It contains
            alphanumeric values.
          type: string
          readOnly: true
        last4:
          description: The last 4 digits of the bank account
          type: string
          readOnly: true
        browserData:
          $ref: '#/components/schemas/BrowserData'
        status:
          description: Bank Account status
          type: string
          readOnly: true
          enum:
            - active
            - deactivated
        createdTime:
          description: Bank Account created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Bank Account updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/CustomerLink'
        _embedded:
          type: array
          description: >-
            Any embedded objects available that are requested by the `expand`
            querystring parameter.
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/CustomerEmbed'
    BankAccountCreateToken:
      type: object
      required:
        - customerId
        - token
      properties:
        customerId:
          description: The Customer's ID.
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        token:
          description: BankAccountToken ID.
          type: string
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
    BankAccountCreatePlain:
      type: object
      required:
        - accountNumberType
      discriminator:
        propertyName: accountNumberType
        mapping:
          BBAN: '#/components/schemas/BBANType'
          IBAN: '#/components/schemas/IBANType'
      properties:
        accountNumberType:
          description: >-
            Bank's Account Number type. A valid value is basic bank account
            number (BBAN) or international bank account number (IBAN).
          type: string
          default: BBAN
          enum:
            - IBAN
            - BBAN
        browserData:
          $ref: '#/components/schemas/BrowserData'
    BBANType:
      description: BBAN type object
      allOf:
        - $ref: '#/components/schemas/BankAccountCreatePlain'
        - type: object
          required:
            - customerId
            - accountNumber
            - routingNumber
            - accountType
            - address
          properties:
            customerId:
              description: The Customer's ID.
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            accountNumber:
              description: Bank's Account Number.
              type: string
              pattern: '^[0-9]+$'
            routingNumber:
              description: Bank's Routing Number.
              type: string
              pattern: '^[0-9]+$'
            accountType:
              description: Bank's Account type.
              type: string
              enum:
                - checking
                - savings
                - other
            bankName:
              description: Bank's name.
              type: string
            bic:
              description: Bank Identifier Code.
              type: string
            address:
              description: The Address.
              allOf:
                - $ref: '#/components/schemas/ContactObject'
            customFields:
              $ref: '#/components/schemas/ResourceCustomFields'
    IBANType:
      description: IBAN type object
      allOf:
        - $ref: '#/components/schemas/BankAccountCreatePlain'
        - type: object
          required:
            - customerId
            - accountNumber
            - address
          properties:
            customerId:
              description: The Customer's ID.
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            accountNumber:
              description: >
                Bank's Account Number. Detailed information about all ISO
                13616-compliant national IBAN formats is available

                in [SWIFT IBAN
                Registry](https://www.swift.com/standards/data-standards/iban).
              type: string
            bankName:
              description: Bank's name.
              type: string
            bic:
              description: Bank Identifier Code.
              type: string
            address:
              description: The Address.
              allOf:
                - $ref: '#/components/schemas/ContactObject'
            customFields:
              $ref: '#/components/schemas/ResourceCustomFields'
    Blacklist:
      type: object
      required:
        - type
        - value
      properties:
        id:
          description: The blacklist identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        type:
          description: The blacklist type
          type: string
          enum:
            - payment-card
            - bank-account
            - customer-id
            - email
            - email-domain
            - ip-address
            - country
            - fingerprint
            - bin
            - address
        value:
          description: The blacklist value
          type: string
        expirationTime:
          description: The blacklist expiration time
          type: string
          format: date-time
        createdTime:
          description: The blacklist created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The blacklist updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    discounts-per-redemption:
      description: discounts-per-redemption restrictions
      allOf:
        - $ref: '#/components/schemas/CouponRestriction'
        - $ref: '#/components/schemas/RedemptionRestriction'
        - type: object
          required:
            - quantity
          properties:
            quantity:
              type: integer
              description: Restriction quantity
    CouponRestriction:
      description: Coupon restrictions
      type: object
      discriminator:
        propertyName: type
        mapping:
          discounts-per-redemption: '#/components/schemas/discounts-per-redemption'
          minimum-order-amount: '#/components/schemas/minimum-order-amount'
          paid-by-time: '#/components/schemas/paid-by-time'
          redemptions-per-customer: '#/components/schemas/redemptions-per-customer'
          restrict-to-invoices: '#/components/schemas/restrict-to-invoices'
          restrict-to-plans: '#/components/schemas/restrict-to-plans'
          restrict-to-products: '#/components/schemas/restrict-to-products'
          restrict-to-subscriptions: '#/components/schemas/restrict-to-subscriptions'
          total-redemptions: '#/components/schemas/total-redemptions'
      properties:
        type:
          description: Coupon's restriction type
          type: string
          enum:
            - discounts-per-redemption
            - minimum-order-amount
            - redemptions-per-customer
            - restrict-to-invoices
            - restrict-to-plans
            - restrict-to-subscriptions
            - restrict-to-products
            - total-redemptions
            - paid-by-time
      required:
        - type
    RedemptionRestriction:
      description: Redemption restrictions
      type: object
      discriminator:
        propertyName: type
        mapping:
          discounts-per-redemption: '#/components/schemas/discounts-per-redemption'
          minimum-order-amount: '#/components/schemas/minimum-order-amount'
          paid-by-time: '#/components/schemas/paid-by-time'
          restrict-to-invoices: '#/components/schemas/restrict-to-invoices'
          restrict-to-plans: '#/components/schemas/restrict-to-plans'
          restrict-to-products: '#/components/schemas/restrict-to-products'
          restrict-to-subscriptions: '#/components/schemas/restrict-to-subscriptions'
      properties:
        type:
          description: Redemption's additional restriction type
          type: string
          enum:
            - discounts-per-redemption
            - minimum-order-amount
            - restrict-to-invoices
            - restrict-to-plans
            - restrict-to-subscriptions
            - restrict-to-products
            - paid-by-time
      required:
        - type
    minimum-order-amount:
      description: minimum-order-amount restrictions
      allOf:
        - $ref: '#/components/schemas/CouponRestriction'
        - $ref: '#/components/schemas/RedemptionRestriction'
        - type: object
          required:
            - amount
            - currency
          properties:
            amount:
              type: integer
              description: Minimum order quantity
            currency:
              allOf:
                - $ref: '#/components/schemas/CurrencyCode'
    paid-by-time:
      description: paid-by-time restrictions
      allOf:
        - $ref: '#/components/schemas/CouponRestriction'
        - $ref: '#/components/schemas/RedemptionRestriction'
        - type: object
          required:
            - time
          properties:
            time:
              type: string
              format: date-time
              description: >-
                The time when the coupon's redemption is no longer valid and
                removed from unpaid invoices if applied. Note that this datetime
                cannot be changed.
    redemptions-per-customer:
      description: Quantity per Customer restrictions
      allOf:
        - $ref: '#/components/schemas/CouponRestriction'
        - $ref: '#/components/schemas/RedemptionRestriction'
        - type: object
          required:
            - quantity
          properties:
            quantity:
              type: integer
              description: Restriction value
    restrict-to-invoices:
      description: restrict-to-invoices restrictions
      allOf:
        - $ref: '#/components/schemas/CouponRestriction'
        - $ref: '#/components/schemas/RedemptionRestriction'
        - type: object
          required:
            - invoiceIds
          properties:
            invoiceIds:
              type: array
              description: Invoice IDs coupon can be applied to
              items:
                type: string
    restrict-to-plans:
      description: restrict-to-plans restrictions
      allOf:
        - $ref: '#/components/schemas/CouponRestriction'
        - $ref: '#/components/schemas/RedemptionRestriction'
        - type: object
          required:
            - planIds
          properties:
            planIds:
              type: array
              description: Plan IDs coupon can be applied to
              items:
                type: string
    restrict-to-products:
      description: restrict-to-products restrictions
      allOf:
        - $ref: '#/components/schemas/CouponRestriction'
        - $ref: '#/components/schemas/RedemptionRestriction'
        - type: object
          required:
            - productIds
          properties:
            productIds:
              type: array
              description: Product IDs coupon can be applied to
              items:
                type: string
    restrict-to-subscriptions:
      description: restrict-to-subscriptions restrictions
      allOf:
        - $ref: '#/components/schemas/CouponRestriction'
        - $ref: '#/components/schemas/RedemptionRestriction'
        - type: object
          required:
            - subscriptionIds
          properties:
            subscriptionIds:
              type: array
              description: Subscription IDs coupon can be applied to
              items:
                type: string
    total-redemptions:
      description: total-redemptions restrictions
      allOf:
        - $ref: '#/components/schemas/CouponRestriction'
        - $ref: '#/components/schemas/RedemptionRestriction'
        - type: object
          required:
            - quantity
          properties:
            quantity:
              type: integer
              description: Total redemptions quantity
    CouponRedemption:
      type: object
      description: Coupons redemption log
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        redemptionCode:
          description: Coupon's redemption code
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        customerId:
          description: Customer's ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        additionalRestrictions:
          description: Additional restrictions for coupon's redemptions
          type: array
          items:
            $ref: '#/components/schemas/RedemptionRestriction'
        createdTime:
          description: Coupon redeem time
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        canceledTime:
          description: Coupon redemption canceled time
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    Discount:
      type: object
      discriminator:
        propertyName: type
        mapping:
          fixed: '#/components/schemas/fixed'
          percent: '#/components/schemas/percent'
      properties:
        type:
          description: Discount type
          type: string
          enum:
            - fixed
            - percent
    fixed:
      description: Coupon fixed amount discount
      allOf:
        - $ref: '#/components/schemas/Discount'
        - type: object
          required:
            - amount
            - currency
          properties:
            amount:
              description: Discount amount
              type: number
              format: double
              minimum: 0
              exclusiveMinimum: true
            currency:
              allOf:
                - $ref: '#/components/schemas/CurrencyCode'
    percent:
      description: Coupon percent discount
      allOf:
        - $ref: '#/components/schemas/Discount'
        - type: object
          required:
            - value
          properties:
            value:
              description: Discount percent
              type: number
              format: double
              minimum: 0
              exclusiveMinimum: true
              maximum: 100
    Coupon:
      type: object
      description: Coupons and Discounts
      required:
        - discount
        - issuedTime
      properties:
        redemptionCode:
          description: Coupon's redemption code
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        discount:
          $ref: '#/components/schemas/Discount'
        restrictions:
          description: Coupon restrictions
          type: array
          items:
            $ref: '#/components/schemas/CouponRestriction'
        redemptionsCount:
          type: integer
          description: Coupon's redemptions count
          minimum: 0
          readOnly: true
        status:
          type: string
          description: If coupon enabled
          readOnly: true
          enum:
            - draft
            - issued
            - expired
        description:
          type: string
          description: >
            Your coupon description. When it is not empty this is used for
            invoice discount item description,

            otherwise the item's description uses coupon's redemptionCode like
            'Coupon "redemptionCode"'
        issuedTime:
          description: Coupon's issued time (start time)
          type: string
          format: date-time
        expiredTime:
          description: Coupon's expire time (end time)
          type: string
          format: date-time
        createdTime:
          description: Coupon created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Coupon updated time.
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    CouponExpiration:
      type: object
      required:
        - expiredTime
      properties:
        expiredTime:
          description: >-
            The coupon's expiry time, must be greater than the issued time. Null
            or empty string will immediately expire the coupon.
          type: string
          format: date-time
    Credential:
      type: object
      required:
        - username
        - password
        - customerId
      properties:
        id:
          description: The credential identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        username:
          description: Credential's username
          type: string
        password:
          description: The credential's password
          type: string
          format: password
          writeOnly: true
        customerId:
          description: The credential's customer ID
          type: string
        expiredTime:
          description: The credential's expired time
          type: string
          format: date-time
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/CustomerLink'
    CustomField:
      description: A separate Custom Field schema
      type: object
      required:
        - type
      properties:
        name:
          description: The name of the custom field
          type: string
          readOnly: true
        type:
          description: >
            Type value    | Description

            ------------- | -------------

            array         | An array of strings up to 255 characters, maximum
            size is 1000 elements

            boolean       | true or false

            date          | String of format "full-date" (YYYY-MM-DD) from
            RFC-3339 (full-date)

            datetime      | String of format "date-time" (YYYY-MM-DDTHH:MM:SSZ)
            from RFC-3339 (date-time)

            integer       | Cardinal value of -2^31..2^31-1

            number        | Float value. It can take cardinal values also which
            are interpreted as float

            string        | Regular string up to 255 characters

            monetary      | A map of 3-letters currency code and amount, e.g.
            {"currency": "EUR", "amount": 25.30}
          type: string
          enum:
            - array
            - boolean
            - datetime
            - integer
            - number
            - string
            - monetary
        description:
          description: The custom field description
          type: string
        additionalSchema:
          description: >
            Additional parameters which can be added according to type:


            Parameter Name | Types         | Description

            -------------- | ------------- | -------------

            allowedValues  | string, array | List of allowed values

            maxLength      | string        | Maximum allowed length for the
            string, 255 by default, up to 4000
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    CustomerTimelineCustomEvent:
      type: object
      required:
        - name
      properties:
        id:
          description: Customer Timeline Custom Event identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        name:
          description: >-
            Customer Timeline Custom Event type name. It must not be similar to
            any Rebilly system event.
          type: string
          minLength: 1
          maxLength: 255
        createdTime:
          description: Customer Timeline Custom event created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Customer Timeline Custom event updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    TimelineAction:
      type: object
      discriminator:
        propertyName: action
        mapping:
          redemption-cancel: '#/components/schemas/redemption-cancel'
          resend-email: '#/components/schemas/resend-email'
      readOnly: true
      properties:
        action:
          type: string
          enum:
            - resend-email
            - redemption-cancel
    redemption-cancel:
      description: Cancel Redemption
      allOf:
        - $ref: '#/components/schemas/TimelineAction'
        - type: object
          properties:
            redemptionId:
              allOf:
                - $ref: '#/components/schemas/ResourceId'
    resend-email:
      description: Resend Email action
      allOf:
        - $ref: '#/components/schemas/TimelineAction'
        - type: object
          properties:
            messageId:
              allOf:
                - $ref: '#/components/schemas/ResourceId'
    TimelineTable:
      type: object
      description: Additional information about Timeline message
      discriminator:
        propertyName: type
        mapping:
          three-columns: '#/components/schemas/three-columns'
          two-columns: '#/components/schemas/two-columns'
      properties:
        type:
          type: string
          enum:
            - two-columns
            - three-columns
        title:
          type: string
          description: Data table title
        footer:
          type: string
          description: Data table footer
    three-columns:
      allOf:
        - $ref: '#/components/schemas/TimelineTable'
        - type: object
          properties:
            data:
              type: array
              description: Table data. Each array element represents a table row
              items:
                type: object
                properties:
                  attribute:
                    type: string
                  previousValue:
                    type: string
                  newValue:
                    type: string
                example:
                  attribute: Descriptor
                  previousValue: test.com
                  newValue: new-test.com
    two-columns:
      allOf:
        - $ref: '#/components/schemas/TimelineTable'
        - type: object
          properties:
            data:
              type: array
              description: Table data. Each array element represents a table row
              items:
                type: object
                properties:
                  attribute:
                    type: string
                  value:
                    type: string
                example:
                  attribute: Who
                  value: John Doe
    TimelineExtraData:
      type: object
      description: Additional data
      readOnly: true
      properties:
        actions:
          description: >-
            Actions available to a Timeline message. Can be empty in case no
            actions are available for a message
          type: array
          minItems: 0
          items:
            $ref: '#/components/schemas/TimelineAction'
        tables:
          type: array
          minItems: 0
          items:
            $ref: '#/components/schemas/TimelineTable'
        author:
          type: object
          description: Timeline comment author data
          properties:
            userFullName:
              type: string
            userId:
              type: string
        mentions:
          type: object
          additionalProperties:
            type: string
            example:
              '@test@mail.com': userId-1
        links:
          type: array
          items:
            type: object
            properties:
              resourceType:
                type: string
                enum:
                  - kyc-document
                  - invoice
                  - subscription
                  - transaction
                  - email-message
                  - dispute
                  - credit-memo
                  - coupon
              resourceId:
                $ref: '#/components/schemas/ResourceId'
              placeholder:
                type: string
                example: KYC Document
    CustomerTimeline:
      type: object
      properties:
        id:
          description: The Timeline message identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        type:
          description: Timeline message type
          type: string
          enum:
            - customer-comment-created
            - customer-created
            - primary-address-changed
            - default-payment-instrument-changed
            - lead-source-changed
            - custom-fields-changed
            - coupon-applied
            - coupon-redeemed
            - coupon-redemption-canceled
            - kyc-document-created
            - kyc-document-accepted
            - kyc-document-manually-accepted
            - kyc-document-rejected
            - kyc-document-manually-rejected
            - payment-card-expired
            - payment-instrument-created
            - payment-instrument-deactivated
            - customer-blacklisted
            - customer-payment-card-blacklisted
            - invoice-created
            - invoice-issued
            - invoice-abandoned
            - invoice-voided
            - invoice-past-due
            - invoice-paid
            - invoice-partially-paid
            - invoice-disputed
            - invoice-refunded
            - invoice-partially-refunded
            - order-created
            - order-renewed
            - order-activated
            - order-completed
            - order-reactivated
            - order-canceled
            - order-upgraded
            - order-downgraded
            - order-churned
            - order-paid-early
            - transaction-approved
            - transaction-canceled
            - transaction-declined
            - transaction-abandoned
            - transaction-refunded
            - transaction-voided
            - transaction-discrepancy-found
            - transaction-amount-discrepancy-found
            - email-message-sent
            - custom-event-processed
            - custom-event
            - transaction-waiting-gateway
        customEventType:
          description: >-
            Timeline custom event type. Used with `custom-event` type. Must be
            defined using [Customer Timeline custom event
            API](#operation/PostCustomerTimelineCustomEventType)
          type: string
          nullable: true
          minLength: 1
          maxLength: 255
        customData:
          description: >-
            Timeline custom event data. Used with `custom-event` type. Will be
            transformed to `extraData` two-column table in response
          type: object
          writeOnly: true
          example:
            customAttribute: customValue
            otherAttribute: otherValue
        triggeredBy:
          description: Shows who or what triggered the Timeline message
          type: string
          readOnly: true
          enum:
            - rebilly
            - app
            - direct-api
        message:
          description: The message that describes the message details
          type: string
        extraData:
          $ref: '#/components/schemas/TimelineExtraData'
        occurredTime:
          description: Timeline message time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    ProductLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - product
      required:
        - rel
    Product:
      type: object
      required:
        - name
      description: >
        Products include digital goods, services, and physical goods.

        Products appear on invoice line items. If you set a tax category
        identifier,

        taxes will be calculated upon invoice generation. If it is shippable,

        shipping will be calculated upon invoice generation. Pricing and

        variations are set within Plans.
      properties:
        id:
          description: The product ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
          example: membership
        name:
          description: The product name
          type: string
          maxLength: 255
          example: Premium membership
        unitLabel:
          description: 'The unit label, such as per `seat` or per `unit`.'
          type: string
          maxLength: 50
          example: seat
          default: unit
        description:
          description: The product description
          type: string
          maxLength: 512
        requiresShipping:
          description: >-
            If the product requires shipping, shipping calculations will be
            applied.
          type: boolean
          example: false
        options:
          description: >
            The product options such as color, size, etc. The product options
            definition does

            not include option values. Those are defined within the plans.
          type: array
          items:
            type: string
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        createdTime:
          description: The product created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The product updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    .._Product: &ref_0
      allOf:
        - $ref: '#/components/schemas/Product'
        - properties:
            taxCategoryId:
              description: The product's tax category identifier string
              type: string
              enum:
                - '00000'
                - '99999'
                - '20010'
                - '40030'
                - '51020'
                - '51010'
                - '31000'
                - '30070'
            accountingCode:
              description: The product accounting code
              type: string
              example: '4010'
            _links:
              type: array
              description: The links related to resource
              readOnly: true
              minItems: 1
              items:
                $ref: '#/components/schemas/SelfLink'
    ProductEmbed:
      type: object
      description: Product object
      readOnly: true
      properties:
        product:
          $ref: '#/components/schemas/.._Product'
    PlanPriceFormula:
      type: object
      discriminator:
        propertyName: formula
        mapping:
          fixed-fee: '#/components/schemas/fixed-fee'
          flat-rate: '#/components/schemas/flat-rate'
          stairstep: '#/components/schemas/stairstep'
          tiered: '#/components/schemas/tiered'
          volume: '#/components/schemas/volume'
      required:
        - formula
      properties:
        formula:
          type: string
          description: >
            The price formula determines what algorithm is used to calculate the
            invoice price based on a few factors,

            - the quantity in the subscription (which may be variable if usage
            pricing, otherwise determined when creating the subscription)

            - the price brackets data


            To determine which formula is correct, please see the price formula
            documentation.
          enum:
            - fixed-fee
            - flat-rate
            - stairstep
            - tiered
            - volume
    fixed-fee:
      allOf:
        - $ref: '#/components/schemas/PlanPriceFormula'
        - type: object
          required:
            - price
          properties:
            price:
              description: >
                For the very simple price when it's fixed and does not depend on
                the quantity chosen by customer.


                If the price is 0, it's free.
              type: number
              format: double
              example: 99.95
    flat-rate:
      allOf:
        - $ref: '#/components/schemas/PlanPriceFormula'
        - type: object
          required:
            - price
          properties:
            price:
              description: |
                Flat-rate pricing is represented in a simple price per unit.
                Some examples:

                - $30 per unit
                - $0.10 per transaction
                - $50 per period

                If the price is 0, it's free.
              type: number
              format: double
              example: 99.95
            maxQuantity:
              description: 'If the value is `null`, it''s assumed to be infinite.'
              type: integer
              example: 1
    stairstep:
      allOf:
        - $ref: '#/components/schemas/PlanPriceFormula'
        - type: object
          required:
            - brackets
          properties:
            brackets:
              description: >
                The price brackets, along with the price formula,

                is used to calculate the amount to charge for the product on
                this plan on the invoice.


                The "stairstep" example:


                Price total | Max quantity | Description

                ------------|--------------|------------

                $5          | 1            | 1

                $13         | 5            | 2 to 5

                $30         | null         | 6 or more


                If someone bought 1 apple, it would be $5.


                If someone bought 2 apples, it would be $13. For 2 to 5 apples,
                the price is $13 in any case.
              type: array
              minItems: 1
              items:
                type: object
                properties:
                  price:
                    description: 'If the price is 0, it''s free.'
                    type: number
                    format: double
                    example: 99.95
                  maxQuantity:
                    description: >
                      If the value is `null`, it's assumed to be infinite.  It
                      starts at the end of the previous bracket.

                      If there is no previous bracket, it starts at 1.
                    type: integer
                    example: 1
    tiered:
      allOf:
        - $ref: '#/components/schemas/PlanPriceFormula'
        - type: object
          required:
            - brackets
          properties:
            brackets:
              description: >
                The price brackets, along with the price formula,

                is used to calculate the amount to charge for the product on
                this plan on the invoice.


                The "tiered" example:


                Price per apple | Max quantity | Description

                ----------------|--------------|------------

                $5              | 1            | 1

                $4              | 5            | 2 to 5

                $3              | null         | 6 or more


                If someone bought 1 apple, it would be $5.


                If someone bought 2 apples, it would be $9. $5 per apple for the
                first apple, then $4 per apple for the 2nd to 5th apple.
              type: array
              minItems: 1
              items:
                type: object
                properties:
                  price:
                    description: 'If the price is 0, it''s free.'
                    type: number
                    format: double
                    example: 99.95
                  maxQuantity:
                    description: >
                      If the value is `null`, it's assumed to be infinite.  It
                      starts at the end of the previous bracket.

                      If there is no previous bracket, it starts at 1.
                    type: integer
                    example: 1
    volume:
      allOf:
        - $ref: '#/components/schemas/PlanPriceFormula'
        - type: object
          required:
            - brackets
          properties:
            brackets:
              description: >
                The price brackets, along with the price formula,

                is used to calculate the amount to charge for the product on
                this plan on the invoice.


                The "volume" example:


                Price per apple | Max quantity | Description

                ----------------|--------------|------------

                $5              | 1            | 1

                $4              | 5            | 2 to 5

                $3              | null         | 6 or more


                If someone bought 1 apple, it would be $5.


                If someone bought 2 apples, it would be $8. For 2 to 5 apples,
                the price is $4 per apple.
              type: array
              minItems: 1
              items:
                type: object
                properties:
                  price:
                    description: 'If the price is 0, it''s free.'
                    type: number
                    format: double
                    example: 99.95
                  maxQuantity:
                    description: >
                      If the value is `null`, it's assumed to be infinite.  It
                      starts at the end of the previous bracket.

                      If there is no previous bracket, it starts at 1.
                    type: integer
                    example: 1
    PlanPeriod:
      type: object
      required:
        - unit
        - length
      properties:
        unit:
          description: The unit of time
          type: string
          enum:
            - day
            - week
            - month
            - year
        length:
          description: The length of time
          type: integer
    PlanBillingTiming:
      type: string
      default: prepaid
      description: >
        The billing timing in relation to the service period.

        For `prepaid` plans the customer pays when the service period starts,

        whereas, for `postpaid` plans, the customer pays when the service period
        ends.
      enum:
        - prepaid
        - postpaid
    Plan:
      type: object
      required:
        - name
        - currency
        - productId
        - pricing
      properties:
        id:
          description: The plan ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        name:
          description: 'The plan name, displayed on invoices and receipts.'
          type: string
        productId:
          description: The related product ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        productOptions:
          type: object
          description: Name-value pairs to specify the product options.
          additionalProperties:
            type: string
          example:
            color: red
            size: xxl
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        currencySign:
          description: Currency sign
          readOnly: true
          type: string
        pricing:
          $ref: '#/components/schemas/PlanPriceFormula'
        recurringInterval:
          description: 'The service interval. For a one-time item, use `null`.'
          allOf:
            - $ref: '#/components/schemas/PlanPeriod'
            - type: object
              properties:
                limit:
                  description: >
                    The number of invoices this subscription will generate (if
                    1, it will not generate any beyond the initial

                    subscription creation). For example, set this property to
                    `12`, when the `periodUnit` is month and the

                    `periodDuration` is 1, for a 1 year contract billed monthly.
                  type: integer
                billingTiming:
                  $ref: '#/components/schemas/PlanBillingTiming'
        trial:
          type: object
          description: The trial. Set `null` if no trial.
          required:
            - price
            - period
          properties:
            price:
              description: 'The price of the trial. For a free trial, use `0`.'
              type: number
              format: double
            period:
              $ref: '#/components/schemas/PlanPeriod'
        setup:
          type: object
          description: The setup. Set `null` if no setup.
          required:
            - price
          properties:
            price:
              description: The price of a setup - 0 is a valid value (for free).
              type: number
              format: double
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        createdTime:
          description: Plan created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Plan updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    TimeUnit:
      type: string
      enum:
        - second
        - minute
        - hour
        - day
        - month
        - year
    TimePluralUnit:
      type: string
      enum:
        - seconds
        - minutes
        - hours
        - days
        - months
        - years
    IssueTimeShiftInstruction:
      type: object
      description: >
        The calculation instruction of billing time.

        This is used in conjunction with the **service period anchor** to
        calculate the time the invoice is issued.
      required:
        - chronology
        - duration
        - unit
      properties:
        chronology:
          type: string
          description: >-
            The chronology of the billing time relatively to the service period
            start.
          enum:
            - before
        duration:
          type: integer
          description: The number of the units
          minimum: 1
        unit:
          oneOf:
            - $ref: '#/components/schemas/TimeUnit'
            - $ref: '#/components/schemas/TimePluralUnit'
    DueTimeShiftInstruction:
      type: object
      description: >
        The calculation instruction of due time.

        This is used in conjunction with the **billing anchor** to calculate due
        time of invoice.

        The chronology of due time shift is always **after**.
      default:
        duration: 1
        unit: hour
      properties:
        duration:
          type: integer
          description: The number of the units
          minimum: 1
        unit:
          oneOf:
            - $ref: '#/components/schemas/TimeUnit'
            - $ref: '#/components/schemas/TimePluralUnit'
      required:
        - duration
        - unit
    InvoiceTimeShift:
      type: object
      description: >
        The invoice time shift in conjunction with `billingTiming` allows to
        setup different billing use cases such as:


        - Bill immediately when the service period _starts_

        - Bill immediately after the service period _ends_

        - Bill _interval of time_ before the service period _starts_

        - Bill _interval of time_ after the service period _starts_

        - Bill _interval of time_ before the service period _ends_

        - Bill _interval of time_ after the service period _ends_
      properties:
        issueTimeShift:
          $ref: '#/components/schemas/IssueTimeShiftInstruction'
        dueTimeShift:
          $ref: '#/components/schemas/DueTimeShiftInstruction'
    Plans_Plan:
      allOf:
        - $ref: '#/components/schemas/Plan'
        - properties:
            invoiceTimeShift:
              description: You can shift issue time and due time of invoices for this plan.
              allOf:
                - $ref: '#/components/schemas/InvoiceTimeShift'
            subscriptionCount:
              type: integer
              readOnly: true
              description: Number of subscriptions associated with this plan
            _links:
              type: array
              description: The links related to resource
              readOnly: true
              minItems: 1
              items:
                $ref: '#/components/schemas/SelfLink'
    PlanEmbed:
      type: object
      description: Plan object
      readOnly: true
      properties:
        plan:
          $ref: '#/components/schemas/Plans_Plan'
    InvoiceItem:
      type: object
      required:
        - type
        - unitPrice
      properties:
        id:
          description: The website identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        type:
          description: Invoice item's type
          type: string
          enum:
            - debit
            - credit
        description:
          description: Invoice item's description
          type: string
        unitPrice:
          description: Invoice item's price
          type: number
          format: double
        quantity:
          description: Invoice item's quantity
          type: integer
        price:
          description: Invoice item's total price
          type: number
          format: double
          readOnly: true
        productId:
          description: The product's ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        discountAmount:
          description: Invoice item discount amount
          type: number
          format: double
          readOnly: true
        periodStartTime:
          description: Start time
          type: string
          format: date-time
        periodEndTime:
          description: End time
          type: string
          format: date-time
        periodNumber:
          description: Invoice item subscription period number
          type: integer
        createdTime:
          description: Invoice item created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Invoice item updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/ProductLink'
        _embedded:
          type: array
          description: >-
            Any embedded objects available that are requested by the `expand`
            querystring parameter.
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/ProductEmbed'
              - $ref: '#/components/schemas/PlanEmbed'
    InvoiceTax:
      type: object
      readOnly: true
      properties:
        amount:
          description: Tax amount
          type: number
          format: double
        description:
          type: string
          description: Tax description
    InvoiceDiscount:
      type: object
      readOnly: true
      properties:
        redemptionCode:
          description: Coupon's redemption code
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        redemptionId:
          description: Redemption ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        amount:
          description: Total amount that was discounted by this Coupon
          type: number
          format: double
        description:
          type: string
          description: Discount description
    InstrumentReference:
      type: object
      title: Instrument
      required:
        - method
        - paymentInstrumentId
      properties:
        method:
          type: string
          enum:
            - payment-card
            - bank-account
            - paypal
        paymentInstrumentId:
          description: The payment instrument ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
    MethodReference:
      type: object
      title: Method only
      required:
        - method
      properties:
        method:
          $ref: '#/components/schemas/Method'
    PaymentInstrumentReference:
      oneOf:
        - $ref: '#/components/schemas/InstrumentReference'
        - $ref: '#/components/schemas/MethodReference'
    ThreeDSecureResult:
      type: object
      readOnly: true
      required:
        - enrolled
        - authenticated
        - liability
      properties:
        enrolled:
          description: Is the cardholder enrolled in 3D Secure
          type: string
          enum:
            - 'yes'
            - 'no'
            - invalid card/timeout
            - unavailable
        authenticated:
          description: The 3D Secure entry Auth Response Status
          type: string
          enum:
            - 'yes'
            - 'no'
            - not applicable
            - attempted
        liability:
          type: string
          enum:
            - protected
            - not protected
            - protected (attempt)
    Transaction:
      type: object
      properties:
        id:
          description: The transaction ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        websiteId:
          description: The website ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        customerId:
          description: The сustomer's ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        type:
          description: Transaction type
          type: string
          readOnly: true
          enum:
            - authorize
            - capture
            - credit
            - refund
            - sale
            - void
        status:
          description: Transaction status
          type: string
          readOnly: true
          enum:
            - completed
            - connection-error
            - disputed
            - never-sent
            - partially-refunded
            - pending
            - refunded
            - sending
            - suspended
            - timeout
            - voided
            - waiting-capture
            - waiting-refund
        result:
          description: Transaction result
          type: string
          readOnly: true
          enum:
            - abandoned
            - approved
            - canceled
            - declined
            - unknown
        amount:
          description: The transactions's amount
          type: number
          format: double
          readOnly: true
        currency:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        purchaseAmount:
          description: >-
            The amount actually purchased which may have differed from the
            originally requested amount in case of an adjustment.
          type: number
          format: double
          readOnly: true
        purchaseCurrency:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        requestAmount:
          description: >-
            The amount in the payment request. If adjusted, the purchase amount
            and billing amount may vary from it.
          type: number
          format: double
          readOnly: true
        requestCurrency:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        parentTransactionId:
          description: The parent's transaction ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
          readOnly: true
        childTransactions:
          description: The child transaction IDs
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/ResourceId'
        invoiceIds:
          description: The invoice IDs related to transaction
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/ResourceId'
        subscriptionIds:
          description: The subscription IDs related to transaction's invoice(s)
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/ResourceId'
        planIds:
          description: The plan IDs related to transaction's subscription(s)
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/ResourceId'
        isRebill:
          type: boolean
          readOnly: true
        rebillNumber:
          description: The transactions's rebill number
          type: integer
          readOnly: true
        paymentInstrument:
          $ref: '#/components/schemas/PaymentInstrumentReference'
        billingAddress:
          description: Billing address
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        has3ds:
          type: boolean
          readOnly: true
        3ds:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureResult'
        redirectUrl:
          description: >-
            The URL to redirect the end-user when an offsite transaction is
            completed. Defaults to the website's configured URL.
          type: string
          format: uri
        retryNumber:
          type: integer
          readOnly: true
          description: The position in the sequence of retries
        isRetry:
          type: boolean
          readOnly: true
          description: True if this transaction is retry.
        billingDescriptor:
          type: string
          readOnly: true
          description: >
            The billing descriptor that appears on the periodic billing
            statement. Commonly

            12 or fewer characters for a credit card statement.
        description:
          type: string
          description: The payment description
          maxLength: 255
        requestId:
          description: >-
            The transaction's request ID.  This ID must be unique within a 24
            hour period. Use this field to prevent duplicated transactions.
          type: string
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        processedTime:
          description: Transaction processed time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        createdTime:
          description: Transaction created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Transaction updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    Invoice:
      type: object
      required:
        - customerId
        - websiteId
        - currency
      properties:
        id:
          description: The invoice ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        websiteId:
          description: The website ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        customerId:
          description: The сustomer's ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        invoiceNumber:
          description: >-
            An auto-incrementing number based on the sequence of invoices for
            any particular customer.
          readOnly: true
          type: integer
        subscriptionId:
          description: 'The related subscription''s ID if available, otherwise null.'
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        amount:
          description: The invoice's amount
          type: number
          format: double
          readOnly: true
        amountDue:
          description: The invoice's due amount
          type: number
          format: double
          readOnly: true
        subtotalAmount:
          description: The invoice's subtotal amount
          type: number
          format: double
          readOnly: true
        discountAmount:
          description: The invoice's discounts amount
          type: number
          format: double
          readOnly: true
        taxAmount:
          description: The invoice's taxes amount
          type: number
          format: double
          readOnly: true
        shippingAmount:
          description: The invoice's shipping amount
          type: number
          format: double
          readOnly: true
        billingAddress:
          description: Invoice's billing address
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        deliveryAddress:
          description: Invoice's delivery address
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        poNumber:
          description: Purchase order number which will be displayed on the invoice
          nullable: true
          example: PO123456
          type: string
        notes:
          description: Notes for the customer which will be displayed on the invoice
          type: string
        items:
          type: array
          description: Invoice items array
          readOnly: true
          items:
            $ref: '#/components/schemas/InvoiceItem'
        taxes:
          type: array
          description: Taxes applied to this invoice
          readOnly: true
          items:
            allOf:
              - $ref: '#/components/schemas/InvoiceTax'
        discounts:
          type: array
          description: Discounts applied
          readOnly: true
          items:
            allOf:
              - $ref: '#/components/schemas/InvoiceDiscount'
        transactions:
          type: array
          description: Invoice transactions array
          readOnly: true
          items:
            $ref: '#/components/schemas/Transaction'
        autopayScheduledTime:
          description: Invoice autopay scheduled time
          type: string
          format: date-time
        autopayRetryNumber:
          description: Invoice autopay retry number
          readOnly: true
          type: integer
          minimum: 0
          default: 0
        status:
          type: string
          description: Invoice status
          readOnly: true
          enum:
            - draft
            - unpaid
            - paid
            - past-due
            - delinquent
            - abandoned
            - voided
            - partially-refunded
            - refunded
            - disputed
        delinquentCollectionPeriod:
          type: integer
          description: >-
            Delinquent collection period - difference between paidTime and
            dueTime in days.
          readOnly: true
        collectionPeriod:
          type: integer
          description: >-
            Collection period - difference between paidTime and issuedTime in
            days.
          readOnly: true
        abandonedTime:
          description: Invoice abandoned time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        voidedTime:
          description: Invoice voided time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        paidTime:
          description: Invoice paid time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        dueTime:
          description: Invoice due time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        issuedTime:
          description: Invoice issued time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        createdTime:
          description: Invoice created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Invoice updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    CommonScheduleInstruction:
      type: object
      description: The calculation instruction of scheduled time
      discriminator:
        propertyName: method
        mapping:
          auto: '#/components/schemas/auto'
          date-interval: '#/components/schemas/date-interval'
          day-of-month: '#/components/schemas/day-of-month'
          day-of-week: '#/components/schemas/day-of-week'
          immediately: '#/components/schemas/immediately'
          intelligent: '#/components/schemas/intelligent'
      properties:
        method:
          type: string
          enum:
            - auto
            - intelligent
            - immediately
            - date-interval
            - day-of-month
            - day-of-week
      required:
        - method
    auto:
      allOf:
        - $ref: '#/components/schemas/CommonScheduleInstruction'
    date-interval:
      allOf:
        - $ref: '#/components/schemas/CommonScheduleInstruction'
        - $ref: '#/components/schemas/CustomEventScheduleInstruction'
        - $ref: '#/components/schemas/InvoiceRetryScheduleInstruction'
        - type: object
          properties:
            duration:
              type: integer
              description: The number of the units
              minimum: 1
            unit:
              oneOf:
                - $ref: '#/components/schemas/TimeUnit'
                - $ref: '#/components/schemas/TimePluralUnit'
          required:
            - duration
            - unit
    day-of-month:
      allOf:
        - $ref: '#/components/schemas/CommonScheduleInstruction'
        - $ref: '#/components/schemas/CustomEventScheduleInstruction'
        - $ref: '#/components/schemas/ServicePeriodAnchorInstruction'
        - $ref: '#/components/schemas/InvoiceRetryScheduleInstruction'
        - type: object
          properties:
            day:
              type: integer
              minimum: 1
              maximum: 31
              description: |
                The day of the month when event will be scheduled.
                Be aware if the month has less days,
                the last day of the month will be selected.
            time:
              $ref: '#/components/schemas/TimeIso8601Extended'
          required:
            - day
    CustomEventScheduleInstruction:
      type: object
      description: The calculation instruction of scheduled time
      discriminator:
        propertyName: method
        mapping:
          date-interval: '#/components/schemas/date-interval'
          day-of-month: '#/components/schemas/day-of-month'
          day-of-week: '#/components/schemas/day-of-week'
      properties:
        method:
          type: string
          enum:
            - date-interval
            - day-of-month
            - day-of-week
      required:
        - method
    day-of-week:
      allOf:
        - $ref: '#/components/schemas/CommonScheduleInstruction'
        - $ref: '#/components/schemas/CustomEventScheduleInstruction'
        - $ref: '#/components/schemas/ServicePeriodAnchorInstruction'
        - $ref: '#/components/schemas/InvoiceRetryScheduleInstruction'
        - type: object
          properties:
            day:
              $ref: '#/components/schemas/DayOfWeekLong'
            week:
              type: string
              default: next
              enum:
                - next
                - first-in-month
                - last-in-month
            time:
              $ref: '#/components/schemas/TimeIso8601Extended'
          required:
            - day
    ServicePeriodAnchorInstruction:
      type: object
      description: >
        Instruction for calculating the service period anchor.

        This is used in conjunction with the **subscription start** to calculate
        the time the service period starts and ends.
      discriminator:
        propertyName: method
        mapping:
          day-of-month: '#/components/schemas/day-of-month'
          day-of-week: '#/components/schemas/day-of-week'
          immediately: '#/components/schemas/immediately'
      default:
        method: immediately
      required:
        - method
      properties:
        method:
          type: string
          default: immediately
          enum:
            - immediately
            - day-of-month
            - day-of-week
    InvoiceRetryScheduleInstruction:
      type: object
      description: The calculation instruction of scheduled time
      discriminator:
        propertyName: method
        mapping:
          date-interval: '#/components/schemas/date-interval'
          day-of-month: '#/components/schemas/day-of-month'
          day-of-week: '#/components/schemas/day-of-week'
          immediately: '#/components/schemas/immediately'
          intelligent: '#/components/schemas/intelligent'
      properties:
        method:
          type: string
          enum:
            - intelligent
            - immediately
            - date-interval
            - day-of-month
            - day-of-week
      required:
        - method
    immediately:
      allOf:
        - $ref: '#/components/schemas/CommonScheduleInstruction'
        - $ref: '#/components/schemas/ServicePeriodAnchorInstruction'
        - $ref: '#/components/schemas/InvoiceRetryScheduleInstruction'
    DayOfWeekLong:
      type: string
      enum:
        - Sunday
        - Monday
        - Tuesday
        - Wednesday
        - Thursday
        - Friday
        - Saturday
    TimeIso8601Extended:
      description: Extended ISO-8601 format of time
      type: string
      pattern: >-
        ^(([01][0-9]|2[0-3]):([0-5][0-9])(?::([0-5][0-9]))?)((?:[+-](?:0[0-9]|1[12])(?::?[0-5][0-9])?)|Z)?$
    intelligent:
      allOf:
        - $ref: '#/components/schemas/CommonScheduleInstruction'
        - $ref: '#/components/schemas/CustomEventScheduleInstruction'
        - $ref: '#/components/schemas/InvoiceRetryScheduleInstruction'
        - type: object
          properties:
            duration:
              type: integer
              description: The number of the units
              minimum: 1
            unit:
              oneOf:
                - $ref: '#/components/schemas/TimeUnit'
                - $ref: '#/components/schemas/TimePluralUnit'
          required:
            - duration
            - unit
    OrganizationLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - organization
      required:
        - rel
    TransactionAllocationsLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - transactionAllocations
      required:
        - rel
    RecalculateInvoiceLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - recalculateInvoice
      required:
        - rel
    SubscriptionLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - subscription
      required:
        - rel
    WebsiteEmbed:
      type: object
      description: Website object
      readOnly: true
      properties:
        website:
          type: object
    Organization:
      type: object
      required:
        - name
        - country
      properties:
        id:
          description: The organization identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        createdTime:
          description: The organization created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The organization updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        name:
          description: The organization name
          type: string
          maxLength: 60
        address:
          description: The organization street address
          type: string
          maxLength: 60
        address2:
          description: The organization street address
          type: string
          maxLength: 60
        city:
          description: The organization city
          type: string
          maxLength: 45
        region:
          description: The organization region (state)
          type: string
          maxLength: 45
        country:
          description: The organization country ISO Alpha-2 code
          type: string
          pattern: '^[A-Z]{2}$'
        postalCode:
          description: The organization postal code
          type: string
          maxLength: 10
        phoneNumbers:
          $ref: '#/components/schemas/ContactPhoneNumbers'
        emails:
          $ref: '#/components/schemas/ContactEmails'
        taxDescriptor:
          description: The organization's tax label. This will be displayed on the invoice.
          type: string
          maxLength: 255
        invoiceTimeZone:
          description: >-
            Invoice will use this time zone to display time otherwise UTC will
            be used. Example "America/New_York"
          type: string
          maxLength: 50
        isPrimary:
          description: >-
            True, if Organization is primary (available to set as true only,
            other organizations will become as isPrimary=false)
          type: boolean
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    OrganizationEmbed:
      type: object
      description: Organization object
      readOnly: true
      properties:
        organization:
          $ref: '#/components/schemas/Organization'
    Invoices_Invoice:
      allOf:
        - $ref: '#/components/schemas/Invoice'
        - properties:
            retryInstruction:
              description: The invoice retry instruction
              type: object
              properties:
                attempts:
                  type: array
                  minItems: 1
                  items:
                    type: object
                    properties:
                      scheduleInstruction:
                        $ref: '#/components/schemas/InvoiceRetryScheduleInstruction'
                    required:
                      - scheduleInstruction
                afterAttemptPolicies:
                  description: The policy on the attempt finishes
                  type: array
                  items:
                    type: string
                    enum:
                      - change-subscription-renewal-time
                afterRetryEndPolicies:
                  description: The policy on the retry ends
                  type: array
                  items:
                    type: string
                    enum:
                      - abandon-invoice
                      - cancel-subscription
              required:
                - attempts
                - afterAttemptPolicies
                - afterRetryEndPolicies
            revision:
              description: >
                The number of times the invoice data has been modified.

                The revision is useful when analyzing webhook data to determine
                if the change takes precedence over the current representation.
              type: integer
              readOnly: true
            dueReminderTime:
              description: Time past due reminder event will be triggered
              nullable: true
              allOf:
                - $ref: '#/components/schemas/ServerTimestamp'
            dueReminderNumber:
              description: Number of past due reminder events triggered
              type: integer
              readOnly: true
            _links:
              type: array
              description: The links related to resource
              readOnly: true
              minItems: 1
              items:
                anyOf:
                  - $ref: '#/components/schemas/SelfLink'
                  - $ref: '#/components/schemas/CustomerLink'
                  - $ref: '#/components/schemas/WebsiteLink'
                  - $ref: '#/components/schemas/OrganizationLink'
                  - $ref: '#/components/schemas/LeadSourceLink'
                  - $ref: '#/components/schemas/TransactionAllocationsLink'
                  - $ref: '#/components/schemas/RecalculateInvoiceLink'
                  - $ref: '#/components/schemas/SubscriptionLink'
            _embedded:
              type: array
              description: >-
                Any embedded objects available that are requested by the
                `expand` querystring parameter.
              readOnly: true
              minItems: 1
              items:
                anyOf:
                  - $ref: '#/components/schemas/CustomerEmbed'
                  - $ref: '#/components/schemas/WebsiteEmbed'
                  - $ref: '#/components/schemas/OrganizationEmbed'
                  - $ref: '#/components/schemas/LeadSourceEmbed'
    TransactionLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - transaction
      required:
        - rel
    GatewayName:
      description: The payment gateway name
      type: string
      enum:
        - A1Gateway
        - Adyen
        - AmexVPC
        - ApcoPay
        - AsiaPaymentGateway
        - AstroPayCard
        - AuthorizeNet
        - Bambora
        - BitPay
        - BlueSnap
        - BraintreePayments
        - Cardknox
        - Cashflows
        - CASHlib
        - CashToCode
        - CauriPayment
        - Cayan
        - Chase
        - Citadel
        - Clearhaus
        - CODVoucher
        - Conekta
        - Coppr
        - Credorax
        - Cryptonator
        - DataCash
        - Dengi
        - Directa24
        - EBANX
        - ecoPayz
        - EcorePay
        - Elavon
        - eMerchantPay
        - EPG
        - EPro
        - Finrax
        - Flexepin
        - FinTecSystems
        - FundSend
        - Forte
        - GET
        - Gigadat
        - GlobalOnePay
        - Gooney
        - Gpaysafe
        - Greenbox
        - iCanPay
        - iCheque
        - iDebit
        - Ilixium
        - Ingenico
        - INOVAPAY
        - Inovio
        - Intuit
        - InstaDebit
        - IpayOptions
        - JetPay
        - Jeton
        - LPG
        - Moneris
        - MtaPay
        - Neosurf
        - Netbanking
        - Neteller
        - NGenius
        - NinjaWallet
        - NMI
        - NuaPay
        - OchaPay
        - Onlineueberweisen
        - Optimal
        - Pagsmile
        - Panamerican
        - ParamountEft
        - ParamountInterac
        - PandaGateway
        - Pay4Fun
        - PayCash
        - Payeezy
        - Payflow
        - PaymenTechnologies
        - PayPal
        - Payr
        - Paysafe
        - Paysafecash
        - Payvision
        - Piastrix
        - Plugnpay
        - Prosa
        - Realex
        - Realtime
        - Redsys
        - Rotessa
        - RPN
        - Sagepay
        - SeamlessChex
        - SecureTrading
        - Skrill
        - SmartInvoice
        - SMSVoucher
        - Sofort
        - SparkPay
        - StaticGateway
        - Stripe
        - TestProcessor
        - ToditoCash
        - UPayCard
        - USAePay
        - VantivLitle
        - vegaaH
        - Wallet88
        - Walpay
        - Wirecard
        - WorldlineAtosFrankfurt
        - Worldpay
        - Zotapay
    AcquirerName:
      description: The acquirer name
      type: string
      enum:
        - Adyen
        - Alipay
        - AIB
        - ApcoPay
        - AsiaPaymentGateway
        - AstroPay Card
        - Ipay Options
        - B+S
        - Bambora
        - BitPay
        - Bank of America
        - Bank of Moscow
        - Bank of Rebilly
        - Bank One
        - BMO Harris Bank
        - Borgun
        - BraintreePayments
        - Cardknox
        - CASHlib
        - Catalunya Caixa
        - Chase
        - ChinaUnionPay
        - CIM
        - Citadel
        - Clearhaus
        - CODVoucher
        - Conekta
        - Coppr
        - Credorax
        - Cryptonator
        - EBANX
        - ecoPayz
        - EcorePay
        - Elavon
        - EMS
        - EPG
        - Fifth Third Bank
        - Finrax
        - First Data Buypass
        - First Data Nashville
        - First Data North
        - First Data Omaha
        - FinTecSystems
        - Flexepin
        - Forte
        - FundSend
        - Gigadat
        - Global East
        - Gooney
        - Gpaysafe
        - Heartland
        - HSBC
        - iCanPay
        - iCheque
        - Ilixium
        - Ingenico
        - INOVAPAY
        - Intuit
        - Jeton
        - LPG
        - Masapay
        - Merrick
        - Mission Valley Bank
        - Moneris
        - NATWEST
        - Neosurf
        - Netbanking
        - Neteller
        - NinjaWallet
        - NMI
        - NuaPay
        - OchaPay
        - Onlineueberweisen
        - Other
        - Panamerican
        - Panda Bank
        - Paramount
        - ParamountEft
        - ParamountInterac
        - Pay4fun
        - PayCash
        - PaymenTechnologies
        - Paynetics
        - PayPal
        - Payr
        - Payvision
        - Piastrix
        - Peoples Trust Company
        - Privatbank
        - Prosa
        - QQPay
        - RBC
        - RBS WorldPay
        - RealTime
        - Rotessa
        - Skrill
        - SmartInvoice
        - SMSVoucher
        - Sofort
        - SparkPay
        - State Bank of Mauritius
        - Stripe
        - TBI
        - TestProcessor
        - ToditoCash
        - TrustPay
        - TSYS
        - UPayCard
        - Vantiv
        - VoicePay
        - Wallet88
        - WeChat Pay
        - Wells Fargo
        - Wing Hang Bank
        - Wirecard
        - WorldPay
        - Zotapay
    RiskMetadata:
      type: object
      properties:
        ipAddress:
          description: The customer's IP
          type: string
          format: ipv4
        isProxy:
          description: True if customer's ip address is related to proxy
          type: boolean
          readOnly: true
        isVpn:
          description: True if customer's ip address is related to VPN
          type: boolean
          readOnly: true
        isTor:
          description: True if customer's ip address is related to TOR
          type: boolean
          readOnly: true
        isHosting:
          description: True if customer's ip address is related to hosting
          type: boolean
          readOnly: true
        vpnServiceName:
          description: 'VPN service name, if available'
          type: string
          readOnly: true
        isp:
          description: 'Internet Service Provider name, if available'
          type: string
          readOnly: true
        country:
          description: Country ISO Alpha-2 code for specified ipAddress
          maxLength: 2
          type: string
          readOnly: true
          example: US
        region:
          description: Region for specified ipAddress
          type: string
          readOnly: true
          example: NY
        city:
          description: City for specified ipAddress
          type: string
          readOnly: true
          example: New York
        latitude:
          description: Latitude for specified ipAddress
          type: number
          format: double
          readOnly: true
        longitude:
          description: Longitude for specified ipAddress
          type: number
          format: double
          readOnly: true
        postalCode:
          description: Postal code for specified ipAddress
          type: string
          maxLength: 10
          readOnly: true
        timeZone:
          description: Time zone for specified ipAddress
          type: string
          readOnly: true
          example: America/New_York
        accuracyRadius:
          description: Accuracy radius for specified ipAddress (kilometers)
          type: integer
          readOnly: true
        fingerprint:
          description: The fingerprint
          type: string
        httpHeaders:
          description: HTTP headers
          type: object
          additionalProperties:
            type: string
          example:
            User-Agent: Mozilla/5.0
            Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
        distance:
          description: >-
            Distance between IP Address and Billing Address geolocation
            (kilometers)
          type: integer
          readOnly: true
        score:
          description: Risk score computed per all the factors
          type: integer
          readOnly: true
    TransactionNotificationUrl:
      description: >
        The URL where a server-to-server POST notification will be sent.  It
        will be sent when the

        transaction's result is finalized after a timeout or an offsite
        interaction. Do not trust the

        notification; follow with a GET request to confirm the result of the
        transaction. Please

        respond with a 2xx HTTP status code, or we will reattempt the request
        again.

        The 2 placeholders are available to use in this URI: `{id}` and
        `{result}`.
      type: string
      format: uri
    AmountAdjustment:
      type: object
      discriminator:
        propertyName: method
        mapping:
          discount: '#/components/schemas/discount'
          partial: '#/components/schemas/partial'
      properties:
        method:
          type: string
          enum:
            - none
            - partial
            - discount
      required:
        - method
    discount:
      allOf:
        - $ref: '#/components/schemas/AmountAdjustment'
        - type: object
          properties:
            value:
              description: The payment amount discount
              type: number
              format: float
            type:
              description: The payment amount discount type
              type: string
              enum:
                - percent
                - fixed
          required:
            - value
            - type
    partial:
      allOf:
        - $ref: '#/components/schemas/AmountAdjustment'
        - type: object
          properties:
            value:
              description: The payment amount
              type: number
              format: float
            type:
              description: The payment amount type
              type: string
              enum:
                - percent
                - fixed
          required:
            - value
            - type
    PaymentRetry:
      type: object
      properties:
        attempts:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              scheduleInstruction:
                $ref: '#/components/schemas/CommonScheduleInstruction'
              paymentInstruction:
                $ref: '#/components/schemas/AmountAdjustment'
            required:
              - scheduleInstruction
              - paymentInstruction
        afterAttemptPolicy:
          description: The policy on the attempt finishes
          type: string
          enum:
            - none
            - change-subscription-renewal-time
        afterRetryEndPolicy:
          description: The policy on the retry ends
          type: string
          enum:
            - none
            - cancel-subscription
      required:
        - attempts
        - afterAttemptPolicy
        - afterRetryEndPolicy
    GatewayAccountLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - gatewayAccount
      required:
        - rel
    PaymentCardLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - paymentCard
      required:
        - rel
    ParentTransactionLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - parentTransaction
      required:
        - rel
    RetriedTransactionLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - retriedTransaction
      required:
        - rel
    ApprovalUrlLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - approvalUrl
      required:
        - rel
    CancelUrlLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - cancelUrl
      required:
        - rel
    RefundUrlLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - refundUrl
      required:
        - rel
    DisputeLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - dispute
      required:
        - rel
    InvoicesLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - invoices
      required:
        - rel
    Transactions_Transaction:
      allOf:
        - $ref: '#/components/schemas/Transaction'
        - properties:
            gatewayAccountId:
              description: The transactions's Gateway Account ID
              allOf:
                - $ref: '#/components/schemas/ResourceId'
              readOnly: true
            gatewayTransactionId:
              description: The gateway's transaction ID
              allOf:
                - $ref: '#/components/schemas/ResourceId'
              readOnly: true
            gateway:
              type: object
              description: The related gateway information
              readOnly: true
              properties:
                response:
                  description: The gateway's response
                  type: object
                  properties:
                    code:
                      description: The gateway's response code
                      type: string
                    message:
                      description: The gateway's response message
                      type: string
                    type:
                      description: The gateway's response type
                      type: string
                    originalCode:
                      description: 'The raw, unmapped gateway''s response code'
                      type: string
                    originalMessage:
                      description: 'The raw, unmapped gateway''s response message'
                      type: string
                avsResponse:
                  description: The AVS gateway's response
                  type: object
                  properties:
                    code:
                      description: The response code
                      type: string
                    message:
                      description: The response message
                      type: string
                    originalCode:
                      description: The raw response code
                      type: string
                    originalMessage:
                      description: The raw response message
                      type: string
                cvvResponse:
                  description: The CVV gateway's response
                  type: object
                  properties:
                    code:
                      description: The response code
                      type: string
                    message:
                      description: The response message
                      type: string
                    originalCode:
                      description: The raw response code
                      type: string
                    originalMessage:
                      description: The raw response message
                      type: string
            gatewayName:
              readOnly: true
              description: >-
                Payment Gateway name, available only when transaction use
                gateway, else null
              allOf:
                - $ref: '#/components/schemas/GatewayName'
            acquirerName:
              readOnly: true
              description: >-
                Acquirer name, available only when transaction use gateway, else
                null
              allOf:
                - $ref: '#/components/schemas/AcquirerName'
            method:
              description: Payment Method
              allOf:
                - $ref: '#/components/schemas/Method'
            velocity:
              description: >-
                The number of transactions by the same customer in the past 24
                hours
              type: integer
            revision:
              description: >
                The number of times the transaction data has been modified.

                The revision is useful when analyzing webhook data to determine
                if the change takes precedence over the current representation.
              type: integer
              readOnly: true
            referenceData:
              description: Transaction reference data
              type: object
              additionalProperties:
                type: string
              example:
                gatewayTransactionId: GAT123
              readOnly: true
              nullable: true
            bin:
              description: Payment Card BIN
              type: string
              format: bin
              readOnly: true
            paymentInstrument:
              $ref: '#/components/schemas/PaymentInstrument'
            hasDcc:
              description: True if transaction has Dynamic Currency Conversion applied
              type: boolean
              readOnly: true
            dcc:
              description: >-
                Dynamic Currency Conversion detailed information. Null if hasDcc
                is false
              type: object
              readOnly: true
              properties:
                base:
                  type: object
                  description: Initial amount and currency to convert from
                  properties:
                    amount:
                      type: number
                      format: double
                    currency:
                      allOf:
                        - $ref: '#/components/schemas/CurrencyCode'
                quote:
                  type: object
                  description: Suggested amount and currency to convert to
                  properties:
                    amount:
                      type: number
                      format: double
                    currency:
                      allOf:
                        - $ref: '#/components/schemas/CurrencyCode'
                usdMarkup:
                  description: The amount of markup translated to USD
                  type: number
                  format: double
                outcome:
                  type: string
                  description: Dynamic Currency Conversion outcome
                  enum:
                    - rejected
                    - selected
                    - unknown
            hasBumpOffer:
              description: True if transaction has a Bump offer
              type: boolean
              readOnly: true
            bumpOffer:
              description: Bump offer information. Null if hasBumpOffer is false
              type: object
              readOnly: true
              properties:
                order:
                  type: object
                  description: Initial amount and currency
                  properties:
                    amount:
                      type: number
                      format: double
                    currency:
                      allOf:
                        - $ref: '#/components/schemas/CurrencyCode'
                bump:
                  type: object
                  description: Bump amount and currency
                  properties:
                    amount:
                      type: number
                      format: double
                    currency:
                      allOf:
                        - $ref: '#/components/schemas/CurrencyCode'
                bonus:
                  type: object
                  description: Bonus amount and currency
                  properties:
                    amount:
                      type: number
                      format: double
                    currency:
                      allOf:
                        - $ref: '#/components/schemas/CurrencyCode'
                usdOrder:
                  description: The amount of initial amount translated to USD
                  type: number
                  format: double
                usdBump:
                  description: The amount of bump amount translated to USD
                  type: number
                  format: double
                usdBonus:
                  description: The amount of bonus amount translated to USD
                  type: number
                  format: double
                version:
                  description: >-
                    The name of the version that was picked (useful for
                    measuring split tests)
                  type: string
                language:
                  description: >-
                    The language of the bump offer that was displayed to user
                    (useful for finding any translation problems)
                  type: string
                outcome:
                  type: string
                  description: Bump offer outcome
                  enum:
                    - rejected
                    - selected
                    - unknown
            riskScore:
              description: The transactions's risk score
              type: integer
              readOnly: true
            riskMetadata:
              description: Risk metadata
              allOf:
                - $ref: '#/components/schemas/RiskMetadata'
            notificationUrl:
              $ref: '#/components/schemas/TransactionNotificationUrl'
            retryInstruction:
              $ref: '#/components/schemas/PaymentRetry'
            retriedTransactionId:
              readOnly: true
              description: The retried transaction ID
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            retriesResult:
              type: string
              readOnly: true
              description: Retries sequence result
              enum:
                - approved
                - canceled
                - declined
                - scheduled
            isDisputed:
              description: True if transaction is disputed
              type: boolean
              readOnly: true
            isReconciled:
              description: >-
                True if the transaction has been verified with gateway batch
                data
              type: boolean
              readOnly: true
            hadDiscrepancy:
              description: >-
                True if the transaction has been updated due to a disprepancy
                with its source of truth
              type: boolean
              readOnly: true
            orderId:
              deprecated: true
              description: >-
                The transactions's order ID.  This ID must be unique within a 24
                hour period. This field was renamed to the `requestId`.
              type: string
            scheduledTime:
              type: string
              description: The time the transaction is scheduled for collection
              format: date-time
            _links:
              type: array
              description: The links related to resource
              readOnly: true
              minItems: 1
              items:
                anyOf:
                  - $ref: '#/components/schemas/SelfLink'
                  - $ref: '#/components/schemas/WebsiteLink'
                  - $ref: '#/components/schemas/CustomerLink'
                  - $ref: '#/components/schemas/GatewayAccountLink'
                  - $ref: '#/components/schemas/PaymentCardLink'
                  - $ref: '#/components/schemas/ParentTransactionLink'
                  - $ref: '#/components/schemas/RetriedTransactionLink'
                  - $ref: '#/components/schemas/LeadSourceLink'
                  - $ref: '#/components/schemas/ApprovalUrlLink'
                  - $ref: '#/components/schemas/CancelUrlLink'
                  - $ref: '#/components/schemas/RefundUrlLink'
                  - $ref: '#/components/schemas/DisputeLink'
                  - $ref: '#/components/schemas/InvoicesLink'
            _embedded:
              type: array
              description: >-
                Any embedded objects available that are requested by the
                `expand` querystring parameter.
              readOnly: true
              minItems: 1
              items:
                anyOf:
                  - $ref: '#/components/schemas/ParentTransactionEmbed'
                  - $ref: '#/components/schemas/RetriedTransactionEmbed'
                  - $ref: '#/components/schemas/GatewayAccountEmbed'
                  - $ref: '#/components/schemas/CustomerEmbed'
                  - $ref: '#/components/schemas/LeadSourceEmbed'
                  - $ref: '#/components/schemas/WebsiteEmbed'
                  - $ref: '#/components/schemas/PaymentCardEmbed'
                  - $ref: '#/components/schemas/BankAccountEmbed'
                  - $ref: '#/components/schemas/InvoicesEmbed'
    ParentTransactionEmbed:
      type: object
      description: Retried Transaction object
      readOnly: true
      properties:
        parentTransaction:
          $ref: '#/components/schemas/Transactions_Transaction'
    RetriedTransactionEmbed:
      type: object
      description: Parent Transaction object
      readOnly: true
      properties:
        retriedTransaction:
          $ref: '#/components/schemas/Transactions_Transaction'
    PaymentCardBrand:
      description: Payment Card brand
      type: string
      enum:
        - Visa
        - MasterCard
        - American Express
        - Discover
        - Maestro
        - Solo
        - Electron
        - JCB
        - Voyager
        - Diners Club
        - Switch
        - Laser
        - China UnionPay
        - AstroPay Card
    Condition:
      type: object
      discriminator:
        propertyName: op
        mapping:
          and: '#/components/schemas/and'
          between: '#/components/schemas/between'
          equals: '#/components/schemas/equals'
          gt: '#/components/schemas/gt'
          gte: '#/components/schemas/gte'
          in: '#/components/schemas/in'
          lt: '#/components/schemas/lt'
          lte: '#/components/schemas/lte'
          not: '#/components/schemas/not'
          or: '#/components/schemas/or'
      properties:
        op:
          type: string
          description: The condition operation
          enum:
            - and
            - or
            - not
            - between
            - equals
            - in
            - gt
            - gte
            - lt
            - lte
      required:
        - op
    logical:
      type: object
      properties:
        conditions:
          type: array
          minItems: 2
          items:
            $ref: '#/components/schemas/Condition'
      required:
        - conditions
    and:
      type: object
      description: Logical AND
      allOf:
        - $ref: '#/components/schemas/Condition'
        - $ref: '#/components/schemas/logical'
    between:
      type: object
      description: Between condition
      allOf:
        - $ref: '#/components/schemas/Condition'
        - type: object
          properties:
            path:
              type: string
            min:
              type: string
            max:
              type: string
          required:
            - path
            - min
            - max
    compare:
      type: object
      properties:
        path:
          type: string
        value:
          type: string
      required:
        - path
        - value
    equals:
      type: object
      description: Equals condition
      allOf:
        - $ref: '#/components/schemas/Condition'
        - $ref: '#/components/schemas/compare'
    gt:
      type: object
      description: Greater than condition
      allOf:
        - $ref: '#/components/schemas/Condition'
        - $ref: '#/components/schemas/compare'
    gte:
      type: object
      description: Greater than or equals condition
      allOf:
        - $ref: '#/components/schemas/Condition'
        - $ref: '#/components/schemas/compare'
    in:
      type: object
      description: In condition
      allOf:
        - $ref: '#/components/schemas/Condition'
        - type: object
          properties:
            path:
              type: string
            values:
              type: array
              items:
                type: string
          required:
            - path
            - values
    lt:
      type: object
      description: Less than condition
      allOf:
        - $ref: '#/components/schemas/Condition'
        - $ref: '#/components/schemas/compare'
    lte:
      type: object
      description: Less than or equals condition
      allOf:
        - $ref: '#/components/schemas/Condition'
        - $ref: '#/components/schemas/compare'
    logical-not:
      type: object
      properties:
        condition:
          $ref: '#/components/schemas/Condition'
      required:
        - condition
      example:
        operation: not
        condition:
          operation: equals
          path: /name
          value: John Dou
    not:
      type: object
      description: Logical NOT
      allOf:
        - $ref: '#/components/schemas/Condition'
        - $ref: '#/components/schemas/logical-not'
    or:
      type: object
      description: Logical OR
      allOf:
        - $ref: '#/components/schemas/Condition'
        - $ref: '#/components/schemas/logical'
    OnBoardingUrlLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - onBoardingUrl
      required:
        - rel
    GatewayAccount:
      type: object
      required:
        - gatewayName
        - acquirerName
        - merchantCategoryCode
        - websites
        - acceptedCurrencies
        - organizationId
      discriminator:
        propertyName: gatewayName
        mapping:
          A1Gateway: '#/components/schemas/A1Gateway'
          Adyen: '#/components/schemas/Adyen'
          AmexVPC: '#/components/schemas/AmexVPC'
          ApcoPay: '#/components/schemas/ApcoPay'
          AsiaPaymentGateway: '#/components/schemas/AsiaPaymentGateway'
          AstroPayCard: '#/components/schemas/AstroPayCard'
          AuthorizeNet: '#/components/schemas/AuthorizeNet'
          Bambora: '#/components/schemas/Bambora'
          BitPay: '#/components/schemas/BitPay'
          BlueSnap: '#/components/schemas/BlueSnap'
          BraintreePayments: '#/components/schemas/BraintreePayments'
          CASHlib: '#/components/schemas/CASHlib'
          CODVoucher: '#/components/schemas/CODVoucher'
          Cardknox: '#/components/schemas/Cardknox'
          CashToCode: '#/components/schemas/CashToCode'
          Cashflows: '#/components/schemas/Cashflows'
          CauriPayment: '#/components/schemas/CauriPayment'
          Cayan: '#/components/schemas/Cayan'
          Chase: '#/components/schemas/Chase'
          Citadel: '#/components/schemas/Citadel'
          Clearhaus: '#/components/schemas/Clearhaus'
          Conekta: '#/components/schemas/Conekta'
          Coppr: '#/components/schemas/Coppr'
          Credorax: '#/components/schemas/Credorax'
          Cryptonator: '#/components/schemas/Cryptonator'
          DataCash: '#/components/schemas/DataCash'
          Dengi: '#/components/schemas/Dengi'
          Directa24: '#/components/schemas/Directa24'
          EBANX: '#/components/schemas/EBANX'
          EPG: '#/components/schemas/EPG'
          EPro: '#/components/schemas/EPro'
          EcorePay: '#/components/schemas/EcorePay'
          Elavon: '#/components/schemas/Elavon'
          FinTecSystems: '#/components/schemas/FinTecSystems'
          Finrax: '#/components/schemas/Finrax'
          Flexepin: '#/components/schemas/Flexepin'
          Forte: '#/components/schemas/Forte'
          FundSend: '#/components/schemas/FundSend'
          GET: '#/components/schemas/GET'
          Gigadat: '#/components/schemas/Gigadat'
          GlobalOne: '#/components/schemas/GlobalOne'
          Gooney: '#/components/schemas/Gooney'
          Gpaysafe: '#/components/schemas/Gpaysafe'
          Greenbox: '#/components/schemas/Greenbox'
          INOVAPAY: '#/components/schemas/INOVAPAY'
          Ilixium: '#/components/schemas/Ilixium'
          Ingenico: '#/components/schemas/Ingenico'
          Inovio: '#/components/schemas/Inovio'
          InstaDebit: '#/components/schemas/InstaDebit'
          Intuit: '#/components/schemas/Intuit'
          IpayOptions: '#/components/schemas/IpayOptions'
          JetPay: '#/components/schemas/JetPay'
          Jeton: '#/components/schemas/Jeton'
          LPG: '#/components/schemas/LPG'
          Moneris: '#/components/schemas/Moneris'
          MtaPay: '#/components/schemas/MtaPay'
          Neosurf: '#/components/schemas/Neosurf'
          NMI: '#/components/schemas/NMI'
          Netbanking: '#/components/schemas/Netbanking'
          Neteller: '#/components/schemas/Neteller'
          NGenius: '#/components/schemas/NGenius'
          NinjaWallet: '#/components/schemas/NinjaWallet'
          OchaPay: '#/components/schemas/OchaPay'
          Onlineueberweisen: '#/components/schemas/Onlineueberweisen'
          Optimal: '#/components/schemas/Optimal'
          Pagsmile: '#/components/schemas/Pagsmile'
          Panamerican: '#/components/schemas/Panamerican'
          PandaGateway: '#/components/schemas/PandaGateway'
          ParamountEft: '#/components/schemas/ParamountEft'
          ParamountInterac: '#/components/schemas/ParamountInterac'
          Pay4Fun: '#/components/schemas/Pay4Fun'
          PayCash: '#/components/schemas/PayCash'
          PayPal: '#/components/schemas/PayPal'
          Payeezy: '#/components/schemas/Payeezy'
          Payflow: '#/components/schemas/Payflow'
          PaymenTechnologies: '#/components/schemas/PaymenTechnologies'
          Payr: '#/components/schemas/Payr'
          Paysafe: '#/components/schemas/Paysafe'
          Paysafecash: '#/components/schemas/Paysafecash'
          Payvision: '#/components/schemas/Payvision'
          Piastrix: '#/components/schemas/Piastrix'
          Plugnpay: '#/components/schemas/Plugnpay'
          Prosa: '#/components/schemas/Prosa'
          RPN: '#/components/schemas/RPN'
          Realex: '#/components/schemas/Realex'
          Realtime: '#/components/schemas/Realtime'
          Redsys: '#/components/schemas/Redsys'
          Rotessa: '#/components/schemas/Rotessa'
          SMSVoucher: '#/components/schemas/SMSVoucher'
          Sofort: '#/components/schemas/Sofort'
          Sagepay: '#/components/schemas/Sagepay'
          SeamlessChex: '#/components/schemas/SeamlessChex'
          SecureTrading: '#/components/schemas/SecureTrading'
          Skrill: '#/components/schemas/Skrill'
          SmartInvoice: '#/components/schemas/SmartInvoice'
          SparkPay: '#/components/schemas/SparkPay'
          StaticGateway: '#/components/schemas/StaticGateway'
          Stripe: '#/components/schemas/Stripe'
          TestProcessor: '#/components/schemas/TestProcessor'
          ToditoCash: '#/components/schemas/ToditoCash'
          UPayCard: '#/components/schemas/UPayCard'
          USAePay: '#/components/schemas/USAePay'
          VantivLitle: '#/components/schemas/VantivLitle'
          Wallet88: '#/components/schemas/Wallet88'
          Walpay: '#/components/schemas/Walpay'
          Wirecard: '#/components/schemas/Wirecard'
          WorldlineAtosFrankfurt: '#/components/schemas/WorldlineAtosFrankfurt'
          Worldpay: '#/components/schemas/Worldpay'
          Zotapay: '#/components/schemas/Zotapay'
          eMerchantPay: '#/components/schemas/eMerchantPay'
          ecoPayz: '#/components/schemas/ecoPayz'
          iCanPay: '#/components/schemas/iCanPay'
          iCheque: '#/components/schemas/iCheque'
          iDebit: '#/components/schemas/iDebit'
          vegaaH: '#/components/schemas/vegaaH'
      properties:
        id:
          description: The gateway identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        status:
          description: The gateway account's status
          readOnly: true
          type: string
          enum:
            - active
            - inactive
            - pending
            - closed
        gatewayName:
          $ref: '#/components/schemas/GatewayName'
        acquirerName:
          $ref: '#/components/schemas/AcquirerName'
        merchantCategoryCode:
          description: The gateway account's merchant category code
          type: integer
          minimum: 742
          maximum: 9950
        dccMarkup:
          description: Dynamic currency conversion markup in basis points
          type: integer
          minimum: -10000
          maximum: 10000
        dccForceCurrency:
          type: string
          description: >
            Force dynamic currency conversion to the specified currency on each
            sale.

            Leave it empty to disable force DCC.
        descriptor:
          description: The gateway account's descriptor
          type: string
        cityField:
          description: The gateway account's city field (also known as line 2 descriptor)
          type: string
        organizationId:
          description: Organization ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        excludedDccQuoteCurrencies:
          description: Excluded Dynamic Currency Conversion Quote Currencies
          type: array
          items:
            type: string
        monthlyLimit:
          description: Monthly Limit
          type: number
          format: double
          minimum: 0
        approvalWindowTtl:
          description: >-
            The time window (in seconds) allotted for approving an offsite
            transaction before it is automatically `abandoned`.
          type: integer
          default: 3600
          minimum: 300
          maximum: 16777215
        reconciliationWindowEnabled:
          description: >-
            If a transaction is not reconciled within the
            `reconciliationWindowTtl` time,  then the transaction is marked as
            `abandoned`.
          type: boolean
        reconciliationWindowTtl:
          description: >-
            The time window (in seconds) allotted for a reconciliation to occur.
            If it is not reconciled in that time, then the transaction is marked
            as `abandoned`.
          type: integer
          minimum: 300
          maximum: 16777215
        threeDSecure:
          description: 'True, if Gateway Account allows 3DSecure'
          type: boolean
        dynamicDescriptor:
          description: 'True, if Gateway Account allows dynamic descriptor'
          type: boolean
        acceptedCurrencies:
          description: Accepted currencies (array of the currency three letter code)
          type: array
          items:
            type: string
        method:
          $ref: '#/components/schemas/Method'
        paymentCardSchemes:
          description: Accepted payment card brands
          type: array
          items:
            $ref: '#/components/schemas/PaymentCardBrand'
        isDown:
          description: True if gateway is currently in downtime period.
          type: boolean
          readOnly: true
        additionalCriteria:
          description: >
            The additional criteria that allows to check whether the gateway
            account can be selected for the transaction to be processed.
          allOf:
            - $ref: '#/components/schemas/Condition'
        timeout:
          description: Gateway Account request timeout in seconds
          type: integer
          nullable: true
          minimum: 10
          maximum: 120
        token:
          description: Gateway Account token
          type: string
          readOnly: true
          example: TwiX3f92k4AiBE27BzTbQ38hHjicBz_w
        createdTime:
          description: Gateway Account created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Gateway Account updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/OnBoardingUrlLink'
    ThreeDSecureServerName:
      description: The Merchant plug-in Name
      type: string
      enum:
        - Payvision3dsServer
        - Wirecard3dsServer
        - Ilixium3dsServer
        - DataCash3dsServer
        - Optimal3dsServer
        - Paysafe3dsServer
        - Ingenico3dsServer
        - CardinalCommerce3dsServer
        - Paay3dsServer
        - Panamerican3dsServer
        - eMerchantPay3dsServer
        - SecureTrading3dsServer
        - Clearhaus3dsServer
        - Other
        - ThreeDSecureIO3dsServer
        - WorldlineAtosFrankfurt3dsServer
        - Piastrix3dsServer
        - NGenius3dsServer
        - Stripe3dsServer
    A1Gateway3dsServers:
      description: A1Gateway 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Other: '#/components/schemas/Other'
          Paay3dsServer: '#/components/schemas/Paay3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Paay3dsServer
            - Other
    Other:
      description: Other
      allOf:
        - $ref: '#/components/schemas/A1Gateway3dsServers'
        - $ref: '#/components/schemas/eMerchantPay3dsServers'
        - $ref: '#/components/schemas/GET3dsServers'
        - $ref: '#/components/schemas/NMI3dsServers'
        - $ref: '#/components/schemas/Payvision3dsServers'
        - $ref: '#/components/schemas/VantivLitle3dsServers'
        - $ref: '#/components/schemas/Walpay3dsServers'
        - $ref: '#/components/schemas/Worldpay3dsServers'
    eMerchantPay3dsServers:
      description: eMerchantPay 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Other: '#/components/schemas/Other'
          Paay3dsServer: '#/components/schemas/Paay3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Paay3dsServer
            - eMerchantPay3dsServer
            - Other
    Paay3dsServer:
      description: Paay
      allOf:
        - $ref: '#/components/schemas/A1Gateway3dsServers'
        - $ref: '#/components/schemas/eMerchantPay3dsServers'
        - $ref: '#/components/schemas/GET3dsServers'
        - $ref: '#/components/schemas/NMI3dsServers'
        - $ref: '#/components/schemas/Payvision3dsServers'
        - $ref: '#/components/schemas/VantivLitle3dsServers'
        - $ref: '#/components/schemas/Walpay3dsServers'
        - $ref: '#/components/schemas/Worldpay3dsServers'
        - type: object
          required:
            - apiKey
            - secret
            - mpiUrl
            - sandboxMpiUrl
          properties:
            apiKey:
              type: string
              description: Paay ApiKey
            secret:
              type: string
              format: password
              description: Paay secret
            mpiUrl:
              type: string
              description: Paay 3DS Server url
            sandboxMpiUrl:
              type: string
              description: Paay sandbox 3DS Server url
    GET3dsServers:
      description: GET 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Other: '#/components/schemas/Other'
          Paay3dsServer: '#/components/schemas/Paay3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Paay3dsServer
            - Other
    NMI3dsServers:
      description: NMI 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Other: '#/components/schemas/Other'
          Paay3dsServer: '#/components/schemas/Paay3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Paay3dsServer
            - Other
    Payvision3dsServers:
      description: Payvision 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Other: '#/components/schemas/Other'
          Paay3dsServer: '#/components/schemas/Paay3dsServer'
          CardinalCommerce3dsServer: '#/components/schemas/CardinalCommerce3dsServer'
          Payvision3dsServer: '#/components/schemas/Payvision3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Payvision3dsServer
            - Payvision3ds2Server
            - CardinalCommerce3dsServer
            - Paay3dsServer
            - Other
    CardinalCommerce3dsServer:
      description: CardinalCommerce 3DS Server Credentials
      allOf:
        - $ref: '#/components/schemas/Payvision3dsServers'
        - type: object
          required:
            - merchantId
            - processorId
            - transactionPwd
          properties:
            merchantId:
              type: string
              description: Cardinal MerchantId
            processorId:
              type: string
              description: Cardinal ProcessorId
            transactionPwd:
              type: string
              format: password
              description: Cardinal TransactionPwd
    Payvision3dsServer:
      description: Payvision Integrated
      allOf:
        - $ref: '#/components/schemas/Payvision3dsServers'
    VantivLitle3dsServers:
      description: VantivLitle 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Other: '#/components/schemas/Other'
          Paay3dsServer: '#/components/schemas/Paay3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Paay3dsServer
            - Other
    Walpay3dsServers:
      description: Walpay 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Other: '#/components/schemas/Other'
          Paay3dsServer: '#/components/schemas/Paay3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Paay3dsServer
            - Other
    Worldpay3dsServers:
      description: Worldpay 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Other: '#/components/schemas/Other'
          Paay3dsServer: '#/components/schemas/Paay3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Paay3dsServer
            - Other
    A1Gateway:
      description: A1Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: A1Gateway credentials object
              properties:
                accountId:
                  type: string
                  description: A1Gateway account ID
                password:
                  type: string
                  description: A1Gateway password
                  format: password
              required:
                - accountId
                - password
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/A1Gateway3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/A1Gateway3dsServers'
    Adyen:
      description: Adyen config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            credentials:
              type: object
              description: Adyen credentials object
              properties:
                merchantAccount:
                  type: string
                  description: Adyen merchant account
                apiKey:
                  type: string
                  description: Adyen api key
                  format: password
              required:
                - merchantAccount
                - apiKey
            settings:
              type: object
              description: Adyen settings object
              properties:
                url:
                  type: string
                  description: Adyen post URL
              required:
                - url
    AmexVPC:
      description: AmexVPC config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            credentials:
              type: object
              description: AmexVPC credentials object
              properties:
                merchantId:
                  type: string
                  description: Merchant ID
                accessCode:
                  type: string
                  description: Access Code
                  format: password
                user:
                  type: string
                  description: 'User (used for refund, void and capture)'
                password:
                  type: string
                  description: 'Password (used for refund, void and capture)'
                  format: password
              required:
                - merchantId
                - accessCode
                - user
                - password
            settings:
              type: object
              description: AmexVPC settings object
              properties:
                url:
                  type: string
                  description: Virtual Payment Client URL
              required:
                - url
    ApcoPay:
      description: ApcoPay config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: ApcoPay credentials object
              properties:
                profileID:
                  type: string
                  description: ApcoPay profile ID
                secretWord:
                  type: string
                  description: ApcoPay secret word
                  format: password
                MerchantID:
                  type: string
                  description: ApcoPay merchant ID
                MerchantPassword:
                  type: string
                  description: ApcoPay merchant password
                  format: password
              required:
                - profileID
                - secretWord
                - MerchantID
                - MerchantPassword
            settings:
              type: object
              properties:
                method:
                  type: string
                  description: ApcoPay's method
                  enum:
                    - AFTERPAY
                    - IDEAL
                    - CREDITCLICK
                    - BANCONTACT
                    - ONLINEUBERWEISEN
              required:
                - method
    AsiaPaymentGateway:
      description: AsiaPaymentGateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: AsiaPaymentGateway credentials object
              properties:
                merchantNumber:
                  type: string
                  description: AsiaPaymentGateway merchant number
                secretKey:
                  type: string
                  description: AsiaPaymentGateway secret key for hash
                  format: password
              required:
                - merchantNumber
                - secretKey
    AstroPayCard:
      description: AstroPay Card config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: AstroPay Card credentials object
              properties:
                x_login:
                  type: string
                  description: AstroPay Card login
                x_tran_key:
                  type: string
                  description: AstroPay Card transaction key
                  format: password
                secret_key:
                  type: string
                  description: AstroPay Card secret key
                  format: password
              required:
                - x_login
                - x_tran_key
                - secret_key
    AuthorizeNet:
      description: AuthorizeNet Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                apiLoginId:
                  type: string
                  description: AuthorizeNet Gateway api login ID
                transactionKey:
                  description: AuthorizeNet Gateway Transaction Key
                  type: string
                  format: password
              required:
                - apiLoginId
                - transactionKey
    Bambora:
      description: Bambora Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantId:
                  type: string
                  description: Bambora Gateway merchant ID
                apiPasscode:
                  type: string
                  description: Bambora Gateway API Passcode
                  format: password
              required:
                - merchantId
                - apiPasscode
    BitPay:
      description: BitPay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: BitPay credentials object
              properties:
                token:
                  type: string
                  description: BitPay merchant API token
                  format: password
              required:
                - token
    BlueSnap:
      description: BlueSnap config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: BlueSnap credentials object
              properties:
                username:
                  type: string
                  description: BlueSnap merchant's api username.
                password:
                  type: string
                  description: BlueSnap merchant's api password.
                  format: password
              required:
                - username
                - password
    BraintreePayments:
      description: BraintreePayments Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                publicKey:
                  type: string
                  description: BraintreePayments Public Key
                privateKey:
                  type: string
                  description: BraintreePayments Private Key
                  format: password
                merchantId:
                  type: string
                  description: BraintreePayments merchant ID
                  format: password
                merchantAccountId:
                  type: string
                  description: BraintreePayments merchant account ID
                  format: password
              required:
                - publicKey
                - privateKey
                - merchantId
                - merchantAccountId
    CASHlib:
      description: CASHlib config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: CASHlib credentials object
              properties:
                apiKey:
                  type: string
                  description: CASHlib API Key
                  format: password
                merchantId:
                  type: string
                  description: CASHlib merchant id
              required:
                - apiKey
                - merchantId
    CODVoucher:
      description: COD Voucher config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: COD Voucher credentials object
              properties:
                apiKey:
                  type: string
                  description: COD Voucher API key
                  format: password
                apiSecret:
                  type: string
                  description: COD Voucher API secret
                  format: password
              required:
                - apiKey
                - apiSecret
    Cardknox:
      description: Cardknox Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                xKey:
                  type: string
                  description: Cardknox xKey
                  format: password
              required:
                - xKey
    CashToCode:
      description: CashToCode config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: CashToCode credentials object
              properties:
                cashToCodeUsername:
                  type: string
                  description: CashToCode credentials Username
                cashToCodePassword:
                  type: string
                  description: CashToCode credentials password
                  format: password
                merchantUsername:
                  type: string
                  description: Merchant credentials Username
                merchantPassword:
                  type: string
                  description: Merchant credentials password
                  format: password
              required:
                - cashToCodeUsername
                - cashToCodePassword
                - merchantUsername
                - merchantPassword
            settings:
              type: object
              properties:
                skipAmountSelection:
                  type: boolean
                  description: Skip amount selection screen
                  default: false
    Cashflows:
      description: Cashflows Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                authId:
                  type: string
                  description: Cashflows Gateway auth ID
                authPassword:
                  type: string
                  description: Cashflows Gateway auth password
                  format: password
              required:
                - authPassword
                - authId
    CauriPayment:
      description: CauriPayment config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: CauriPayment credentials object
              properties:
                publicKey:
                  type: string
                  description: CauriPayment merchant's public key.
                privateKey:
                  type: string
                  description: CauriPayment merchant's private key.
                  format: password
              required:
                - publicKey
                - privateKey
    Cayan:
      description: Cayan Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantSiteId:
                  type: string
                  description: Cayan Gateway merchant site ID
                merchantName:
                  type: string
                  description: Cayan Gateway merchant name
                merchantKey:
                  type: string
                  description: Cayan Gateway merchant key
                  format: password
              required:
                - merchantSiteId
                - merchantName
                - merchantKey
    Chase:
      description: Chase Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                username:
                  type: string
                  description: Chase Gateway Net Connect username
                password:
                  type: string
                  description: Chase Gateway Net Connect password
                  format: password
                coNumber:
                  type: string
                  description: Chase Gateway CO Number used for delimited file reports
                divisionId:
                  type: string
                  description: Chase Gateway division ID
                partialAuth:
                  type: boolean
                  description: Support for Partial Auths
                  default: false
              required:
                - username
                - password
                - coNumber
                - divisionId
                - partialAuth
    Citadel:
      description: Citadel config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Citadel credentials object
              properties:
                storeName:
                  type: string
                  description: Store name
                storeId:
                  type: string
                  description: Store ID
                username:
                  type: string
                  description: Username
                password:
                  type: string
                  description: Password
                  format: password
              required:
                - storeName
                - storeId
                - username
                - password
    Clearhaus3dsServers:
      description: Clearhaus 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Clearhaus3dsServer: '#/components/schemas/Clearhaus3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Clearhaus3dsServers
    Clearhaus3dsServer:
      description: Clearhaus 3DS Server Credentials
      allOf:
        - $ref: '#/components/schemas/Clearhaus3dsServers'
        - type: object
          required:
            - merchantId
            - acquirerBin
            - apiKey
          properties:
            merchantId:
              type: string
              description: >-
                Merchant account ID or Card Acceptor ID provided by the
                acquiring bank.
            acquirerBin:
              type: string
              description: Acquiring institution identification code.
            apiKey:
              type: string
              format: password
              description: 3DS Server Api key
    Clearhaus:
      description: Clearhaus Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                apiKey:
                  type: string
                  description: Clearhaus api key
                  format: password
              required:
                - apiKey
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Clearhaus3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Clearhaus3dsServers'
    Conekta:
      description: Conekta config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Conekta credentials object
              properties:
                apiKey:
                  type: string
                  description: Conekta private API key
                  format: password
              required:
                - apiKey
    Coppr:
      description: Coppr config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Coppr credentials object
              properties:
                organizationId:
                  type: string
                  description: Coppr Organization's ID
                apiKey:
                  type: string
                  description: Coppr api key
                  format: password
              required:
                - organizationId
                - apiKey
            settings:
              type: object
              description: Coppr settings object
              properties:
                rebillyPublishableKey:
                  type: string
                  description: >-
                    Rebilly publishable api key. If provided a payment token
                    will be created for each transaction.
    Credorax:
      description: Credorax Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantId:
                  type: string
                  description: Credorax Gateway merchant ID
                merchantMd5Signature:
                  type: string
                  description: Credorax Gateway md5 signature
                  format: password
              required:
                - merchantId
                - merchantMd5Signature
    Cryptonator:
      description: Cryptonator config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Cryptonator credentials object
              properties:
                merchant_id:
                  type: string
                  description: Cryptonator merchant ID
                secret:
                  type: string
                  description: Cryptonator secret
                  format: password
              required:
                - merchant_id
                - secret
    DataCash3dsServers:
      description: DataCash 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          DataCash3dsServer: '#/components/schemas/DataCash3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - DataCash3dsServer
    DataCash3dsServer:
      description: DataCash Integrated
      allOf:
        - $ref: '#/components/schemas/DataCash3dsServers'
    DataCash:
      description: DataCash Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                client:
                  type: string
                  description: DataCash Gateway client
                password:
                  type: string
                  description: DataCash Gateway password
                  format: password
                reportGroup:
                  type: string
                  description: DataCash report group
                reportUser:
                  type: string
                  description: DataCash report user
                reportPassword:
                  type: string
                  description: DataCash report password
                  format: password
                visaPayoutsClient:
                  type: string
                  description: DataCash Gateway client for Visa payouts (OCT)
                visaPayoutsPassword:
                  type: string
                  description: DataCash Gateway password for Visa payouts (OCT)
                  format: password
                masterCardPayoutsClient:
                  type: string
                  description: DataCash Gateway client for MasterCard payouts (OCT)
                masterCardPayoutsPassword:
                  type: string
                  description: DataCash Gateway password for MasterCard payouts (OCT)
                  format: password
              required:
                - client
                - password
            settings:
              type: object
              description: Datacash settings object
              properties:
                policy:
                  type: integer
                  description: Policy
                  minimum: 0
                  maximum: 7
                  default: 2
                delay:
                  type: integer
                  description: Auto Capture delay (in hours)
                  minimum: 0
                  default: 0
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/DataCash3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/DataCash3dsServers'
    Dengi:
      description: Dengi Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                projectId:
                  type: string
                  description: Dengi Gateway project ID
                publicKey:
                  type: string
                  description: Dengi Gateway public key
                  format: password
                refundKey:
                  type: string
                  description: Dengi Gateway refund key
                  format: password
              required:
                - projectId
                - publicKey
                - refundKey
    Directa24Banks:
      type: string
      enum:
        - CU
        - SE
        - BV
        - BM
        - SM
        - OX
        - BQ
        - EN
        - FA
        - BW
        - SS
        - SU
        - WA
        - FB
        - TC
        - I
        - BB
        - B
        - CA
        - SB
        - BL
        - NB
        - UI
    Directa24:
      description: Directa24 config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Directa24 credentials object
              properties:
                x_login:
                  type: string
                  description: Directa24 login
                x_tran_key:
                  type: string
                  description: Directa24 transaction key
                  format: password
                secret_key:
                  type: string
                  description: Directa24 secret key
                  format: password
                web_pay_login:
                  type: string
                  description: Directa24 web pay status login
                web_pay_tran_key:
                  type: string
                  description: Directa24 web pay status password
                  format: password
              required:
                - x_login
                - x_tran_key
                - secret_key
                - web_pay_login
                - web_pay_tran_key
            settings:
              type: object
              description: Directa24 settings object
              properties:
                banks:
                  type: array
                  description: list of banks which will show on hook page
                  items:
                    $ref: '#/components/schemas/Directa24Banks'
                skipStep:
                  type: boolean
                  description: Skip step for user to enter their personal information.
    EBANX:
      description: EBANX config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: EBANX credentials object
              properties:
                integrationKey:
                  type: string
                  description: EBANX integration key
                  format: password
              required:
                - integrationKey
    EPG:
      description: EPG config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: EPG credentials object
              properties:
                merchantId:
                  type: string
                  description: Merchant ID
                productId:
                  type: string
                  description: Product ID
                merchantPassword:
                  type: string
                  description: Merchant password
                  format: password
                merchantKey:
                  type: string
                  description: Merchant key
                  format: password
              required:
                - merchantId
                - productId
                - merchantPassword
                - merchantKey
    EPro:
      description: EPro config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: EPro credentials object
              properties:
                apiSecretKey:
                  type: string
                  description: EPro API secret key
                  format: password
              required:
                - apiSecretKey
    EcorePay:
      description: EcorePay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                accountId:
                  type: string
                  description: EcorePay Account ID
                accountAuth:
                  type: string
                  description: EcorePay Account Auth
                  format: password
              required:
                - accountId
                - accountAuth
    Elavon:
      description: Elavon config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Elavon credentials object
              properties:
                ssl_merchant_id:
                  type: string
                  description: Elavon merchant ID
                ssl_user_id:
                  type: string
                  description: Elavon user ID
                ssl_pin:
                  type: string
                  description: Elavon pin
                  format: password
              required:
                - ssl_merchant_id
                - ssl_user_id
                - ssl_pin
    FinTecSystems:
      description: FinTecSystems config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            credentials:
              type: object
              description: FinTecSystems credentials object
              properties:
                apiKey:
                  type: string
                  description: FinTecSystems api key
                  format: password
              required:
                - apiKey
            settings:
              type: object
              description: FinTecSystems settings object
              properties:
                recipientIBAN:
                  type: string
                  description: IBAN of the recipient account
                recipientBIC:
                  type: string
                  description: BIC of the recipient account
                recipientCountry:
                  type: string
                  description: Two letter country code
                  enum:
                    - AT
                    - CH
                    - DE
                recipientHolder:
                  type: string
                  description: Account holder of the recipient account
              required:
                - recipientIBAN
                - recipientBIC
                - recipientHolder
                - recipientCountry
    Finrax:
      description: Finrax config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Finrax credentials object
              properties:
                businessId:
                  type: string
                  description: Finrax Business Id
                apiKey:
                  type: string
                  description: Finrax API Key
                apiSecret:
                  type: string
                  description: Finrax API Secret
                  format: password
              required:
                - businessId
                - apiKey
                - apiSecret
    Flexepin:
      description: Flexepin Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                apiKey:
                  type: string
                  description: Flexepin API Key
                apiSecret:
                  type: string
                  description: Flexepin API Secret
                  format: password
              required:
                - apiKey
                - apiSecret
    Forte:
      description: Forte Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                accountId:
                  type: string
                  description: Forte Gateway account ID
                locationId:
                  type: string
                  description: Forte Gateway location ID
                apiAccessId:
                  type: string
                  description: Forte Gateway api access ID
                  format: password
                apiSecretKey:
                  type: string
                  description: Forte Gateway api secret key
                  format: password
              required:
                - accountId
                - locationId
                - apiAccessId
                - apiSecretKey
    FundSend:
      description: FundSend Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                clientId:
                  type: string
                  description: FundSend Gateway client ID
                secretWord:
                  type: string
                  description: FundSend Gateway secret word
                  format: password
              required:
                - clientId
                - secretWord
    GET:
      description: GET Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                accountId:
                  type: string
                  description: GET Gateway account ID
              required:
                - accountId
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/GET3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/GET3dsServers'
    Gigadat:
      description: Gigadat config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Gigadat credentials object
              properties:
                campaignId:
                  type: string
                  description: Gigadat campaign ID
                accessToken:
                  type: string
                  description: Gigadat access token
                  format: password
                securityToken:
                  type: string
                  description: Gigadat security token
                  format: password
              required:
                - campaignId
                - accessToken
                - securityToken
            settings:
              type: object
              properties:
                sandbox:
                  type: boolean
                  description: True if gateway account is in sandbox mode
                  default: false
              required:
                - sandbox
    GlobalOne:
      description: GlobalOne Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                terminalId:
                  type: string
                  description: GlobalOne Gateway terminal ID
                sharedSecret:
                  type: string
                  description: GlobalOne Gateway shared secret
                  format: password
              required:
                - terminalId
                - sharedSecret
    Gooney:
      description: Gooney config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Gooney credentials object
              properties:
                apiUser:
                  type: string
                  description: Gooney API user
                apiPassword:
                  type: string
                  description: Gooney API password
                  format: password
                apiKey:
                  type: string
                  description: Gooney API key
                apiSecret:
                  type: string
                  description: Gooney API secret
                  format: password
              required:
                - username
                - password
                - apiKey
                - apiSecret
    Gpaysafe:
      description: Gpaysafe Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                apiKey:
                  type: string
                  description: Gpaysafe apiKey
              required:
                - apiKey
    Greenbox:
      description: Greenbox config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Greenbox credentials object
              properties:
                clientId:
                  type: string
                  description: Greenbox client ID
                locationId:
                  type: string
                  description: Greenbox location ID
                clientSecret:
                  type: string
                  description: Greenbox client secret
                  format: password
              required:
                - clientId
                - clientSecret
                - locationId
    INOVAPAY:
      description: INOVAPAY config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: INOVAPAY credentials object
              properties:
                apiKey:
                  type: string
                  description: INOVAPAY API key
                apiSecret:
                  type: string
                  description: INOVAPAY API secret
                  format: password
              required:
                - apiKey
                - apiSecret
    Ilixium3dsServers:
      description: Ilixium3dsServers 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Ilixium3dsServer: '#/components/schemas/Ilixium3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Ilixium3dsServer
    Ilixium3dsServer:
      description: Ilixium Integrated
      allOf:
        - $ref: '#/components/schemas/Ilixium3dsServers'
    Ilixium:
      description: Ilixium Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Ilixium credentials object
              properties:
                merchantId:
                  type: string
                  description: Ilixium Gateway merchant ID
                accountId:
                  type: string
                  description: Ilixium Gateway account ID
                digestPassword:
                  type: string
                  description: Ilixium Gateway digest password
                  format: password
              required:
                - merchantId
                - accountId
                - digestPassword
            settings:
              type: object
              description: Ilixium settings object
              properties:
                useIpFrame:
                  type: boolean
                  description: Force Ilixium to process via Ip Frame
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Ilixium3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Ilixium3dsServers'
    Ingenico3dsServers:
      description: Ingenico 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Ingenico3dsServer: '#/components/schemas/Ingenico3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Ingenico3dsServer
    Ingenico3dsServer:
      description: Ingenico Integrated
      allOf:
        - $ref: '#/components/schemas/Ingenico3dsServers'
    Ingenico:
      description: Ingenico Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantId:
                  type: string
                  description: Ingenico Gateway merchant ID
                apiKeyId:
                  type: string
                  description: Ingenico Gateway api key ID
                apiSecretKey:
                  type: string
                  description: Ingenico Gateway api secret key
                  format: password
                skipFraudService:
                  type: boolean
                  description: Ingenico skip fraud service
              required:
                - merchantId
                - apiKeyId
                - apiSecretKey
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Ingenico3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Ingenico3dsServers'
    Inovio3dsServers:
      description: Inovio 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Inovio3dsServer: '#/components/schemas/Inovio3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Inovio3dsServer
    Inovio3dsServer:
      description: Inovio Integrated
      allOf:
        - $ref: '#/components/schemas/Inovio3dsServers'
    Inovio:
      description: Inovio config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            credentials:
              type: object
              description: Inovio credentials object
              properties:
                username:
                  type: string
                  description: Inovio username
                password:
                  type: string
                  description: Inovio password
                  format: password
              required:
                - username
                - password
            settings:
              type: object
              description: Inovio settings object
              properties:
                websiteId:
                  type: string
                  description: Inovio website ID
                merchantAccountId:
                  type: string
                  description: Inovio merchant account ID
                productId:
                  type: string
                  description: Inovio product ID
              required:
                - websiteId
                - merchantAccountId
                - productId
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Inovio3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Inovio3dsServers'
    InstaDebit:
      description: InstaDebit config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: InstaDebit credentials object
              properties:
                merchantId:
                  type: string
                  description: InstaDebit merchant account number
                password:
                  type: string
                  description: InstaDebit merchant account password
                  format: password
              required:
                - merchantId
                - password
    Intuit:
      description: Intuit Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                clientId:
                  type: string
                  description: The Intuit client_id key
                clientSecret:
                  type: string
                  description: The Intuit client_secret key
                  format: password
              required:
                - clientId
                - clientSecret
    IpayOptions:
      description: Ipay Options config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            credentials:
              type: object
              description: Ipay Options credentials object
              properties:
                sid:
                  type: string
                  description: Ipay Options website ID
                rcode:
                  type: string
                  description: Ipay Options rcode
                  format: password
              required:
                - sid
                - rcode
            settings:
              type: object
              description: Ipay Options settings object
              properties:
                extraStep:
                  type: boolean
                  description: Show extra step for user to enter their email and DNI number
                subdomain:
                  type: string
                  description: Subdomain to use when sending request to IpayOptions.
                  enum:
                    - miglite
                    - w88asiapay
                platform:
                  type: string
                  description: Platform which IpayOptions will process.
                  enum:
                    - SOAP
                    - TxHandler
    JetPay:
      description: JetPay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                TerminalID:
                  type: string
                  description: JetPay Gateway terminal ID
              required:
                - TerminalID
    Jeton:
      description: Jeton Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                apiKey:
                  type: string
                  description: Jeton apiKey
                  format: password
              required:
                - apiKey
            settings:
              type: object
              properties:
                method:
                  type: string
                  description: Jeton's method
                  enum:
                    - CHECKOUT
                    - DIRECT
                    - QR
                    - JETGO
              required:
                - method
    LPG:
      description: LPG config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: LPG credentials object
              properties:
                publicKey:
                  type: string
                  description: LPG public API key
                secureKey:
                  type: string
                  description: LPG secure API key
                  format: password
                payoutUsername:
                  type: string
                  description: LPG payout account username
                  format: password
                payoutPassword:
                  type: string
                  description: LPG payout account password
                  format: password
              required:
                - publicKey
                - secureKey
    Moneris:
      description: Moneris Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                apiToken:
                  type: string
                  description: Moneris Gateway api token
                  format: password
                storeId:
                  type: string
                  description: Moneris Gateway store ID
              required:
                - storeId
                - apiToken
    MtaPay:
      description: MTA Pay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            credentials:
              type: object
              properties:
                accountId:
                  type: string
                  description: MTA Pay Gateway account ID
                partyId:
                  type: string
                  description: MTA Pay Gateway party ID
                md5key:
                  type: string
                  description: MTA Pay Gateway md5key
                  format: password
              required:
                - accountId
                - partyId
                - md5key
            settings:
              type: object
              description: MTA Pay settings object
              properties:
                goods:
                  type: string
                  description: MTA Pay Gateway goods
                mobilePay:
                  type: string
                  description: MTA Pay Gateway mobile pay param
              required:
                - mobilePay
                - goods
    Neosurf:
      description: Neosurf config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Neosurf credentials object
              properties:
                merchantId:
                  type: string
                  description: Neosurf merchant ID
                secretKey:
                  type: string
                  description: Neosurf API secret key
                  format: password
              required:
                - merchantId
                - secretKey
    NMI:
      description: NMI Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                username:
                  type: string
                  description: NMI Gateway api token
                password:
                  type: string
                  description: NMI Gateway store ID
                  format: password
              required:
                - username
                - password
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/NMI3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/NMI3dsServers'
    Netbanking:
      description: Netbanking config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Netbanking credentials object
              properties:
                midcode:
                  type: string
                  description: Netbanking MID code
                midsecret:
                  type: string
                  description: Netbanking MID secret key
                  format: password
              required:
                - midcode
                - midsecret
    Neteller:
      description: Neteller Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Neteller credentials object
              properties:
                paysafePaymentsApiUsername:
                  type: string
                  description: Neteller App Paysafe Payments API Username for a private key
                paysafePaymentsApiPassword:
                  type: string
                  description: Neteller App Paysafe Payments API Password for a private key
                  format: password
              required:
                - paysafePaymentsApiUsername
                - paysafePaymentsApiPassword
            settings:
              type: object
              properties:
                populateCustomerEmail:
                  type: boolean
                  description: Populate customer email for payment
    NGenius3dsServers:
      description: NGenius 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          NGenius3dsServer: '#/components/schemas/NGenius3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - NGenius3dsServer
    NGenius3dsServer:
      description: NGenius Integrated
      allOf:
        - $ref: '#/components/schemas/NGenius3dsServers'
    NGenius:
      description: NGenius config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: NGenius credentials object
              properties:
                outletId:
                  type: string
                  description: NGenius outlet ID
                apiKey:
                  type: string
                  description: NGenius API key
                  format: password
              required:
                - outletId
                - apiKey
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/NGenius3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/NGenius3dsServers'
    NinjaWallet:
      description: NinjaWallet config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: NinjaWallet credentials object
              properties:
                apiKey:
                  type: string
                  description: NinjaWallet api key
                  format: password
                secret:
                  type: string
                  description: NinjaWallet secret
                  format: password
                passphrase:
                  type: string
                  description: NinjaWallet passphrase
                  format: password
              required:
                - apiKey
                - secret
                - passphrase
    OchaPay:
      description: OchaPay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                apiUsername:
                  type: string
                  description: OchaPay Gateway username
                apiPassword:
                  type: string
                  description: OchaPay Gateway api password
                  format: password
                secretWord:
                  type: string
                  description: OchaPay Gateway secret word
                  format: password
              required:
                - apiUsername
                - apiPassword
                - secretWord
    Onlineueberweisen:
      description: Onlineueberweisen config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            credentials:
              type: object
              description: Onlineueberweisen credentials object
              properties:
                apiKey:
                  type: string
                  description: Onlineueberweisen API Key
                  format: password
                nuaPayApiKey:
                  type: string
                  description: NuaPay API Key for reconciliation
                  format: password
                nuaPayAccountId:
                  type: string
                  description: NuaPay account ID for reconciliation
              required:
                - apiKey
            settings:
              type: object
              description: Onlineueberweisen settings object
              properties:
                payformCode:
                  type: string
                  description: >-
                    Onlineueberweisen payform code to use customized Payform
                    template
                  default: default
                autoAbandonTtl:
                  type: integer
                  description: Auto-abandon if transaction is not reconciled after x hours
              required:
                - autoAbandonTtl
    Optimal3dsServers:
      description: Optimal 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Optimal3dsServer: '#/components/schemas/Optimal3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Optimal3dsServer
    Optimal3dsServer:
      description: Optimal Integrated
      allOf:
        - $ref: '#/components/schemas/Optimal3dsServers'
    Optimal:
      description: Optimal Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                storeId:
                  type: string
                  description: Optimal Gateway store ID
                storePwd:
                  type: string
                  description: Optimal Gateway store password
                  format: password
                accountNum:
                  type: string
                  description: Optimal Gateway account number
              required:
                - storeId
                - storePwd
                - accountNum
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Optimal3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Optimal3dsServers'
    Pagsmile:
      description: Pagsmile Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantId:
                  type: string
                  description: Pagsmile merchant ID
                appId:
                  type: string
                  description: Pagsmile app ID
                secretKey:
                  type: string
                  description: Pagsmile secret key
                  format: password
              required:
                - merchantId
                - appId
                - secretKey
    Panamerican3dsServers:
      description: Panamerican 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Panamerican3dsServer: '#/components/schemas/Panamerican3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Panamerican3dsServer
    Panamerican3dsServer:
      description: Panamerican Integrated
      allOf:
        - $ref: '#/components/schemas/Panamerican3dsServers'
    Panamerican:
      description: Panamerican config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            credentials:
              type: object
              description: Panamerican credentials object
              properties:
                key:
                  type: string
                  description: Panamerican's key
                password:
                  type: string
                  description: Panamerican's Password
                  format: password
              required:
                - key
                - password
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Panamerican3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Panamerican3dsServers'
            settings:
              type: object
              description: Panamerican settings object
              properties:
                extraStep:
                  type: boolean
                  description: Show extra step for user to enter their ID number
                convertToAscii:
                  type: boolean
                  description: Will convert all chars to ascii
              required:
                - extraStep
    PandaGateway:
      description: Panda Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantCode:
                  type: string
                  description: Panda Gateway merchant code
                apiCode:
                  type: string
                  description: Panda Gateway api code
                signKey:
                  type: string
                  description: Panda Gateway sign key
                  format: password
              required:
                - merchantCode
                - apiCode
                - signKey
    ParamountEft:
      description: Paramount config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Paramount credentials object
              properties:
                merchant_id:
                  type: string
                  description: Merchant account ID
                merchant_pass:
                  type: string
                  description: Merchant account password
                  format: password
                payee:
                  type: string
                  description: Merchant name/descriptor
              required:
                - merchant_id
                - merchant_pass
                - payee
    ParamountInterac:
      description: ParamountInterac config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: ParamountInterac credentials object
              properties:
                merchantId:
                  type: string
                  description: ParamountInterac merchant ID
                encryptionKey:
                  type: string
                  description: ParamountInterac encryption key
                  format: password
              required:
                - merchantId
                - encryptionKey
    Pay4Fun:
      description: Pay4Fun config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Pay4Fun credentials object
              properties:
                merchantId:
                  type: string
                  description: Pay4Fun merchant ID
                merchantSecret:
                  type: string
                  description: Pay4Fun merchant secret
                  format: password
                merchantKey:
                  type: string
                  description: Pay4Fun merchant key
                  format: password
              required:
                - merchantId
                - merchantSecret
                - merchantKey
    PayCash:
      description: PayCash config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: PayCash credentials object
              properties:
                emisor:
                  type: string
                  description: Identify of the company
                token:
                  type: string
                  description: Token
                  format: password
              required:
                - emisor
                - token
    PayPal:
      description: PayPal Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantIdInPayPal:
                  type: string
                  description: PayPal Gateway merchant id
              required:
                - merchantIdInPayPal
    Payeezy:
      description: Payeezy Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantId:
                  type: string
                  description: Payeezy Merchant ID
                merchantToken:
                  type: string
                  description: Merchant Token
                  format: password
                apiKey:
                  type: string
                  description: API Key
                apiSecret:
                  type: string
                  description: API Secret
                  format: password
              required:
                - merchantId
                - merchantToken
                - apiKey
                - apiSecret
    Payflow:
      description: Payflow config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Payflow credentials object
              properties:
                user:
                  type: string
                  description: >-
                    If you set up one or more additional users on the account,
                    this value is the ID of the user authorized to process
                    transactions. If, however, you have not set up additional
                    users, USER has the same value as VENDOR
                vendor:
                  type: string
                  description: >-
                    Your merchant login ID created when you registered for the
                    account.
                password:
                  type: string
                  description: The password you defined while registering for the account.
                  format: password
              required:
                - user
                - vendor
                - password
    PaymenTechnologies:
      description: PaymenTechnologies Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                authenticateId:
                  type: string
                  description: PaymenTechnologies Gateway authenticate ID
                authenticatePw:
                  type: string
                  description: PaymenTechnologies Gateway authenticate password
                  format: password
                publicKey:
                  type: string
                  description: PaymenTechnologies Gateway API public key
                secretKey:
                  type: string
                  description: PaymenTechnologies Gateway API secret key
                  format: password
                apiKey:
                  type: string
                  description: PaymenTechnologies API key required for query operations
                  format: password
              required:
                - authenticateId
                - authenticatePw
                - publicKey
                - secretKey
                - apiKey
            settings:
              type: object
              properties:
                use3DSEndpoint:
                  type: boolean
                  description: Use 3DS endpoint
    Payr:
      description: Payr Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                clientId:
                  type: string
                  description: Payr Gateway client ID
                secretWord:
                  type: string
                  description: Payr Gateway secret word
                  format: password
                apiUserId:
                  type: string
                  description: Username for the Alliance API (transaction reporting)
                apiSecurityToken:
                  type: string
                  description: >-
                    Hash of the password for the Alliance API (transaction
                    reporting)
                  format: password
              required:
                - clientId
                - secretWord
    Paysafe3dsServers:
      description: Paysafe 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Paysafe3dsServer: '#/components/schemas/Paysafe3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Paysafe3dsServer
    Paysafe3dsServer:
      description: Paysafe Integrated
      allOf:
        - $ref: '#/components/schemas/Paysafe3dsServers'
    Paysafe:
      description: Paysafe Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                storeId:
                  type: string
                  description: Paysafe Gateway store ID
                storePwd:
                  type: string
                  description: Paysafe Gateway store password
                  format: password
                accountNum:
                  type: string
                  description: Paysafe Gateway account number
              required:
                - storeId
                - storePwd
                - accountNum
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Paysafe3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Paysafe3dsServers'
    Paysafecash:
      description: Paysafecash Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                apiKey:
                  type: string
                  description: Paysafecash API key
                  format: password
              required:
                - apiKey
    Payvision:
      description: Payvision Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                memberId:
                  type: string
                  description: Payvision Gateway member id
                memberGuid:
                  type: string
                  description: Payvision Gateway member guid
                  format: password
              required:
                - memberId
                - memberGuid
            settings:
              type: object
              description: Payvision settings object
              properties:
                avs:
                  type: boolean
                  description: Payvision Gateway avs
                delay:
                  type: integer
                  description: Payvision Gateway delay
                merchantAccountType:
                  type: integer
                  description: Payvision merchant account type
              required:
                - merchantAccountType
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Payvision3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Payvision3dsServers'
    Piastrix3dsServers:
      description: Piastrix 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Piastrix3dsServer: '#/components/schemas/Piastrix3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Piastrix3dsServer
    Piastrix3dsServer:
      description: Piastrix Integrated
      allOf:
        - $ref: '#/components/schemas/Piastrix3dsServers'
    Piastrix:
      description: Piastrix config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Piastrix credentials object
              properties:
                shopId:
                  type: string
                  description: Shop ID
                secretKey:
                  type: string
                  description: Secret Key
                  format: password
              required:
                - shopId
                - secretKey
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Piastrix3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Piastrix3dsServers'
    Plugnpay:
      description: Plugnpay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                publisher-name:
                  type: string
                  description: Plugnpay Gateway member id
                publisher-password:
                  type: string
                  description: Plugnpay Gateway avs
                  format: password
              required:
                - publisher-name
                - publisher-password
    Prosa:
      description: Prosa config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Prosa credentials object
              properties:
                entityId:
                  type: string
                  description: Entity ID
                accessToken:
                  type: string
                  description: Access token
                  format: password
              required:
                - entityId
                - accessToken
    RPN:
      description: RPN Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                mid:
                  type: string
                  description: RPN MID
                key:
                  type: string
                  description: RPN Key
                  format: password
              required:
                - mid
                - key
    Realex:
      description: Realex Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantId:
                  type: string
                  description: Realex Gateway merchant id
                secretKey:
                  type: string
                  description: Realex Gateway secret key
                  format: password
                rebatePassword:
                  type: string
                  description: Realex Gateway rebate password
                  format: password
                account:
                  type: string
                  description: Realex Gateway account
              required:
                - merchantId
                - secretKey
                - rebatePassword
                - account
    Realtime:
      description: Realtime Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                clientId:
                  type: string
                  description: Realtime Gateway client ID
                secretWord:
                  type: string
                  description: Realtime Gateway secret word
                  format: password
              required:
                - clientId
                - secretWord
    Redsys:
      description: Redsys Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantCode:
                  type: string
                  description: Redsys Gateway merchant code
                  format: password
                secretCode:
                  type: string
                  description: Redsys Gateway secret code
                  format: password
              required:
                - merchantCode
                - secretCode
    Rotessa:
      description: Rotessa config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            credentials:
              type: object
              description: Rotessa credentials object
              properties:
                apiKey:
                  type: string
                  description: Rotessa api key
                  format: password
              required:
                - apiKey
            settings:
              type: object
              description: Rotessa settings object
              properties:
                delay:
                  type: integer
                  description: Rotessa Gateway time delay for them to process transaction
              required:
                - delay
    SMSVoucher:
      description: SMSVoucher Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                AppId:
                  type: string
                  description: SMSVoucher AppId
              required:
                - AppId
    Sofort:
      description: Sofort config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Sofort credentials object
              properties:
                configKey:
                  type: string
                  description: Sofort configuration key
                nuaPayApiKey:
                  type: string
                  description: NuaPay API Key for reconciliation
                  format: password
                nuaPayAccountId:
                  type: string
                  description: NuaPay account ID for reconciliation
              required:
                - configKey
            settings:
              type: object
              description: Sofort settings object
              properties:
                autoAbandonTtl:
                  type: integer
                  description: Auto-abandon if transaction is not reconciled after x hours
    Sagepay:
      description: Sagepay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                M_ID:
                  type: string
                  description: Sagepay Gateway merchant ID
                M_KEY:
                  type: string
                  description: Sagepay Gateway merchant key
                  format: password
              required:
                - M_ID
                - M_KEY
    SeamlessChex:
      description: SeamlessChex config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: SeamlessChex credentials object
              properties:
                publicKey:
                  type: string
                  description: SeamlessChex publishable key
                secretKey:
                  type: string
                  description: SeamlessChex secret key
                  format: password
              required:
                - publicKey
                - secretKey
    SecureTrading3dsServers:
      description: SecureTrading 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          SecureTrading3dsServer: '#/components/schemas/SecureTrading3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - SecureTrading3dsServer
    SecureTrading3dsServer:
      description: SecureTrading 3DS Server
      allOf:
        - $ref: '#/components/schemas/SecureTrading3dsServers'
    SecureTrading:
      description: SecureTrading config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: SecureTrading credentials object
              properties:
                websiteId:
                  type: string
                  description: Website ID
                username:
                  type: string
                  description: SecureTrading web service username
                password:
                  type: string
                  description: SecureTrading web service password
                  format: password
              required:
                - websiteId
                - username
                - password
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/SecureTrading3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/SecureTrading3dsServers'
    Skrill:
      description: Skrill config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Skrill credentials object
              properties:
                accountEmail:
                  type: string
                  description: Email address of your Skrill merchant account
                secretWord:
                  type: string
                  description: Secret word used for MD5 signature verifications
                  format: password
                mqiPassword:
                  type: string
                  description: Password used during MQI/API requests
                  format: password
              required:
                - accountEmail
                - secretWord
    SmartInvoice3dsServers:
      description: SmartInvoice 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          SmartInvoice3dsServer: '#/components/schemas/SmartInvoice3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - SmartInvoice3dsServer
    SmartInvoice3dsServer:
      description: SmartInvoice Integrated
      allOf:
        - $ref: '#/components/schemas/SmartInvoice3dsServers'
    SmartInvoice:
      description: SmartInvoice config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: SmartInvoice credentials object
              properties:
                merchantId:
                  type: string
                  description: SmartInvoice merchant account UID
                applicationId:
                  type: string
                  description: SmartInvoice application UID
                  format: password
              required:
                - merchantId
                - applicationId
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/SmartInvoice3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/SmartInvoice3dsServers'
    SparkPay:
      description: SparkPay config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: SparkPay credentials object
              properties:
                shopId:
                  type: string
                  description: SparkPay shop ID
                secretKey:
                  type: string
                  description: SparkPay secret key
                  format: password
              required:
                - shopId
                - secretKey
    StaticGateway:
      description: StaticGateway Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
    Stripe3dsServers:
      description: Stripe 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Stripe3dsServer: '#/components/schemas/Stripe3dsServer'
      type: object
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Stripe3dsServer
    Stripe3dsServer:
      description: Stripe Integrated
      allOf:
        - $ref: '#/components/schemas/Stripe3dsServers'
        - type: object
          properties:
            enforceThreeDSecure:
              type: boolean
              description: >-
                If true, Stripe will attempt to perform 3D Secure and overrides
                any [dynamic 3D Secure Radar
                rules](https://stripe.com/docs/radar/rules#request-3ds).
    Stripe:
      description: Stripe Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                redirectUrl:
                  type: string
                  description: Stripe Gateway redirect url
                  format: url
              required:
                - redirectUrl
            settings:
              type: object
              description: Stripe settings object
              properties:
                usePaymentIntents:
                  type: boolean
                  description: >-
                    If `true` the `PaymentIntents` API will be used instead of
                    `Charges` API.
                  default: false
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Stripe3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Stripe3dsServers'
    TestProcessor3dsServers:
      description: TestProcessor3dsServers 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          TestSandbox3dsServer: '#/components/schemas/TestProcessor3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - TestSandbox3dsServer
    TestProcessor3dsServer:
      description: TestProcessor Integrated
      allOf:
        - $ref: '#/components/schemas/TestProcessor3dsServers'
    TestProcessor:
      description: TestProcessor Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          properties:
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/TestProcessor3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/TestProcessor3dsServers'
    ToditoCash:
      description: ToditoCash config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: ToditoCash credentials object
              properties:
                apiKey:
                  type: string
                  description: ToditoCash API key
                  format: password
              required:
                - apiKey
    UPayCard:
      description: UPayCard Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                receiver_account:
                  type: string
                  description: merchant receiver account
                key:
                  type: string
                  description: merchant key
                  format: password
                secret:
                  type: string
                  description: merchant secret
                  format: password
              required:
                - receiver_account
                - key
                - secret
            settings:
              type: object
              description: UpayCard settings object
              properties:
                tolerancePercentage:
                  type: string
                  description: Tolerance paercentage for settled amount
    USAePay:
      description: USAePay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                sourceKey:
                  type: string
                  description: USAePay Gateway source key
                  format: password
                pin:
                  type: string
                  description: USAePay Gateway pin
                  format: password
              required:
                - sourceKey
                - pin
    VantivLitle:
      description: VantivLitle Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                username:
                  type: string
                  description: VantivLitle Gateway username
                password:
                  type: string
                  description: VantivLitle Gateway password
                  format: password
                merchantId:
                  type: string
                  description: VantivLitle Gateway merchant ID
              required:
                - username
                - password
                - merchantId
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/VantivLitle3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/VantivLitle3dsServers'
    Wallet88:
      description: Wallet88 config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: Wallet88 credentials object
              properties:
                username:
                  type: string
                  description: Wallet88 API user
                password:
                  type: string
                  description: Wallet88 API password
                  format: password
              required:
                - username
                - password
    Walpay:
      description: Walpay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantName:
                  type: string
                  description: Walpay Gateway merchant name
                merchantPin:
                  type: string
                  description: Walpay Gateway merchant pin
                  format: password
              required:
                - merchantName
                - merchantPin
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Walpay3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Walpay3dsServers'
    Wirecard3dsServers:
      description: Wirecard 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          Wirecard3dsServer: '#/components/schemas/Wirecard3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - Wirecard3dsServer
    Wirecard3dsServer:
      description: Wirecard Integrated
      allOf:
        - $ref: '#/components/schemas/Wirecard3dsServers'
    Wirecard:
      description: Wirecard Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantUsername:
                  type: string
                  description: Wirecard Gateway merchant username
                merchantPassword:
                  type: string
                  description: Wirecard Gateway merchant password
                  format: password
                businessSignature:
                  type: string
                  description: Wirecard Gateway merchant business case signature
                  format: password
                delay:
                  type: integer
                  description: Wirecard Gateway delay
                sftpUsername:
                  type: string
                  description: Wirecard sftp username.
                sftpPrivateKey:
                  type: string
                  description: Wirecard sftp private key.
                  format: password
              required:
                - merchantUsername
                - merchantPassword
                - businessSignature
                - delay
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Wirecard3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Wirecard3dsServers'
    WorldlineAtosFrankfurt3dsServers:
      description: WorldlineAtosFrankfurt 3DS Servers
      discriminator:
        propertyName: name
        mapping:
          ThreeDSecureIO3dsServer: '#/components/schemas/ThreeDSecureIO3dsServer'
      type: object
      required:
        - name
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/ThreeDSecureServerName'
          enum:
            - ThreeDSecureIO3dsServer
    ThreeDSecureIO3dsServer:
      description: ThreeDSecureIO3dsServer
      allOf:
        - $ref: '#/components/schemas/WorldlineAtosFrankfurt3dsServers'
        - type: object
          required:
            - merchantId
            - merchantName
            - merchantAcquirerBinVisa
            - merchantAcquirerBinMastercard
            - merchantCountry
            - merchantUrl
          properties:
            merchantId:
              type: string
              description: Merchant Id
              maxLength: 24
            merchantName:
              type: string
              description: Merchant Name
              maxLength: 25
            merchantAcquirerBinVisa:
              type: string
              description: Visa Acquirer BIN
              minLength: 6
              maxLength: 11
            merchantAcquirerBinMastercard:
              type: string
              description: Mastercard Acquirer BIN
              minLength: 6
              maxLength: 11
            merchantCountry:
              type: string
              description: Merchant Country ISO Alpha-2 Code
              maxLength: 2
              example: US
            merchantUrl:
              type: string
              description: Merchant URL
              maxLength: 2048
            v1:
              type: boolean
              description: |
                Value determines if requests can use version 1 of 3DS.
                In case both v1 and v2 are enabled it will prefer v2.
                If v2 is not supported for the issuer, it will coalesce to v1.
            v2:
              type: boolean
              description: |
                Value determines if requests will attempt version 2 of 3DS.
                In case both v1 and v2 are enabled it will prefer v2.
                If v2 is not supported for the issuer, it will coalesce to v1.
    WorldlineAtosFrankfurt:
      description: WorldlineAtosFrankfurt Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
            - settings
          properties:
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/WorldlineAtosFrankfurt3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/WorldlineAtosFrankfurt3dsServers'
            credentials:
              type: object
              description: WorldlineAtosFrankfurt credentials
              properties:
                cardAcceptorIdCode:
                  type: string
                  description: Card Acceptor ID Code
                acquiringInstitutionIdentificationCode:
                  type: string
                  description: Acquiring Institution Identification Code
              required:
                - cardAcceptorIdCode
                - acquiringInstitutionIdentificationCode
            settings:
              type: object
              description: WorldlineAtosFrankfurt settings
              properties:
                cardAcceptorName:
                  type: string
                  description: Card Acceptor Name
                cardAcceptorLocation:
                  type: string
                  description: Card Acceptor Location
                cardAcceptorCountryCode:
                  type: string
                  description: Card Acceptor Country Code
              required:
                - cardAcceptorName
                - cardAcceptorLocation
                - cardAcceptorCountryCode
    Worldpay:
      description: Worldpay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                merchantCode:
                  type: string
                  description: Worldpay Gateway merchant code
                  format: password
                merchantPassword:
                  type: string
                  description: Worldpay Gateway merchant password
                  format: password
              required:
                - merchantCode
                - merchantPassword
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/Worldpay3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/Worldpay3dsServers'
    Zotapay:
      description: Zotapay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                endpointId:
                  type: string
                  description: Zotapay's endpoint ID
                merchantId:
                  type: string
                  description: Zotapay's merchant ID
                merchantSecretKey:
                  type: string
                  description: Zotapay's merchant secret key
                  format: password
              required:
                - endpointId
                - merchantId
                - merchantSecretKey
    eMerchantPay:
      description: eMerchantPay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                clientId:
                  type: string
                  description: eMerchantPay Gateway client ID
                apiKey:
                  type: string
                  description: eMerchantPay Gateway api key
                  format: password
                username:
                  type: string
                  description: eMerchantPay username for Genesis platform
                token:
                  type: string
                  description: eMerchantPay token for Genesis platform
                password:
                  type: string
                  description: eMerchantPay password for Genesis platform
                  format: password
            settings:
              type: object
              description: eMerchantPay settings object
              properties:
                platform:
                  type: string
                  description: eMerchantPay platform to process payment. default to IPG
                  enum:
                    - IPG
                    - Genesis
            mpi:
              deprecated: true
              allOf:
                - $ref: '#/components/schemas/eMerchantPay3dsServers'
            threeDSecureServer:
              $ref: '#/components/schemas/eMerchantPay3dsServers'
    ecoPayz:
      description: ecoPayz config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: ecoPayz credentials object
              properties:
                paymentPageId:
                  type: string
                  description: ecoPayz payment page ID
                merchantAccountNumber:
                  type: string
                  description: ecoPayz merchant account number
                merchantPassword:
                  type: string
                  description: ecoPayz merchant password
                  format: password
              required:
                - paymentPageId
                - merchantAccountNumber
                - merchantPassword
            settings:
              type: object
              description: ecoPayz settings object
              properties:
                validCurrency:
                  type: string
                  description: Three letter currency code
                  enum:
                    - CAD
                    - EUR
                    - GBP
                    - USD
              required:
                - validCurrency
    iCanPay:
      description: iCanPay Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                authenticateId:
                  type: string
                  description: iCanPay Gateway authenticate ID
                authenticatePw:
                  type: string
                  description: iCanPay Gateway authenticate password
                  format: password
                publicKey:
                  type: string
                  description: iCanPay Gateway API public key
                secretKey:
                  type: string
                  description: iCanPay Gateway API secret key
                  format: password
              required:
                - authenticateId
                - authenticatePw
                - publicKey
                - secretKey
            settings:
              type: object
              properties:
                use3DSEndpoint:
                  type: boolean
                  description: Use 3DS endpoint
    iCheque:
      description: iCheque Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                clientId:
                  type: string
                  description: iCheque Gateway client ID
                secretWord:
                  type: string
                  description: iCheque Gateway secret word
                  format: password
                apiUserId:
                  type: string
                  description: Username for the Alliance API (transaction reporting)
                apiSecurityToken:
                  type: string
                  description: >-
                    Hash of the password for the Alliance API (transaction
                    reporting)
                  format: password
              required:
                - clientId
                - secretWord
    iDebit:
      description: iDebit config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              description: iDebit credentials object
              properties:
                merchantId:
                  type: string
                  description: iDebit merchant account number
                password:
                  type: string
                  description: iDebit merchant account password
                  format: password
              required:
                - merchantId
                - password
    vegaaH:
      description: vegaaH Gateway config
      allOf:
        - $ref: '#/components/schemas/GatewayAccount'
        - type: object
          required:
            - credentials
          properties:
            credentials:
              type: object
              properties:
                terminalId:
                  type: string
                  description: vegaaH Gateway terminal ID
                password:
                  type: string
                  description: vegaaH Gateway password
                  format: password
              required:
                - terminalId
                - password
    GatewayAccountEmbed:
      type: object
      description: Gateway Account object
      readOnly: true
      properties:
        gatewayAccount:
          $ref: '#/components/schemas/GatewayAccount'
    AuthTransactionLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - authTransaction
      required:
        - rel
    AuthTransactionEmbed:
      type: object
      description: Auth Transaction object
      readOnly: true
      properties:
        authTransaction:
          $ref: '#/components/schemas/Transactions_Transaction'
    PaymentCard:
      type: object
      required:
        - customerId
      properties:
        id:
          description: The card identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        customerId:
          description: The Customer's ID.
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        method:
          description: The method of payment instrument.
          type: string
          readOnly: true
          enum:
            - payment-card
        bin:
          description: The card's bin (the PAN's first 6 digits)
          type: string
          format: bin
          readOnly: true
        last4:
          description: The PAN's last 4 digits
          type: string
          readOnly: true
        expYear:
          description: Card's expiry year.
          type: integer
        expMonth:
          description: Card's expiry month.
          type: integer
        billingAddress:
          description: The Billing Address.
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        fingerprint:
          description: >-
            A unique value to identify the PAN regardless of expiration dates.
            It contains alphanumeric values.
          type: string
          readOnly: true
        browserData:
          $ref: '#/components/schemas/BrowserData'
        panFingerprint:
          deprecated: true
          description: >-
            A unique value to identify the PAN regardless of expiration dates.
            It contains alphanumeric values. Use `fingerprint` instead.
          type: string
          readOnly: true
        status:
          description: >
            Payment Card status.  When a card is `active` it means it has been
            used at least once for an approved transaction.

            To remove a card from being in use, set it as `deactivated` (see the
            deactivation endpoint).
          type: string
          readOnly: true
          enum:
            - active
            - expired
            - inactive
            - deactivated
            - pending
            - verification-needed
        brand:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/PaymentCardBrand'
        bankCountry:
          description: Payment Card bank country
          type: string
          readOnly: true
        bankName:
          description: Payment Card bank name
          type: string
          readOnly: true
        stickyGatewayAccountId:
          description: Default Gateway Account ID used for transactions
          type: string
          readOnly: true
        createdTime:
          description: Card created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Card updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        expirationReminderTime:
          description: Time expiration reminder event will be triggered
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        expirationReminderNumber:
          description: Number of expiration reminder events triggered
          type: integer
          readOnly: true
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/CustomerLink'
              - $ref: '#/components/schemas/AuthTransactionLink'
              - $ref: '#/components/schemas/ApprovalUrlLink'
        _embedded:
          type: array
          description: >-
            Any embedded objects available that are requested by the `expand`
            querystring parameter.
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/AuthTransactionEmbed'
              - $ref: '#/components/schemas/CustomerEmbed'
    PaymentCardEmbed:
      type: object
      description: Payment Card object
      readOnly: true
      properties:
        paymentCard:
          $ref: '#/components/schemas/PaymentCard'
    BankAccountEmbed:
      type: object
      description: Bank Account object
      readOnly: true
      properties:
        bankAccount:
          $ref: '#/components/schemas/BankAccount'
    InvoicesEmbed:
      type: object
      description: Invoices collection
      readOnly: true
      properties:
        invoices:
          type: array
          items:
            $ref: '#/components/schemas/Invoices_Invoice'
    TransactionEmbed:
      type: object
      description: Transaction object
      readOnly: true
      properties:
        transaction:
          $ref: '#/components/schemas/Transactions_Transaction'
    Dispute:
      type: object
      required:
        - currency
        - transactionId
        - postedTime
        - type
        - status
        - reasonCode
      properties:
        id:
          description: The dispute identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        customerId:
          description: The dispute's customer ID
          type: string
          readOnly: true
        transactionId:
          description: The dispute's transaction ID
          type: string
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        amount:
          description: The dispute amount
          type: number
          format: double
        acquirerReferenceNumber:
          description: The dispute's acquirer reference number
          type: string
        reasonCode:
          description: The dispute's reason code
          type: string
          enum:
            - '1000'
            - '10.1'
            - '10.2'
            - '10.3'
            - '10.4'
            - '10.5'
            - '11.1'
            - '11.2'
            - '11.3'
            - '12'
            - '12.1'
            - '12.2'
            - '12.3'
            - '12.4'
            - '12.5'
            - '12.6'
            - '12.7'
            - '13.1'
            - '13.2'
            - '13.3'
            - '13.4'
            - '13.5'
            - '13.6'
            - '13.7'
            - '13.8'
            - '13.9'
            - '2'
            - '30'
            - '31'
            - '35'
            - '37'
            - '40'
            - '41'
            - '42'
            - '46'
            - '47'
            - '49'
            - '50'
            - '53'
            - '54'
            - '55'
            - '57'
            - '59'
            - '60'
            - '62'
            - '7'
            - '70'
            - '71'
            - '72'
            - '73'
            - '74'
            - '75'
            - '76'
            - '77'
            - '79'
            - '8'
            - '80'
            - '81'
            - '82'
            - '83'
            - '85'
            - '86'
            - '93'
            - '00'
            - '63'
            - A01
            - A02
            - A08
            - F10
            - F14
            - F22
            - F24
            - F29
            - C02
            - C04
            - C05
            - C08
            - C14
            - C18
            - C28
            - C31
            - C32
            - M10
            - M49
            - P01
            - P03
            - P04
            - P05
            - P07
            - P08
            - P22
            - P23
            - R03
            - R13
            - M01
            - FR1
            - FR4
            - FR6
            - AL
            - AP
            - AW
            - CA
            - CD
            - CR
            - DA
            - DP
            - DP1
            - EX
            - IC
            - IN
            - IS
            - LP
            - 'N'
            - NA
            - NC
            - P
            - RG
            - RM
            - RN1
            - RN2
            - SV
            - TF
            - TNM
            - UA01
            - UA02
            - UA32
            - UA99
            - UA03
            - UA10
            - UA11
            - UA12
            - UA18
            - UA20
            - UA21
            - UA22
            - UA23
            - UA28
            - UA30
            - UA31
            - UA38
            - duplicate
            - fraudulent
            - subscription_canceled
            - product_unacceptable
            - product_not_received
            - unrecognized
            - credit_not_processed
            - customer_initiated
            - incorrect_account_details
            - insufficient_funds
            - bank_cannot_process
            - debit_not_authorized
            - general
        category:
          description: The dispute's category
          type: string
          readOnly: true
          enum:
            - fraud
            - unrecognized
            - product-not-received
            - product-unacceptable
            - product-not-refunded
            - duplicate
            - subscription-canceled
            - uncategorized
        type:
          description: The dispute's type
          type: string
          enum:
            - information-request
            - first-chargeback
            - second-chargeback
            - arbitration
        status:
          description: The dispute's status
          type: string
          enum:
            - response-needed
            - under-review
            - forfeited
            - won
            - lost
            - unknown
        postedTime:
          description: Dispute posted time
          type: string
          format: date-time
        deadlineTime:
          description: Dispute deadline time
          type: string
          format: date-time
        rawResponse:
          description: Dispute raw response from gateway
          type: string
          readOnly: true
        resolvedTime:
          description: Dispute resolved time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        createdTime:
          description: Dispute created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Dispute updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/TransactionLink'
        _embedded:
          type: array
          description: >-
            Any embedded objects available that are requested by the `expand`
            querystring parameter.
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/TransactionEmbed'
    EventType:
      type: string
      description: Rebilly event type
      readOnly: true
      enum:
        - dispute-created
        - gateway-account-requested
        - transaction-processed
        - subscription-activated
        - subscription-canceled
        - subscription-created
        - subscription-renewed
        - payment-card-expired
        - invoice-past-due
        - invoice-paid
        - transaction-declined
        - transaction-process-requested
        - risk-score-changed
        - transaction-discrepancy-found
    MatchedRule:
      type: object
      readOnly: true
      properties:
        id:
          description: Event tracking id
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        event:
          $ref: '#/components/schemas/EventType'
        description:
          description: Rule's description
          type: string
        rulesVersion:
          type: integer
          description: Rule version
        occurredTime:
          description: Time when event occurred.
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        context:
          type: object
          description: Event's context
          additionalProperties:
            type: string
        processedRules:
          type: object
          description: Processed rules
          properties:
            name:
              type: string
              description: Rule name
            actions:
              type: array
              description: Rule actions applied
              items:
                type: string
            result:
              type: string
              description: Rule result
    FileCreateFromInline:
      type: object
      required:
        - file
      properties:
        file:
          description: The file in base64 encoded format.
          type: string
          example: R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=
        isPublic:
          description: The File visibility. If public a permalink is provided.
          type: boolean
          example: false
        name:
          description: The file name used for downloading
          type: string
          example: logo.png
        description:
          description: The file description
          type: string
          example: My file description
        tags:
          description: The tags list
          type: array
          items:
            type: string
          example:
            - test
            - tags
    FileCreateFromUrl:
      type: object
      required:
        - url
      properties:
        url:
          description: The URL of the file to upload.
          type: string
          example: >-
            https://blog.rebilly.com/wp-content/uploads/2017/09/rb_LogoInverted_Small.png
        isPublic:
          description: The File visibility. If public a permalink is provided.
          type: boolean
          example: false
        name:
          description: The file name used for downloading
          type: string
          example: logo.png
        description:
          description: The file description
          type: string
          example: My file description
        tags:
          description: The tags list
          type: array
          items:
            type: string
          example:
            - test
            - tags
    InvoiceIssue:
      type: object
      properties:
        issuedTime:
          description: >-
            Invoice issued time. Will be issued immediately if `null` or
            omitted.
          type: string
          format: date-time
          nullable: true
        dueTime:
          description: >-
            Invoice due time. Will be set same as `issuedTime` if `null` or
            omitted.
          type: string
          format: date-time
          nullable: true
    InvoiceReissue:
      type: object
      properties:
        dueTime:
          description: >-
            Invoice due time. Will be set as current date-time if `null` or
            omitted.
          type: string
          format: date-time
          nullable: true
    InvoiceTimeline:
      type: object
      properties:
        id:
          description: The Timeline message identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        type:
          description: Timeline message type
          type: string
          readOnly: true
          enum:
            - timeline-comment-created
            - invoice-created
            - invoice-issued
            - invoice-abandoned
            - invoice-voided
            - invoice-past-due
            - invoice-paid
            - invoice-partially-paid
            - invoice-disputed
            - invoice-refunded
            - invoice-partially-refunded
            - invoice-renewal-payment-declined
            - email-message-sent
            - coupon-applied
            - transaction-approved
            - transaction-abandoned
            - transaction-canceled
            - transaction-declined
            - transaction-refunded
            - transaction-voided
        triggeredBy:
          description: Shows who or what triggered the Timeline event
          type: string
          readOnly: true
          enum:
            - rebilly
            - app
            - direct-api
        message:
          description: The message that describes the message details
          type: string
        extraData:
          $ref: '#/components/schemas/TimelineExtraData'
        occurredTime:
          description: Timeline message time
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    InvoiceLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - invoice
      required:
        - rel
    InvoiceTransactionAllocation:
      type: object
      properties:
        invoiceId:
          $ref: '#/components/schemas/ResourceId'
        transactionId:
          $ref: '#/components/schemas/ResourceId'
        amount:
          type: number
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 2
          maxItems: 2
          items:
            anyOf:
              - $ref: '#/components/schemas/InvoiceLink'
              - $ref: '#/components/schemas/TransactionLink'
    KycDocumentRejection:
      type: object
      readOnly: true
      properties:
        type:
          type: string
          enum:
            - document-unreadable
            - document-expired
            - document-not-matching
            - underage-person
            - other
        message:
          description: The rejection message
          type: string
          example: Provided document is unreadable
    KycDocument:
      type: object
      required:
        - fileId
        - customerId
        - documentType
        - status
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        customerId:
          description: The сustomer's ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        fileId:
          description: Linked file object id
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        documentType:
          description: >-
            Document type submitted for validation, only identity-proof type is
            analyzed in an automated manner.
          type: string
          enum:
            - identity-proof
            - address-proof
        status:
          description: Status of the validation
          type: string
          readOnly: true
          enum:
            - pending
            - in-progress
            - accepted
            - rejected
        rejectionReason:
          $ref: '#/components/schemas/KycDocumentRejection'
        createdTime:
          description: Creation date/time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Latest update date/time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        processedTime:
          description: Processing date/time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    KycDocumentMatches:
      type: object
      readOnly: true
      properties:
        score:
          description: >-
            The calculated score that represents the % of confidence that this
            ID represents the given customer
          type: number
          format: double
          example: 0.75
        data:
          type: object
          properties:
            containsImage:
              description: >-
                Flag that indicates if there is an image that contains a face on
                it
              type: boolean
              example: true
            isIdentityDocument:
              description: Flag that indicates if this looks like and ID
              type: boolean
              example: true
            isPublishedOnline:
              description: If there is an exact match found online
              type: boolean
              example: false
            firstName:
              description: 'The customer first name if it was matched, null otherwise'
              type: string
              example: John
            lastName:
              description: 'The customer last name if it was matched, null otherwise'
              type: string
              example: Doe
            dateOfBirth:
              description: 'The date of birth found on the document, null if not found'
              allOf:
                - $ref: '#/components/schemas/ServerTimestamp'
            expiryDate:
              description: 'The expiry date found on the document, null if not found'
              allOf:
                - $ref: '#/components/schemas/ServerTimestamp'
            issueDate:
              description: 'The issued date found on the document, null if not found'
              allOf:
                - $ref: '#/components/schemas/ServerTimestamp'
            hasMinimalAge:
              description: >-
                Checks the minimal age, 21+ for USA and 18+ for all other
                countries. Null if dateOfBirth could not be determined.
              type: boolean
              example: true
    KycDocument_KycDocument:
      allOf:
        - $ref: '#/components/schemas/KycDocument'
        - properties:
            reviewerId:
              description: Reviewer's user ID.
              type: string
              nullable: true
              readOnly: true
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            reviewerName:
              description: Reviewer's first and last name.
              type: string
              nullable: true
              readOnly: true
            reviewTime:
              description: Date and time of manual review.
              nullable: true
              allOf:
                - $ref: '#/components/schemas/ServerTimestamp'
            documentMatches:
              $ref: '#/components/schemas/KycDocumentMatches'
            _links:
              type: array
              description: The links related to resource
              readOnly: true
              minItems: 3
              items:
                anyOf:
                  - $ref: '#/components/schemas/SelfLink'
                  - $ref: '#/components/schemas/FileLink'
                  - $ref: '#/components/schemas/CustomerLink'
    ResetPasswordToken:
      type: object
      required:
        - username
        - password
      properties:
        token:
          description: The token's identifier string
          type: string
          readOnly: true
        username:
          description: The token's username
          type: string
        credentialId:
          description: Token's credential ID
          type: string
          readOnly: true
        expiredTime:
          description: Password expired time
          type: string
          format: date-time
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    PaymentCardCreateToken:
      type: object
      required:
        - customerId
        - token
      properties:
        customerId:
          description: The Customer's ID.
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        token:
          description: PaymentCardToken ID.
          type: string
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
    PaymentCardCreatePlain:
      type: object
      required:
        - customerId
        - pan
        - expYear
        - expMonth
        - billingAddress
      properties:
        customerId:
          description: The Customer's ID.
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        pan:
          description: The card PAN (Primary Account Number).
          type: string
          writeOnly: true
        expYear:
          description: Card's expiry year.
          type: integer
        expMonth:
          description: Card's expiry month.
          type: integer
        cvv:
          description: Card's cvv (card verification value).
          type: string
          writeOnly: true
        billingAddress:
          description: The Billing Address.
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        browserData:
          $ref: '#/components/schemas/BrowserData'
    PaymentInstrumentValidation:
      type: object
      required:
        - method
        - paymentInstrumentId
      properties:
        id:
          description: Payment instrument validation ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        method:
          description: Payment method
          type: string
        paymentInstrumentId:
          description: Payment instrument ID
          type: string
        actionCode:
          description: Action code
          type: string
          readOnly: true
        responseCode:
          description: Response code
          type: string
          readOnly: true
        avsResult:
          description: Address verification result
          type: string
          readOnly: true
        cvvResult:
          description: CVV result
          type: string
          readOnly: true
        billingAddress:
          description: Billing address.
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        expYear:
          description: Payment card's expiration year.
          type: integer
          readOnly: true
        expMonth:
          description: Payment card's expiration month.
          type: integer
          readOnly: true
        createdTime:
          description: Payment instrument validation created time.
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    PayPalAccount:
      type: object
      title: PayPal Account
      properties:
        id:
          description: The PayPal identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        method:
          description: The method of payment instrument.
          type: string
          readOnly: true
          enum:
            - paypal
        customerId:
          description: The Customer's ID.
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        billingAddress:
          description: The Customer's Billing Address.
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        username:
          description: PayPal username.
          type: string
          readOnly: true
        status:
          description: PayPal Account status
          type: string
          readOnly: true
          enum:
            - inactive
            - active
            - deactivated
        browserData:
          $ref: '#/components/schemas/BrowserData'
        createdTime:
          description: PayPal Account created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: PayPal Account updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/CustomerLink'
              - $ref: '#/components/schemas/ApprovalUrlLink'
      required:
        - customerId
        - billingAddress
    TransactionRedirectUrl:
      description: >
        The URL to redirect the end-user when an offsite transaction is
        completed.

        The 2 placeholders are available to use in this URI: `{id}` and
        `{result}`.

        Defaults to the website's configured URL.
      type: string
      format: uri
    PayPalAccountAuthorization:
      type: object
      required:
        - websiteId
        - currency
      properties:
        websiteId:
          description: The Website ID
          type: string
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        amount:
          description: The amount to authorize
          type: number
          format: double
          default: 1
        gatewayAccountId:
          description: The Gateway Account ID which use to send transactions
          type: string
        redirectUrl:
          $ref: '#/components/schemas/TransactionRedirectUrl'
    schemas_Product: *ref_0
    InitialInvoiceLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - initialInvoice
      required:
        - rel
    RecentInvoiceLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - recentInvoice
      required:
        - rel
    RecentInvoiceEmbed:
      type: object
      description: Recent Invoice object
      readOnly: true
      properties:
        recentInvoice:
          $ref: '#/components/schemas/Invoices_Invoice'
    InitialInvoiceEmbed:
      type: object
      description: Initial Invoice object
      readOnly: true
      properties:
        initialInvoice:
          $ref: '#/components/schemas/Invoices_Invoice'
    Subscription:
      type: object
      discriminator:
        propertyName: orderType
        mapping:
          one-time-order: '#/components/schemas/one-time-order'
          subscription-order: '#/components/schemas/subscription-order'
      required:
        - orderType
        - customerId
        - websiteId
        - items
      properties:
        id:
          description: The Subscription identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        orderType:
          description: |
            Specifies the type of order, a subscription or a one-time purchase.
          type: string
          enum:
            - subscription-order
            - one-time-order
          default: subscription-order
        billingStatus:
          description: |
            The billing status of the most recent invoice.  It may
            help you determine if you should change the service status
            such as suspending the service.
          type: string
          readOnly: true
          enum:
            - unpaid
            - past-due
            - delinquent
            - paid
            - voided
            - refunded
            - disputed
            - voided
        customerId:
          description: Unique id for each customer
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        websiteId:
          description: Unique id for each website
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        initialInvoiceId:
          description: Unique id for the initial invoice
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        recentInvoiceId:
          description: >-
            Unique id for the most recently issued invoice. It might not be
            `paid` yet.
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        items:
          type: array
          minItems: 1
          items:
            type: object
            required:
              - planId
            properties:
              planId:
                description: Unique id for each plan
                allOf:
                  - $ref: '#/components/schemas/ResourceId'
              quantity:
                description: Number of units of the product on the given plan
                type: integer
        deliveryAddress:
          description: Delivery address
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        billingAddress:
          description: Billing address
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        riskMetadata:
          nullable: true
          example: null
          description: >-
            Risk metadata. If null, the value would coalesce to the risk
            metadata captured when creating the payment token.
          allOf:
            - $ref: '#/components/schemas/RiskMetadata'
        activationTime:
          description: Subscription activation time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        couponIds:
          type: array
          nullable: true
          description: >
            A list of coupons to redeem on the customer and restrict to this
            subscription.

            Read more about [coupons
            here](https://docs.rebilly.com/docs/dashboard/marketing/coupons-and-discounts/).


            This parameter respects the following logic:


            - When not passed then applied coupons will not be changed.


            - When empty array passed then all applied coupon redemptions will
            be canceled.


            - When list of coupons is passed then not applied yet coupons will
            be applied, already applied coupons

            will not change their state, applied coupons that are not presented
            in passed list will be canceled.


            If list of applied coupons on pending subscription will be changed
            due to this param during update subscription,
             Invoice for the subscription will be reissued.
          writeOnly: true
          items:
            type: string
            description: Coupon ID
        poNumber:
          description: 'Purchase order number, will be displayed on the issued invoices'
          nullable: true
          example: PO123456
          type: string
        revision:
          description: >
            The number of times the subscription data has been modified.

            The revision is useful when analyzing webhook data to determine if
            the change takes precedence over the current representation.
          type: integer
          readOnly: true
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/CustomerLink'
              - $ref: '#/components/schemas/InitialInvoiceLink'
              - $ref: '#/components/schemas/RecentInvoiceLink'
              - $ref: '#/components/schemas/WebsiteLink'
        _embedded:
          type: array
          description: >-
            Any embedded objects available that are requested by the `expand`
            querystring parameter.
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/RecentInvoiceEmbed'
              - $ref: '#/components/schemas/InitialInvoiceEmbed'
              - $ref: '#/components/schemas/CustomerEmbed'
              - $ref: '#/components/schemas/WebsiteEmbed'
              - $ref: '#/components/schemas/LeadSourceEmbed'
    SubscriptionMetadata:
      type: object
      properties:
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        createdTime:
          description: Subscription created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Subscription updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/CustomerLink'
              - $ref: '#/components/schemas/WebsiteLink'
              - $ref: '#/components/schemas/LeadSourceLink'
    one-time-order:
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - properties:
            status:
              description: One-time order status
              type: string
              readOnly: true
              enum:
                - pending
                - completed
                - abandoned
        - $ref: '#/components/schemas/SubscriptionMetadata'
    UpcomingInvoiceItem:
      type: object
      description: Line item
      required:
        - type
        - unitPriceAmount
        - unitPriceCurrency
        - quantity
      properties:
        type:
          description: Type of line item
          type: string
          enum:
            - debit
            - credit
        description:
          description: Description of line item
          type: string
        unitPriceAmount:
          description: Unit price of the line item
          type: number
          format: double
          example: 49.95
        unitPriceCurrency:
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        quantity:
          description: Quantity of line item
          type: integer
          example: 1
        periodStartTime:
          description: Date-time when the period begins for this item
          type: string
          format: date-time
        periodEndTime:
          description: Date-time when the period ends for this item
          type: string
          format: date-time
        createdTime:
          description: Date-time when the item was added to the subscription
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    UpcomingInvoiceItemCollection:
      type: array
      items:
        $ref: '#/components/schemas/UpcomingInvoiceItem'
    SubscriptionCancellationState:
      type: object
      properties:
        canceledTime:
          description: Subscription canceled time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        canceledBy:
          description: Canceled by
          type: string
          readOnly: true
          enum:
            - merchant
            - customer
            - rebilly
        cancelCategory:
          description: Cancel category
          type: string
          readOnly: true
          enum:
            - billing-failure
            - did-not-use
            - did-not-want
            - missing-features
            - bugs-or-problems
            - do-not-remember
            - risk-warning
            - contract-expired
            - too-expensive
            - never-started
            - switched-plan
            - other
        cancelDescription:
          description: Cancel reason description in free form
          type: string
          readOnly: true
          maxLength: 255
    subscription-order:
      allOf:
        - $ref: '#/components/schemas/Subscription'
        - properties:
            status:
              description: |
                The status of the subscription service. A subscription starts
                in the `pending` status, and will become `active` when the
                service period begins.
              type: string
              readOnly: true
              enum:
                - pending
                - active
                - canceled
                - churned
                - suspended
                - paused
                - abandoned
            inTrial:
              description: True if the subscription is currently in a trial period
              type: boolean
              readOnly: true
            trial:
              type: object
              description: >-
                To use plan defaults do not send the `trial` key, or send a
                `null` value with it.
              required:
                - endTime
              properties:
                enabled:
                  description: >-
                    Enable or disable the trial for this subscription. If
                    enabled for plans without trial prices, the trial will be
                    free.
                  type: boolean
                endTime:
                  description: The time the trial should end
                  type: string
                  format: date-time
            invoiceTimeShift:
              description: >
                You can shift issue time and due time of invoices for this
                subscription.

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

                To use multiple plans in one subscription they all must have the
                same billing period,

                this property allows to subscribe to different plans.
              nullable: true
              example: null
              allOf:
                - $ref: '#/components/schemas/InvoiceTimeShift'
            recurringInterval:
              type: object
              description: >
                The recurring interval to override plan settings. To use plan
                settings, set `null`.

                To use multiple plans in one subscription they all must have the
                same recurring period length,

                this property allows to subscribe to different plans.
              nullable: true
              example: null
              properties:
                periodAnchorInstruction:
                  $ref: '#/components/schemas/ServicePeriodAnchorInstruction'
            autopay:
              description: Autopay determines if a payment attempt will be automatic
              type: boolean
              default: true
            startTime:
              description: >-
                Subscription start time.  When the value is sent as null, it
                will use the current time. This value can't be in past more than
                one service period.
              nullable: true
              example: null
              type: string
              format: date-time
            endTime:
              description: Subscription end time
              allOf:
                - $ref: '#/components/schemas/ServerTimestamp'
            renewalTime:
              description: Subscription renewal time
              type: string
              format: date-time
            rebillNumber:
              description: The current period number
              type: integer
              readOnly: true
            renewalReminderTime:
              description: Time renewal reminder event will be triggered
              nullable: true
              allOf:
                - $ref: '#/components/schemas/ServerTimestamp'
            renewalReminderNumber:
              description: Number of renewal reminder events triggered
              type: integer
              readOnly: true
            trialReminderTime:
              description: Time renewal reminder event will be triggered
              nullable: true
              allOf:
                - $ref: '#/components/schemas/ServerTimestamp'
            trialReminderNumber:
              description: Number of renewal reminder events triggered
              type: integer
              readOnly: true
            lineItems:
              description: >-
                Subscription line items which queue until the next renewal (or
                interim) invoice is issued for the subscription.
              readOnly: true
              allOf:
                - $ref: '#/components/schemas/UpcomingInvoiceItemCollection'
            lineItemSubtotal:
              type: object
              readOnly: true
              description: >-
                Subtotal of line items in this subscription (signed value). If
                credits exceed debits, it will be a negative number.
              properties:
                currency:
                  $ref: '#/components/schemas/CurrencyCode'
                amount:
                  type: number
                  format: double
                  example: 49.95
        - $ref: '#/components/schemas/SubscriptionMetadata'
        - $ref: '#/components/schemas/SubscriptionCancellationState'
    Search:
      type: object
      properties:
        customers:
          description: List of returned customers
          readOnly: true
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/Customer'
        invoices:
          description: List of returned invoices
          readOnly: true
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/Invoices_Invoice'
        orders:
          description: List of returned orders
          readOnly: true
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/Subscription'
        transactions:
          description: List of returned transactions
          readOnly: true
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/Transactions_Transaction'
        searched:
          description: 'Names of searched resources, even if they returned nothing'
          readOnly: true
          type: array
          items:
            type: string
    PriceBasedShippingRate:
      type: object
      required:
        - name
        - currency
        - price
      properties:
        name:
          description: The shipping rate name
          type: string
          maxLength: 255
        minOrderSubtotal:
          description: >-
            Minimum order subtotal for which this shipping rate is applicable,
            defaults to 0.00
          type: number
          format: double
          default: 0
        maxOrderSubtotal:
          description: >-
            Maximum order subtotal for which this shipping rate is applicable
            (NULL if no maximum)
          type: number
          format: double
        price:
          description: The shipping price - 0 is a valid value (for free)
          type: number
          format: double
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    ShippingZone:
      type: object
      required:
        - name
      properties:
        id:
          description: The shipping zone identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        name:
          description: The shipping zone name
          type: string
          maxLength: 255
        countries:
          description: >
            Countries covered by the shipping zone. A country can only belong to
            one shipping zone (no overlapping).

            This property can be empty or null to create a default shipping zone
            for countries that were not specified in other zones.
          type: array
          items:
            description: Country ISO Alpha-2 code
            type: string
            pattern: '^[A-Z]{2}$'
        rates:
          description: Price-based shipping rate instructions
          type: array
          items:
            description: Price based shipping rate instruction
            allOf:
              - $ref: '#/components/schemas/PriceBasedShippingRate'
        isDefault:
          description: Is this Shipping Zone default
          readOnly: true
        createdTime:
          description: The shipping zone created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The shipping zone updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    SubscriptionCancellation:
      type: object
      required:
        - subscriptionId
        - churnTime
      properties:
        id:
          description: Cancellation identifier
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        subscriptionId:
          description: Identifier of the canceled subscription
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        proratedInvoiceId:
          description: >-
            Identifier of the invoice on which the cancellation proration is
            calculated.
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        appliedInvoiceId:
          description: >-
            The identifier of the invoice where the cancellation fees or credits
            are applied.
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        canceledBy:
          description: Who did the cancellation
          type: string
          default: customer
          enum:
            - merchant
            - customer
        reason:
          description: Cancellation reason
          type: string
          default: other
          enum:
            - did-not-use
            - did-not-want
            - missing-features
            - bugs-or-problems
            - do-not-remember
            - risk-warning
            - contract-expired
            - too-expensive
            - other
            - billing-failure
        description:
          description: Cancel reason description in free form
          type: string
          maxLength: 255
        prorated:
          description: >
            Defines if the customer gets a pro-rata credit for the time
            remaining between `churnTime` and

            subscription's next renewal time.
          type: boolean
          default: false
        status:
          description: >
            "draft" defines that the cancellation isn't applied on an invoice
            and subscription but

            can be inspected to see the charge.

            "confirmed" will set a subscription to be canceled when the
            `churnTime` is reached.

            "completed" is a read-only status which is set by the system when
            the churnTime is reached.

            The cancellation may not be changed or deleted when the status is
            "completed".
          type: string
          default: confirmed
          enum:
            - draft
            - confirmed
            - completed
            - revoked
        canceledTime:
          description: >-
            The cancellation time (when the status is confirmed which is by
            default unless specified "draft").
          type: string
          format: date-time
          readOnly: true
        createdTime:
          description: The time of resource creation (when it is posted).
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        churnTime:
          description: The time when the subscription will be deactivated.
          type: string
          format: date-time
        lineItems:
          description: >-
            Items to be added to the new invoice. Proration item is generated
            and added automatically.
          allOf:
            - $ref: '#/components/schemas/UpcomingInvoiceItemCollection'
        lineItemSubtotal:
          description: >-
            Subtotal of the line items which will be added after the
            subscription's cancellation
          readOnly: true
          type: number
          example: 49.95
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    SubscriptionReactivation:
      type: object
      required:
        - subscriptionId
      properties:
        id:
          description: Reactivation identifier
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        subscriptionId:
          description: Identifier of the reactivated subscription
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        cancellationId:
          description: Identifier of the related cancellation
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        description:
          description: Reactivation reason description in free form
          type: string
          maxLength: 255
        effectiveTime:
          description: >
            The date from which the service period would start, unless the
            subscription is canceled but still active.

            In case the susbcription is still active, the subscription will
            continue the current service period.

            If omitted, it will default to the current time.
          type: string
          format: date-time
        renewalTime:
          description: >
            The time of the next subscription renewal. If omitted then it is
            computed from the effective time.

            If the subscription is canceled but active it is ignored, so the
            next renewal will happen as scheduled.
          type: string
          format: date-time
        createdTime:
          description: The time of resource creation (when it is posted).
          type: string
          format: date-time
          readOnly: true
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    SubscriptionChange:
      type: object
      required:
        - planId
        - renewalPolicy
        - prorated
      properties:
        planId:
          description: The plan identifier string
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        quantity:
          description: >-
            Number of units of the product on the given plan. If null or
            omitted, current quantity will not be changed.
          type: integer
        renewalPolicy:
          description: >-
            The value determines whether the subscription retains its current
            `renewalTime` or resets it to a newly calculated `renewalTime`.
          type: string
          enum:
            - reset
            - retain
        prorated:
          description: >
            Whether or not to give a pro rata credit for the amount of time
            remaining between the `effectiveTime` and the end of the current
            period.

            In addition, if the `renewalTime` is retained (by setting the
            `renewalPolicy` to `retain`), then a pro rata debit will occur as
            well,

            for the amount between the `effectiveTime` and the `renewalTime` as
            a percentage of the normal period size.
          type: boolean
        effectiveTime:
          description: >-
            The date from which the renewal time (for `reset` operations) and
            proration calculations are made.  If omitted, it will default to the
            current time.
          type: string
          format: date-time
        preview:
          description: >-
            If set to true, it will not change the subscription.  It allows for
            a way to preview the changes that would be made to a subscription.
          type: boolean
          default: false
    SubscriptionInvoice:
      type: object
      properties:
        transactionId:
          description: >-
            If present, applies a payment to the invoice created.  If the
            payment is for the invoice total, it would be marked as paid.
          allOf:
            - $ref: '#/components/schemas/ResourceId'
    OrderTimeline:
      type: object
      properties:
        id:
          description: The Timeline message identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        type:
          description: Timeline message type
          type: string
          readOnly: true
          enum:
            - timeline-comment-created
            - order-renewed
            - order-activated
            - order-completed
            - order-reactivated
            - order-canceled
            - order-upgraded
            - order-downgraded
            - order-billing-address-changed
            - order-delivery-address-changed
            - order-renewal-time-changed
            - order-churned
            - order-custom-fields-changed
            - order-items-changed
            - order-billing-anchor-changed
            - order-recurring-interval-changed
            - order-risk-metadata-changed
            - order-paid-early
            - order-quantity-changed
            - email-message-sent
            - coupon-applied
            - invoice-created
            - invoice-issued
            - invoice-abandoned
            - invoice-voided
            - invoice-past-due
            - invoice-paid
            - invoice-partially-paid
            - invoice-disputed
            - invoice-refunded
            - invoice-partially-refunded
            - invoice-renewal-payment-declined
        triggeredBy:
          description: Shows who or what triggered the Timeline message
          type: string
          readOnly: true
          enum:
            - rebilly
            - app
            - direct-api
        message:
          description: The message that describes the message details
          type: string
        extraData:
          $ref: '#/components/schemas/TimelineExtraData'
        occurredTime:
          description: Timeline message time
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    TokenMethod:
      type: string
      description: The token payment method
      enum:
        - cash
        - check
        - paypal
        - Alipay
        - AstroPay Card
        - bank-transfer
        - bitcoin
        - Boleto
        - cash-deposit
        - CASHlib
        - CashToCode
        - China UnionPay
        - domestic-cards
        - echeck
        - ecoPayz
        - ecoVoucher
        - EPS
        - ePay.bg
        - Flexepin
        - Giropay
        - Gpaysafe
        - iDebit
        - iDEAL
        - INOVAPAY-pin
        - INOVAPAY-wallet
        - InstaDebit
        - instant-bank-transfer
        - Interac-online
        - Interac-eTransfer
        - invoice
        - Jeton
        - Klarna
        - miscellaneous
        - Neteller
        - Nordea-Solo
        - OchaPay
        - online-bank-transfer
        - Onlineueberweisen
        - Paysafecard
        - Pay4Fun
        - PinPay
        - phone
        - POLi
        - Przelewy24
        - QQPay
        - Resurs
        - SEPA
        - Skrill
        - Skrill Rapid Transfer
        - SMSVoucher
        - SparkPay
        - Trustly
        - UPayCard
        - voucher
        - WeChat Pay
    PaymentToken:
      type: object
      title: Payment Token
      required:
        - method
        - billingAddress
      properties:
        id:
          description: The token identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        isUsed:
          description: Whether the token was already used
          type: boolean
          default: false
          readOnly: true
        method:
          allOf:
            - $ref: '#/components/schemas/TokenMethod'
        fingerprint:
          description: Device fingerprint hash
          type: string
          deprecated: true
        browserData:
          $ref: '#/components/schemas/BrowserData'
        billingAddress:
          description: The billing address object
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        leadSource:
          allOf:
            - $ref: '#/components/schemas/LeadSource'
          writeOnly: true
        createdTime:
          description: Token created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Token updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        usageTime:
          description: Token usage time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        expirationTime:
          description: Token expiration time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    TokenPaymentCardInstrument:
      type: object
      description: Payment Token instrument object
      required:
        - pan
        - billingAddress
        - expMonth
        - expYear
      properties:
        pan:
          description: Payment Card PAN (Primary Account Number)
          type: string
          writeOnly: true
        bin:
          description: Payment Card BIN (the PAN's first 6 digits)
          type: string
          format: bin
          readOnly: true
        last4:
          description: Payment Card PAN's last 4 digits
          type: string
          readOnly: true
        brand:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/PaymentCardBrand'
        expMonth:
          description: Payment Card expiry month
          type: integer
        expYear:
          description: Payment Card expiry year
          type: integer
        cvv:
          description: Payment Card CVV/CVC
          type: string
          writeOnly: true
    PaymentCardToken:
      type: object
      title: Payment Card Token
      required:
        - method
        - paymentInstrument
        - billingAddress
      properties:
        id:
          description: The token identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        isUsed:
          description: Whether the token was already used
          type: boolean
          default: false
          readOnly: true
        method:
          description: The token payment method
          type: string
          enum:
            - payment-card
        paymentInstrument:
          description: The payment instrument details
          allOf:
            - $ref: '#/components/schemas/TokenPaymentCardInstrument'
        fingerprint:
          description: Device fingerprint hash
          type: string
          deprecated: true
        browserData:
          $ref: '#/components/schemas/BrowserData'
        billingAddress:
          description: The billing address object
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        leadSource:
          allOf:
            - $ref: '#/components/schemas/LeadSource'
          writeOnly: true
        createdTime:
          description: Token created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Token updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        usageTime:
          description: Token usage time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        expirationTime:
          description: Token expiration time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    TokenBankAccountInstrument:
      type: object
      required:
        - accountNumberType
      discriminator:
        propertyName: accountNumberType
        mapping:
          BBAN: '#/components/schemas/BBANInstrument'
          IBAN: '#/components/schemas/IBANInstrument'
      properties:
        accountNumberType:
          description: >-
            Bank's Account Number type. A valid value is basic bank account
            number (BBAN) or international bank account number (IBAN).
          type: string
          default: BBAN
          enum:
            - IBAN
            - BBAN
    BBANInstrument:
      description: Payment Token instrument object
      allOf:
        - $ref: '#/components/schemas/TokenBankAccountInstrument'
        - type: object
          required:
            - accountNumber
            - routingNumber
            - accountType
          properties:
            accountNumber:
              description: Bank Account Number
              type: string
              pattern: '^[0-9]+$'
              writeOnly: true
            routingNumber:
              description: Bank Routing Number
              type: string
              pattern: '^[0-9]+$'
            accountType:
              description: Bank Account Type
              type: string
              enum:
                - checking
                - savings
                - other
            bic:
              description: Bank Identifier Code
              type: string
            bankName:
              description: Bank name
              type: string
            last4:
              description: Bank Account Number's last 4 digits
              type: string
              readOnly: true
    IBANInstrument:
      description: Payment Token instrument object
      allOf:
        - $ref: '#/components/schemas/TokenBankAccountInstrument'
        - type: object
          required:
            - accountNumber
          properties:
            accountNumber:
              description: >
                Bank Account Number. Detailed information about all ISO
                13616-compliant national IBAN formats is available

                in [SWIFT IBAN
                Registry](https://www.swift.com/standards/data-standards/iban).
              type: string
              writeOnly: true
            bic:
              description: Bank Identifier Code
              type: string
            bankName:
              description: Bank name
              type: string
            last4:
              description: Bank Account Number's last 4 digits
              type: string
              readOnly: true
    BankAccountToken:
      type: object
      title: Bank Account Token
      required:
        - method
        - paymentInstrument
        - billingAddress
      properties:
        id:
          description: The token identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        isUsed:
          description: Whether the token was already used
          type: boolean
          default: false
          readOnly: true
        method:
          description: The token payment method
          type: string
          enum:
            - ach
        paymentInstrument:
          description: The payment instrument details
          allOf:
            - $ref: '#/components/schemas/TokenBankAccountInstrument'
        fingerprint:
          description: Device fingerprint hash
          type: string
          deprecated: true
        browserData:
          $ref: '#/components/schemas/BrowserData'
        billingAddress:
          description: The billing address object
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        leadSource:
          allOf:
            - $ref: '#/components/schemas/LeadSource'
          writeOnly: true
        createdTime:
          description: Token created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Token updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        usageTime:
          description: Token usage time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        expirationTime:
          description: Token expiration time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    TransactionRequest:
      type: object
      required:
        - websiteId
        - customerId
        - currency
        - amount
        - type
      properties:
        id:
          description: The payment identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        websiteId:
          description: The website identifier string
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        customerId:
          description: The customer identifier string
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyCode'
        type:
          description: >
            The type of transaction requested.

            You should always include the type within your API request.

            This supports a limited subset of Transaction types.  To refund or
            void, use the refund endpoint.

            To `capture` use the `sale` endpoint.  It will capture if there are
            any eligible

            transactions of type `authorize` that can be captured.
          type: string
          enum:
            - sale
            - authorize
            - credit
        amount:
          description: >
            The transaction amount.  Use `0` for a zero dollar verification.
            This is important if

            you want to authorize a payment instrument before giving access to a
            free trial, for example.
          type: number
          format: double
          example: 97.97
        invoiceIds:
          description: >
            The array of invoice identifiers.  It's important to note that the
            transaction

            amount can be more or less than the combined invoice amounts.  If
            the transaction

            is a type `sale` and it is `approved` it will be applied to these
            invoices in

            the order of the first issued invoice to the most recently issued
            invoice.  If

            there are enough funds to fully pay an invoice, the invoice status
            will be marked

            as paid.
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/ResourceId'
        paymentInstrument:
          $ref: '#/components/schemas/PaymentInstrument'
        billingAddress:
          description: >-
            Billing Address. If not supplied, we use the billing address
            associated with the payment instrument, and then customer.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ContactObject'
        requestId:
          description: >-
            The request id is **recommended**. It prevents duplicate transaction
            requests within a short period of time. If a duplicate request is
            sent with the same `requestId` it will be ignored to prevent
            double-billing anyone.  It must be unique within a 24-hour period.
            We recommend generating a UUID v4 as its value.
          type: string
          nullable: true
          maxLength: 50
          pattern: '^[\-\w]+$'
          example: 44433322-2c4y-483z-a0a9-158621f77a21
        description:
          nullable: true
          description: The payment description
          type: string
          maxLength: 255
        notificationUrl:
          nullable: true
          description: >
            The URL where a server-to-server notification request type `POST`
            with a transaction payload will be sent

            when the transaction's result is finalized. Do not trust the
            notification;

            follow with a `GET` request to confirm the result of the
            transaction.  Please respond with a `2xx`

            HTTP status code, or we will reattempt the request again.
          type: string
          format: uri
        redirectUrl:
          nullable: true
          description: >-
            The URL to redirect the end-user when an offsite transaction is
            completed.  Defaults to the website's configured URL.
          type: string
          format: uri
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        isProcessedOutside:
          description: True if transaction was processed outside Rebilly
          type: boolean
          default: false
        processedTime:
          type: string
          description: >-
            The time the transaction was processed. Can be specified only if
            transaction was processed outside Rebilly.
          format: date-time
    TransactionGatewayLog:
      type: object
      readOnly: true
      properties:
        headers:
          description: The request headers
          type: array
          items:
            type: string
        url:
          description: The request URL
          type: string
        request:
          description: The request body
          type: string
        response:
          description: The response body
          type: string
        duration:
          description: 'The request time, msec'
          type: integer
        createdTime:
          description: The log entry created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          minItems: 1
          items:
            $ref: '#/components/schemas/TransactionLink'
    TransactionRefund:
      type: object
      required:
        - amount
      properties:
        amount:
          description: Refund amount
          type: number
          format: double
    TransactionTimeline:
      type: object
      properties:
        id:
          description: The Timeline message identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        type:
          description: Timeline message type
          type: string
          readOnly: true
          enum:
            - customer-redirected-offsite
            - customer-returned
            - dispute-changed
            - dispute-created
            - dispute-forfeited
            - dispute-lost
            - dispute-responded
            - dispute-won
            - gateway-connection-failed
            - gateway-connection-timed-out
            - gateway-response-received
            - risk-score-changed
            - timeline-comment-created
            - transaction-abandoned
            - transaction-amount-discrepancy-found
            - transaction-approved
            - transaction-canceled
            - transaction-capture-delayed
            - transaction-captured
            - transaction-declined
            - transaction-discrepancy-found
            - transaction-initiated
            - transaction-reconciled
            - transaction-refunded
            - transaction-retried
            - transaction-rules-processed
            - transaction-scheduled-time-changed
            - transaction-timeout-resolved
            - transaction-voided
            - transaction-waiting-gateway
        triggeredBy:
          description: Shows who or what triggered the Timeline message
          type: string
          readOnly: true
          enum:
            - rebilly
            - app
            - direct-api
        message:
          description: The message that describes the message details
          type: string
        extraData:
          $ref: '#/components/schemas/TimelineExtraData'
        occurredTime:
          description: Timeline message time
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    AclPermissions:
      type: array
      items:
        type: string
        format: operationId
      example:
        - GetTransactionCollection
        - GetTransaction
        - PostTransaction
    ApiKeyScopes:
      type: array
      items:
        type: object
        properties:
          organizationId:
            description: The account identifier string
            readOnly: true
            allOf:
              - $ref: '#/components/schemas/ResourceId'
      example:
        - organizationId: organizationId-id-1
    ApiKeyScope:
      type: object
      properties:
        organizationId:
          description: The array of account identifier strings
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/ResourceId'
        productId:
          description: The array of product identifier strings
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/ResourceId'
        planId:
          description: The array of plan identifier strings
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/ResourceId'
        customFieldName:
          description: The array of custom field names
          type: array
          items:
            type: string
            maxLength: 60
            pattern: '^[\w-]+$'
      example:
        organizationId:
          - organizationId-id-1
    Acl:
      type: array
      items:
        type: object
        required:
          - scope
          - permissions
        properties:
          scopes:
            deprecated: true
            description: Array of api key scopes
            allOf:
              - $ref: '#/components/schemas/ApiKeyScopes'
          scope:
            description: Api Key scope
            allOf:
              - $ref: '#/components/schemas/ApiKeyScope'
          permissions:
            description: >-
              Specify individual permission here if creating a restricted API
              key. Use wildcard `*` for full access.
            allOf:
              - $ref: '#/components/schemas/AclPermissions'
    ApiKey:
      type: object
      description: API secret Key.
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        description:
          description: API key description
          type: string
        datetimeFormat:
          description: Date time format
          type: string
          default: iso8601
          enum:
            - mysql
            - iso8601
        type:
          description: Type of API key
          type: string
          default: secret
          enum:
            - secret
            - publishable
        permissions:
          description: >-
            Specify individual permissions here if creating a restricted API
            key.
          deprecated: true
          allOf:
            - $ref: '#/components/schemas/AclPermissions'
        acl:
          description: >-
            Specify access control list here if creating a restricted API key.
            Send all matching permission with an empty scope to allow all
            permissions.
          allOf:
            - $ref: '#/components/schemas/Acl'
        apiUser:
          description: API user name
          type: string
          readOnly: true
        secretKey:
          description: API secret key's value
          type: string
          readOnly: true
        createdTime:
          description: The API key created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    BroadcastMessage:
      type: object
      required:
        - emails
        - startSendingTime
      properties:
        id:
          description: The broadcast message's identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        filter:
          type: string
          description: >
            The filter that will be used on customer selection during the
            broadcast message processing.

            The syntax is the same as the `query` filter, without `filter=`
            prefix.

            For example: `firstName:John`, `firstName:John;lastName:Doe`, etc.

            Attention: You should not URL encode the filter value.
          example: 'firstName:John;lastName:Doe'
        title:
          type: string
          description: The title of the messages. (This title will appear in reports.)
        messages:
          type: array
          description: The list of messages.
          minItems: 1
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
                description: The message identifier string.
              version:
                type: string
                description: >-
                  The message version. (By default is empty, but if you make
                  multiple versions, you can name or number them to distinguish
                  them.)
              weight:
                type: integer
                description: >
                  The value for random-weighted picking of a template in the
                  case of a split test.

                  The split test algorithm does not factor localization when
                  making a weighted-random template selection.  Therefore, a
                  version will be selected first, and then after a version is
                  selected a specific localization will be selected.  Take the
                  case where two versions have different locale content -- the
                  locales of the content is not considered when selecting the
                  version.
                minimum: 0
                maximum: 100
                example: 75
                default: 100
              templates:
                description: >
                  The value for random-weighted picking of a template in the
                  case of a split test.

                  The split test algorithm does not factor localization when
                  making a weighted-random template selection.  Therefore, a
                  version will be selected first, and then after a version is
                  selected a specific localization will be selected.  Take the
                  case where two versions have different locale content -- the
                  locales of the content is not considered when selecting the
                  version.
                example:
                  locale: fr-FR
                  from: example@example.com
                  subject: Sujet de démonstration
                  text: Texte de démonstration
                  html: <p>Texte de démonstration</p>
                type: array
                minItems: 1
                items:
                  type: object
                  properties:
                    from:
                      type: string
                      description: >
                        The sender address. It must be a **verified** address. #
                        todo add a link to help docs on how to verify an email
                        address
                      maxLength: 254
                    subject:
                      type: string
                      description: >-
                        The message subject. The template placeholders are
                        allowed.
                      maxLength: 998
                    text:
                      type: string
                      description: |
                        The message's text body.
                        Leave empty to use content from "html".
                        The template placeholders are allowed.
                    html:
                      type: string
                      description: |
                        The message's html body.
                        Leave empty to use content from "text".
                        The template placeholders are allowed.
                    locale:
                      type: string
                      description: >-
                        The language locale identifier according to [RFC
                        5646](https://tools.ietf.org/html/rfc5646).
                      example: fr-FR
                  required:
                    - from
                    - subject
                    - text
                    - html
                    - locale
            required:
              - templates
        splitTestStartTime:
          readOnly: true
          type: string
          format: date-time
          description: The split test start time
        startSendingTime:
          type: string
          format: date-time
          description: The start sending time
        status:
          readOnly: true
          type: string
          description: The broadcast message's status
          enum:
            - draft
            - sending
            - sent
            - archived
        createdTime:
          description: The broadcast message's created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The broadcast message's updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to the resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    Style:
      type: object
      properties:
        background:
          description: Background color for the section in hexadecimal format.
          type: string
          maxLength: 6
          default: ffffff
        color:
          description: Font color for the section in hexadecimal format.
          type: string
          maxLength: 6
          default: cccccc
    Section:
      type: object
      required:
        - section
        - content
        - style
        - enabled
      properties:
        section:
          description: |
            A key for this section of content.
          type: string
          enum:
            - header
            - body
            - order-summary
            - button
            - footer
            - thank-you
            - terms
        style:
          $ref: '#/components/schemas/Style'
        content:
          description: >-
            The text you want to appear in the section, can be styled in html
            markup.  You can include image references.
          type: string
        enabled:
          description: >-
            Set to false if you want to disable this markup section on checkout
            page.
          type: boolean
          default: true
    FieldConfig:
      type: object
      description: A configuration for a field.
      required:
        - name
      properties:
        name:
          description: >
            The name of the field, as defined in our APIs. You can also include
            custom fields.
          type: string
          enum:
            - companyName
            - phoneNumber
            - address
            - addressLine2
            - city
            - region
            - country
            - postalCode
            - couponCode
            - quantity
        setting:
          description: >
            If you want the field hidden, optional, or required.  Some fields
            may be required by a specific theme, and these settings will not
            override that.

            Defaults are that most fields are shown.  You may wish to hide
            `couponCode`, if you don't use coupons.  You may wish to require
            specific fields

            that are optional (eg `phoneNumber`).
          type: string
          enum:
            - hidden
            - optional
            - required
        label:
          description: >-
            If you want to override the default label, you can set a value here
            (eg, instead of "First Name", you can set "Given Name").
          type: string
        default:
          description: >-
            Set a default value for the field.  It will default to being empty,
            or 1 for `quantity`.
          type: string
    Taxes:
      type: object
      description: A configuration for a tax.
      required:
        - label
        - value
      properties:
        label:
          description: Tax name
          type: string
          example: VAT
        value:
          description: Value of tax.
          type: number
          format: float
          minimum: 0
          exclusiveMinimum: true
          example: 0.5
    CheckoutPage:
      type: object
      required:
        - planId
        - websiteId
        - urlPathSegment
        - name
      properties:
        id:
          description: Checkout page identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        planId:
          description: >-
            Checkout page plan ID.  If the plan is deactivated, the submit
            button on the checkout page will be deactivated and the page will
            display "Sold Out."
          type: string
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        websiteId:
          description: Checkout page website ID
          type: string
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        urlPathSegment:
          description: >-
            Your own custom url path segment for this Checkout Page. It will be
            appended to checkout url
            https://checkout.rebilly.com/checkout/`urlPathSegment`
          type: string
          minLength: 5
          maxLength: 50
        name:
          description: >-
            Checkout page name, used for internal display to help you organize
            your various checkout pages.
          type: string
          maxLength: 100
        redirect:
          type: object
          description: >-
            After a successful checkout, the customer can optionally be
            redirected to a url of your choice.
          properties:
            url:
              description: >-
                After a successful checkout, the customer can be redirected to a
                url of your choice.  If left empty, the customer will remain on
                the thank you page.
              type: string
            timeout:
              description: >-
                The time (in seconds) that the customer will remain on the thank
                you page before being redirected to the corresponding `url`.
              type: integer
              default: 5
        isCustomCustomerIdAllowed:
          description: >-
            Set to true if you want to supply your own customer ID's in a
            querystring parameter on your checkout page.
          type: boolean
          default: false
        isBillingAddressHidden:
          description: >-
            Set to true if you want to hide billing address on your checkout
            page.
          type: boolean
          default: false
        isPlanSummaryHidden:
          description: Set to true if you want to hide plan summary on your checkout page.
          type: boolean
          default: false
        isPreCheckedTerms:
          description: >-
            Set to true if you want to pre-checked checkbox of terms on your
            checkout page.
          type: boolean
          default: false
        oneTimeOffer:
          type: object
          description: One time offer for checkout page.
          properties:
            planId:
              description: Reference to Plan ID.
              type: string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            isTiedToQuantity:
              description: >-
                Set to true if you want to tie one time offer to quantity on
                your checkout page.
              type: boolean
              default: false
        thankYouOneTimeOffer:
          type: object
          description: One time offer for thank you page.
          properties:
            planId:
              description: Reference to Plan ID.
              type: string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            isTiedToQuantity:
              description: >-
                Set to true if you want to tie one time offer to quantity on
                your checkout page.
              type: boolean
              default: false
        suggestedUpgrade:
          type: object
          description: Suggested upgrade for checkout page.
          properties:
            planId:
              description: Reference to Plan ID.
              type: string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            hasProration:
              description: >-
                Set to true if you want to pro rata credits given due change a
                subscription's plan.
              type: boolean
              default: false
        theme:
          description: Select from pre-designed themes for your checkout page.
          type: string
          default: classic
          enum:
            - classic
            - long-copy
        logoAlignment:
          description: Checkout page logo position.
          type: string
          enum:
            - left
            - center
            - right
          default: left
        quantityLabel:
          description: >-
            Checkout page quantity label, used in case you want to customize the
            quantity field label.
          type: string
          maxLength: 255
        quantityType:
          description: >-
            Checkout page quantity type, used in case you want to customize the
            quantity field type.
          type: string
          enum:
            - selectbox
            - textinput
          default: selectbox
        quantityMin:
          description: >-
            Checkout page quantity min, used in case you want to set the minimun
            quantity.
          type: integer
          minimum: 1
          maximum: 255
        markup:
          description: >
            Sections of styled content that will display within the page body,
            keyed by "section."

            The themes rely on specific "section" key values, for example
            "header", "button", "footer", "body", "thank-you", "terms".
          type: array
          uniqueItems: true
          items:
            $ref: '#/components/schemas/Section'
        fields:
          description: >-
            Take granular control over the default field settings.  You can make
            specific fields hidden, optional, or required.  You can specify
            labels and default values.
          type: array
          uniqueItems: true
          items:
            $ref: '#/components/schemas/FieldConfig'
        taxes:
          type: object
          description: 'Taxes, you can specify description and list of name-value items.'
          properties:
            description:
              description: Taxes description.
              type: string
            items:
              description: Taxes values.
              type: array
              items:
                $ref: '#/components/schemas/Taxes'
        status:
          description: 'If `inactive`, the checkout page url will result in a 404.'
          type: string
          enum:
            - active
            - inactive
          default: active
        createdTime:
          description: Checkout page created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Checkout page updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    SESCredential:
      type: object
      properties:
        hash:
          readOnly: true
          allOf: &ref_1
            - $ref: '#/components/schemas/ResourceId'
        status:
          description: The credential status
          type: string
          enum: &ref_2
            - active
            - deactivated
        deactivationTime:
          description: The time when the credential was deactivated
          allOf: &ref_3
            - $ref: '#/components/schemas/ServerTimestamp'
        key:
          type: string
          description: The AWS access key ID
          example: BWITYO4UARGDLMFY6UDP
        secret:
          type: string
          description: The AWS secret access key
          example: 8D34yYHOK9+yM7pDnNUO3UTO/5b8Wy/PGNyzTRmG
        region:
          type: string
          description: The AWS region name
          example: us-west-2
        configurationSetName:
          type: string
          description: The configuration set name which will be used durring email sending
          example: SpecialConfigurationSet
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
      description: Amazon simple email service (AWS SES) credential
      required:
        - key
        - secret
        - region
    PatchCredential:
      type: object
      required:
        - status
      properties:
        status:
          description: The credential status
          type: string
          enum:
            - deactivated
    SmtpAuthorization:
      type: object
      discriminator:
        propertyName: type
        mapping:
          none: '#/components/schemas/SmtpAuthorizationNone'
          cram-md5: '#/components/schemas/cram-md5'
          login: '#/components/schemas/login'
          plain: '#/components/schemas/plain'
      properties:
        type:
          type: string
          enum:
            - none
            - plain
            - login
            - cram-md5
          default: none
    SmtpAuthorizationNone:
      allOf:
        - $ref: '#/components/schemas/SmtpAuthorization'
    UserPasswordAuthorization:
      type: object
      properties:
        username:
          type: string
        password:
          type: string
          format: password
      required:
        - username
        - password
    cram-md5:
      allOf:
        - $ref: '#/components/schemas/SmtpAuthorization'
        - $ref: '#/components/schemas/UserPasswordAuthorization'
    login:
      allOf:
        - $ref: '#/components/schemas/SmtpAuthorization'
        - $ref: '#/components/schemas/UserPasswordAuthorization'
    plain:
      allOf:
        - $ref: '#/components/schemas/SmtpAuthorization'
        - $ref: '#/components/schemas/UserPasswordAuthorization'
    SmtpCredential:
      type: object
      properties:
        hash:
          readOnly: true
          allOf: *ref_1
        status:
          description: The credential status
          type: string
          enum: *ref_2
        deactivationTime:
          description: The time when the credential was deactivated
          allOf: *ref_3
        host:
          type: string
          description: The host name
        port:
          type: integer
          description: The port value
          minimum: 1
          maximum: 65535
          default: 25
        encryption:
          type: string
          description: The encryption value
          enum:
            - none
            - tls
            - ssl
          default: none
        auth:
          $ref: '#/components/schemas/SmtpAuthorization'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
      description: SMTP Credential
      required:
        - host
    MailgunCredential:
      type: object
      properties:
        hash:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        status:
          description: The credential status
          type: string
          enum: *ref_2
        deactivationTime:
          description: The time when the credential was deactivated
          allOf: *ref_3
        emailFrom:
          type: string
          format: email
          description: The from email address
        apiKey:
          type: string
          description: The mailgun api key
        domain:
          type: string
          description: The mailgun domain
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
      description: Mailgun Credential
      required:
        - emailFrom
        - apiKey
        - domain
    OAuth2CredentialService:
      type: string
      enum:
        - google-sheets
    OAuth2Credential:
      type: object
      properties:
        hash:
          readOnly: true
          allOf: *ref_1
        status:
          description: The credential status
          type: string
          enum: *ref_2
        deactivationTime:
          description: The time when the credential was deactivated
          allOf: *ref_3
        service:
          description: The name of service that the OAuth2 credential belongs to
          allOf:
            - $ref: '#/components/schemas/OAuth2CredentialService'
        code:
          description: The OAuth2 code provided by the authentication server
          type: string
          example: 2/smAHUUr9jOxw_IOp47Y_dH1r2Y
        accessToken:
          description: The OAuth2 access token
          readOnly: true
          type: string
          example: >-
            zw34.PltIPtJZHmEgZS9R4RoGpzaRrJd5MYjZIONQ2MjWSCj7N7Iqp9BXXFIbkhDRfAPs6cB1pKtTjLUgb3ofzgHUprJfnRiMDTnB_yPMK7vtgobCX4SUs7fhrR6bdApq
        refreshToken:
          description: The OAuth2 refresh token
          readOnly: true
          type: string
          example: 2/4DPERp2EiySF6JUIOTS4jM5f0JmLG2gPcpGaWYTGU94
        scopes:
          description: The OAuth2 granted list access
          type: array
          items:
            type: string
          example:
            - 'https://www.googleapis.com/auth/drive.metadata.readonly'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
      description: OAuth2 credential
      required:
        - code
        - scopes
        - service
    GoogleSpreadsheet:
      type: object
      properties:
        id:
          description: The google spreadsheet indentifier string
          readOnly: true
          type: string
          example: 2ytkMntAC2Ke7aIgpaOBjz9IORRlNRjwFqO7KvyNam3B
        name:
          readOnly: true
          description: The google spreadsheet name
          type: string
          example: Spreadsheet 1
    PostmarkCredential:
      type: object
      properties:
        hash:
          readOnly: true
          allOf: *ref_1
        status:
          description: The credential status
          type: string
          enum: *ref_2
        deactivationTime:
          description: The time when the credential was deactivated
          allOf: *ref_3
        serverApiToken:
          type: string
          description: The Postmark server API token
          example: dd0508z9-2291-6794-3376-z0a70g12eqm9
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
      description: Postmark Credential
      required:
        - serverApiToken
    SendGridCredential:
      type: object
      properties:
        hash:
          readOnly: true
          allOf: *ref_1
        status:
          description: The credential status
          type: string
          enum: *ref_2
        deactivationTime:
          description: The time when the credential was deactivated
          allOf: *ref_3
        apiKey:
          type: string
          description: The SendGrid api key
          example: >-
            SO.WFbRlSWUQJSb40eny4RuZQ.7liHLZ4l1jaPCgbu02b-aGH-bo4RB8z9fK3aUd1heeL
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
      description: SendGrid Credential
      required:
        - apiKey
    WebhookAuthorization:
      type: object
      discriminator:
        propertyName: type
        mapping:
          none: '#/components/schemas/WebhookAuthorizationNone'
          basic: '#/components/schemas/basic'
          digest: '#/components/schemas/digest'
          oauth1: '#/components/schemas/oauth1'
      properties:
        type:
          type: string
          description: The authorization type
          enum:
            - none
            - basic
            - digest
            - oauth1
          default: none
      required:
        - type
    WebhookAuthorizationNone:
      allOf:
        - $ref: '#/components/schemas/WebhookAuthorization'
    basic:
      allOf:
        - $ref: '#/components/schemas/WebhookAuthorization'
        - type: object
          properties:
            username:
              type: string
            password:
              type: string
              format: password
          required:
            - username
            - password
    digest:
      allOf:
        - $ref: '#/components/schemas/WebhookAuthorization'
        - type: object
          properties:
            username:
              type: string
            password:
              type: string
              format: password
          required:
            - username
            - password
    oauth1:
      allOf:
        - $ref: '#/components/schemas/WebhookAuthorization'
        - type: object
          properties:
            consumerKey:
              type: string
            consumerSecret:
              type: string
            token:
              type: string
            tokenSecret:
              type: string
          required:
            - consumerKey
            - consumerSecret
            - token
            - tokenSecret
    WebhookCredential:
      type: object
      properties:
        hash:
          readOnly: true
          allOf: *ref_1
        status:
          description: The credential status
          type: string
          enum: *ref_2
        deactivationTime:
          description: The time when the credential was deactivated
          allOf: *ref_3
        host:
          type: string
          description: The host name
        auth:
          $ref: '#/components/schemas/WebhookAuthorization'
      description: Webhook credential
      required:
        - host
    EmailDeliverySetting:
      type: object
      required:
        - from
        - name
      properties:
        id:
          description: The email delivery setting's identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        from:
          description: |
            The sender's email address.  It must be unique within your account.
          type: string
          format: email
          maxLength: 254
          example: from-example@rebilly.com
        name:
          description: The sender's name
          type: string
          example: John Doe
        status:
          description: The email message's status
          readOnly: true
          type: string
          enum:
            - pending
            - verified
        credentialId:
          type: string
          description: SMTP or any Email Service Provider credential identifier string.
          example: b120c2ca-6c2b-4690-9dff-3b0d87852dc7
        provider:
          readOnly: true
          description: The service provider name
          type: string
          enum:
            - rebilly
            - smtp
            - aws-ses
            - mailgun
            - postmark
            - sendgrid
          example: rebilly
        isDefault:
          type: boolean
          description: Whether this setting will be used by default or not.
          default: false
        createdTime:
          description: The created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    EmailMessage:
      type: object
      required:
        - from
        - to
        - subject
        - text
        - html
      properties:
        id:
          description: The email message's identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        status:
          description: The email message's status
          type: string
          enum:
            - draft
            - outbox
            - sending
            - sent
            - failed
          default: draft
        metadata:
          description: The email message's metadata
          type: object
          additionalProperties:
            type: string
          example:
            eventType: subscription-canceled
        credentialHash:
          type: string
          description: SMTP or any Email Service Provider credential identifier string.
          example: b120c2ca-6c2b-4690-9dff-3b0d87852dc7
        from:
          description: The email message's sender address
          type: string
          format: email
          maxLength: 254
          example: from-example@rebilly.com
        to:
          description: The email message's recipients address list
          type: array
          minItems: 1
          items:
            type: string
            format: email
            maxLength: 254
          example:
            - to-example@rebilly.com
        cc:
          description: The email message's CC address list
          type: array
          items:
            type: string
            format: email
            maxLength: 254
          example:
            - сс-example@rebilly.com
        bcc:
          description: The email message's BCC address list
          type: array
          items:
            type: string
            format: email
            maxLength: 254
          example:
            - сс-example@rebilly.com
        subject:
          description: The email message's subject
          type: string
          maxLength: 998
          example: Welcome dear customer!
        text:
          description: The email message's text body
          type: string
          example: Email message text body
        html:
          description: The email message's html body
          type: string
          example: <p>Email message html body</p>
        attachments:
          description: The email message's attachemnts
          type: array
          items:
            type: object
            required:
              - resourceType
              - resourceId
            properties:
              resourceType:
                description: The attachment's resource type
                type: string
                example: invoice
              resourceId:
                description: The attachment's resource identifier string
                example: INV-1
                allOf:
                  - $ref: '#/components/schemas/ResourceId'
        createdTime:
          description: The email message's created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The email message's updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to the resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    EmailNotification:
      type: object
      description: The email notification event
      readOnly: true
      properties:
        eventType:
          $ref: '#/components/schemas/EventType'
        count:
          type: integer
          readOnly: true
          description: The count of binds with `send-email` actions per event
        notifications:
          readOnly: true
          type: array
          minItems: 1
          description: The list of notifications
          items:
            type: object
            properties:
              labels:
                description: The notification labels
                type: array
                minItems: 1
                items:
                  type: string
              title:
                type: string
                description: The notification title
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    SystemEvent:
      type: object
      description: The application event
      readOnly: true
      properties:
        eventType:
          $ref: '#/components/schemas/EventType'
        title:
          type: string
        description:
          type: string
        category:
          description: The event system category it belongs to
          type: string
          enum:
            - billing
            - payments
        rulesCount:
          type: integer
          readOnly: true
        bindsCount:
          type: integer
          readOnly: true
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    OnOff:
      type: string
      default: active
      enum:
        - active
        - inactive
    RuleAction:
      type: object
      discriminator:
        propertyName: name
        mapping:
          add-risk-score: '#/components/schemas/add-risk-score'
          blacklist: '#/components/schemas/blacklist'
          cancel-scheduled-payments: '#/components/schemas/cancel-scheduled-payments'
          create-infusionsoft-order: '#/components/schemas/create-infusionsoft-order'
          create-infusionsoft-payment: '#/components/schemas/create-infusionsoft-payment'
          display-other-choices: '#/components/schemas/display-other-choices'
          guess-payment-card-expiration: '#/components/schemas/guess-payment-card-expiration'
          offer-purchase-bump: '#/components/schemas/offer-purchase-bump'
          pick-gateway-account: '#/components/schemas/pick-gateway-account'
          remove-reminder: '#/components/schemas/remove-reminder'
          request-kyc: '#/components/schemas/request-kyc'
          reset-reminder: '#/components/schemas/reset-reminder'
          schedule-invoice-retry: '#/components/schemas/schedule-invoice-retry'
          schedule-payment-retry: '#/components/schemas/schedule-payment-retry'
          schedule-payment: '#/components/schemas/schedule-payment'
          schedule-reminder: '#/components/schemas/schedule-reminder'
          send-email: '#/components/schemas/send-email'
          stop-subscriptions: '#/components/schemas/stop-subscriptions'
          tag-or-untag-customer: '#/components/schemas/tag-or-untag-customer'
          trigger-webhook: '#/components/schemas/trigger-webhook'
      properties:
        name:
          type: string
          description: The action name
          enum:
            - blacklist
            - cancel-scheduled-payments
            - guess-payment-card-expiration
            - pick-gateway-account
            - schedule-payment-retry
            - schedule-payment
            - schedule-invoice-retry
            - send-email
            - trigger-webhook
            - stop-subscriptions
            - add-risk-score
            - request-kyc
            - tag-or-untag-customer
            - display-other-choices
            - offer-purchase-bump
            - schedule-reminder
            - reset-reminder
            - remove-reminder
            - create-infusionsoft-order
            - create-infusionsoft-payment
        status:
          $ref: '#/components/schemas/OnOff'
      required:
        - name
    add-risk-score:
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          description: Add risk score
          properties:
            score:
              type: integer
              default: 0
    blacklist:
      description: Add customer data to blacklist
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            type:
              type: string
              enum:
                - customer-id
                - email
                - fingerprint
                - ip-address
                - payment-card
            ttl:
              type: integer
              description: >-
                Blacklist TTL. Defaults to zero, meaning blacklist record won't
                expire ever.
              default: 0
          required:
            - type
    cancel-scheduled-payments:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
    create-infusionsoft-order:
      description: Create a Keap Infusionsoft order along with a contact
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            contactBody:
              description: >-
                The list of contact attributes that will be used during Keap
                Infusionsoft creation process
              type: object
              properties:
                email_addresses:
                  description: >-
                    The contact email addresses that will be used during Keap
                    Infusionsoft creation process
                  type: array
                  minItems: 1
                  items:
                    type: object
                    properties:
                      email:
                        description: >-
                          The contact email address that will be used during
                          Keap Infusionsoft creation process
                        type: string
                        example: '{{ invoice.customer.email }}'
                      field:
                        description: >-
                          The contact email field type that will be used during
                          Keap Infusionsoft creation process
                        type: string
                        enum:
                          - EMAIL1
                          - EMAIL2
                          - EMAIL3
                        example: EMAIL1
                phone_numbers:
                  description: >-
                    The contact phone numbers that will be used during Keap
                    Infusionsoft creation process
                  type: array
                  minItems: 1
                  items:
                    type: object
                    properties:
                      number:
                        description: >-
                          The contact phone number that will be used during Keap
                          Infusionsoft creation process
                        type: string
                        example: '{{ invoice.customer.customFields.phoneNumber }}'
                      field:
                        description: >-
                          The contact phone field type that will be used during
                          Keap Infusionsoft creation process
                        type: string
                        enum:
                          - PHONE1
                          - PHONE2
                          - PHONE3
                          - PHONE4
                          - PHONE5
                        example: PHONE1
            orderBody:
              description: >-
                The list of order attributes that will be used during Keap
                Infusionsoft creation process except `contact_id`
              type: object
              properties:
                order_date:
                  description: >-
                    The order date that will be used during Keap Infusionsoft
                    creation process
                  type: string
                  example: '{{ invoice.issuedTime }}'
                order_title:
                  description: >-
                    The order title that will be used during Keap Infusionsoft
                    creation process
                  type: string
                  example: '{{ invoice.id }}'
                order_type:
                  description: >-
                    The order type that will be used during Keap Infusionsoft
                    creation process
                  type: string
                  enum:
                    - Offline
                    - Online
                  example: Offline
              required:
                - order_date
                - order_title
                - order_type
            credentialHash:
              type: string
              description: OAuth2 credential identifier string
          required:
            - credentialHash
            - contactBody
            - orderBody
    create-infusionsoft-payment:
      description: Create a Keap Infusionsoft payment
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            paymentBody:
              description: >-
                The list of payment attributes that will be used during Keap
                Infusionsoft creation process
              type: object
            credentialHash:
              type: string
              description: OAuth2 credential identifier string
          required:
            - credentialHash
    display-other-choices:
      description: Display Other Choices
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            choices:
              type: array
              minItems: 1
              items:
                type: object
                properties:
                  langIso:
                    description: Language (two letter ISO 639-1 code)
                    type: string
                  content:
                    type: string
                required:
                  - langIso
                  - content
          required:
            - choices
    guess-payment-card-expiration:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
    offer-purchase-bump:
      description: Offer Purchase Bump
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            bumpOffers:
              type: array
              minItems: 1
              items:
                type: object
                properties:
                  name:
                    description: Bump offer name
                    type: string
                  weight:
                    description: Bump offer weight
                    type: string
                  bumpAmount:
                    description: Bump amount offer
                    type: number
                  bonusAmount:
                    description: Bonus amount offer
                    type: number
                  choices:
                    type: array
                    minItems: 1
                    items:
                      type: object
                      properties:
                        langIso:
                          description: Language (two letter ISO 639-1 code)
                          type: string
                        content:
                          type: string
                      required:
                        - langIso
                        - content
                required:
                  - name
                  - weight
                  - bumpAmount
                  - bonusAmount
                  - choices
          required:
            - bumpOffers
    GatewayAccountPickInstruction:
      type: object
      discriminator:
        propertyName: method
        mapping:
          gateway-account-weights: '#/components/schemas/gateway-account-weights'
          gateway-acquirer-weights: '#/components/schemas/gateway-acquirer-weights'
      properties:
        method:
          type: string
          enum:
            - gateway-account-weights
            - gateway-acquirer-weights
      required:
        - method
    gateway-account-weights:
      allOf:
        - $ref: '#/components/schemas/GatewayAccountPickInstruction'
        - type: object
          properties:
            weightedList:
              type: array
              uniqueItems: true
              minimum: 0
              items:
                type: object
                properties:
                  gatewayAccountId:
                    $ref: '#/components/schemas/ResourceId'
                  weight:
                    type: integer
                required:
                  - gatewayAccountId
                  - weight
              example: |
                [
                  {"gatewayAccountId": "my_gateway_account_1", "weight": 80},
                  {"gatewayAccountId": "my_gateway_account_2", "weight": 20}
                ]
          required:
            - weightedList
    gateway-acquirer-weights:
      allOf:
        - $ref: '#/components/schemas/GatewayAccountPickInstruction'
        - type: object
          properties:
            weightedList:
              type: array
              uniqueItems: true
              minimum: 0
              items:
                type: object
                properties:
                  gatewayName:
                    $ref: '#/components/schemas/GatewayName'
                  acquirerName:
                    $ref: '#/components/schemas/AcquirerName'
                  weight:
                    type: integer
                required:
                  - gatewayName
                  - acquirerName
                  - weight
              example: |
                [
                  {"gatewayName": "TestProcessor", "acquirerName": "AIB", "weight": 80},
                  {"gatewayName": "TestProcessor", "acquirerName": "B+S", "weight": 20}
          required:
            - weightedList
    pick-gateway-account:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            pickInstruction:
              $ref: '#/components/schemas/GatewayAccountPickInstruction'
          required:
            - pickInstruction
    remove-reminder:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            role:
              type: string
              enum:
                - all
                - renewal
                - trial-end
              description: >-
                The role of Reminder (available only on Subscription events,
                other events should use `all`).
          required:
            - role
    request-kyc:
      description: Request KYC page to verify customer identity
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            excludePolicy:
              type: string
              description: Who should be excluded from the verification
              enum:
                - customers-with-accepted-document
                - customers-with-document
                - none
              default: customers-with-accepted-document
            isMandatory:
              type: boolean
              description: Is the verification mandatory
              default: true
            promptPolicy:
              type: string
              description: 'When to prompt, before or after processing the transaction'
              enum:
                - before-transaction-process
                - after-transaction-process
              default: before-transaction-process
            rejectedBeforeTransactionProcessPolicy:
              type: string
              description: >-
                What to do if verification is before transaction processing, and
                is rejected
              enum:
                - process-transaction
                - decline
                - use-alternate-gateway
              default: decline
            alternateGatewayAccountIfRejected:
              type: string
              description: >-
                Gateway account to use if use-alternate-gateway is selected for
                rejectedBeforeTransactionProcessPolicy
            rejectedAfterTransactionProcessPolicy:
              type: string
              description: >-
                What to do if verification is after transaction processing, and
                is rejected
              enum:
                - proceed
              default: proceed
            optionalPolicy:
              type: string
              description: What to do if verification is optional
              enum:
                - allow-bypass
                - allow-use-alternate-gateway
              default: allow-bypass
            alternateGatewayAccountIfOptional:
              type: string
              description: >-
                Gateway account to use if allow-use-alternate-gateway is
                selected for optionalPolicy
            bypassCurrencyToDisplay:
              description: >-
                The currency three letter code to display on the bypass link, if
                optional
              type: string
              default: USD
          required:
            - excludePolicy
            - isMandatory
            - promptPolicy
            - rejectedBeforeTransactionProcessPolicy
            - rejectedAfterTransactionProcessPolicy
            - optionalPolicy
    reset-reminder:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            role:
              type: string
              enum:
                - all
                - renewal
                - trial-end
              description: >-
                The role of Reminder (available only on Subscription events,
                other events should use `all`).
          required:
            - role
    schedule-invoice-retry:
      description: Schedule an invoice retry
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            attempts:
              type: array
              minItems: 1
              items:
                type: object
                properties:
                  scheduleInstruction:
                    $ref: '#/components/schemas/InvoiceRetryScheduleInstruction'
                required:
                  - scheduleInstruction
            afterAttemptPolicies:
              description: The policy on the attempt finishes
              type: array
              items:
                type: string
                enum:
                  - change-subscription-renewal-time
            afterRetryEndPolicies:
              description: The policy on the retry ends
              type: array
              items:
                type: string
                enum:
                  - abandon-invoice
                  - cancel-subscription
            overrideRetryInstruction:
              description: Whether to replace the existing retry or not
              type: boolean
          required:
            - attempts
            - afterAttemptPolicies
            - afterRetryEndPolicies
            - overrideRetryInstruction
    schedule-payment-retry:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - $ref: '#/components/schemas/PaymentRetry'
    schedule-payment:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          description: The calculation instruction of scheduled time for payment
          properties:
            scheduleInstruction:
              $ref: '#/components/schemas/CommonScheduleInstruction'
            amountPolicy:
              type: string
              enum:
                - invoice-amount-due
          required:
            - scheduleInstruction
            - amountPolicy
    ReminderScheduleInstruction:
      type: object
      description: The calculation instruction of scheduled time
      discriminator:
        propertyName: method
        mapping:
          date-interval: '#/components/schemas/date-interval'
          day-of-month: '#/components/schemas/day-of-month'
          day-of-week: '#/components/schemas/day-of-week'
      properties:
        method:
          type: string
          default: '1'
          enum:
            - date-interval
            - day-of-month
            - day-of-week
      required:
        - method
    ReminderSchedule:
      type: object
      description: Schedule Instructions Collection
      properties:
        instructions:
          type: array
          items:
            $ref: '#/components/schemas/ReminderScheduleInstruction'
        chronology:
          type: string
          enum:
            - before
            - after
      required:
        - instructions
        - chronology
    schedule-reminder:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            role:
              type: string
              enum:
                - all
                - renewal
                - trial-end
              description: >-
                The role of Reminder (available only on Subscription events,
                other events should use `all`).
            schedule:
              $ref: '#/components/schemas/ReminderSchedule'
          required:
            - role
    RulesEmailNotification:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The message identifier string.
        version:
          type: string
          description: >-
            The message version (useful for split tests). (By default is empty,
            but if you make multiple versions, you can name or number them to
            distinguish them.)
        weight:
          type: integer
          description: >
            The value for random-weighted picking of a template in the case of a
            split test.

            The split test algorithm does not factor localization when making a
            weighted-random template selection.  Therefore, a version will be
            selected first, and then after a version is selected a specific
            localization will be selected.  Take the case where two versions
            have  different locale content -- the locales of the content is not
            considered when selecting the version.
          minimum: 0
          maximum: 100
          example: 75
          default: 100
        templates:
          description: >
            An array of message templates with the language locale identifiers
            according to [RFC 5646](https://tools.ietf.org/html/rfc5646). A
            language will be selected based on the customer's locale.


            If there is no locale set for the customer, then `en-US` (US
            English) will be used as the locale.


            If there is no template with the customer's locale,  then a template
            locale will be selected by Rebilly using a closest match algorithm
            (which may be random at worst).


            If your email message templates are localized into more than one
            language,  you SHOULD set a customer locale.


            An invalid placeholder will render to an empty string. For example,
            `Hello {{invalid.placeholder}}!`  will be rendered to `Hello !`.
          type: array
          minItems: 1
          items:
            type: object
            required:
              - locale
              - subject
              - text
              - html
              - from
              - to
            properties:
              locale:
                type: string
                description: >-
                  The language locale identifier according to [RFC
                  5646](https://tools.ietf.org/html/rfc5646).
                example: fr-FR
              from:
                type: string
                description: >
                  The sender address. Template placeholders are allowed.  If a
                  placeholder does not resolve to a **verified** from address,
                  then the default verified from address will be used instead.
                  # todo add a link to help docs on how to verify an email
                  address
                maxLength: 254
              to:
                type: array
                description: >
                  The recipients addresses. Template placeholders are allowed.
                  If a placeholder does not resolve to an email address, then no
                  email will be sent.
                minItems: 1
                items:
                  type: string
                  maxLength: 254
              cc:
                type: array
                description: >
                  The recipients to be carbon copied addresses. Template
                  placeholders are allowed. If a placeholder does not resolve to
                  an email address, then they will not be added to the cc.
                items:
                  type: string
                  maxLength: 254
              bcc:
                type: array
                description: >
                  The blind carbon copy recipients addresses. Template
                  placeholders are allowed. If a placeholder does not resolve to
                  an email address, then they will not be added to the cc.
                items:
                  type: string
                  maxLength: 254
              subject:
                type: string
                description: The message subject. Template placeholders are allowed.
                maxLength: 998
              text:
                type: string
                description: |
                  The message's text body.
                  Leave empty to use content from "html".
                  Template placeholders are allowed.
              html:
                type: string
                description: |
                  The message's html body.
                  Leave empty to use content from "text".
                  Template placeholders are allowed.
              editor:
                type: string
                description: >
                  The source of the message required for the email editor.

                  Not used for sending emails.

                  Used by the editor to reproduce the message for future
                  updates.
              attachments:
                description: The message's attachments
                type: array
                items:
                  type: object
                  required:
                    - resourceType
                    - resourceId
                  properties:
                    resourceType:
                      description: The attachment's resource type.
                      type: string
                      example: invoice
                    resourceId:
                      description: >-
                        The attachment's resource identifier string. Template
                        placeholders are allowed.
                      type: string
                      maxLength: 255
                      example: INV-1
            example:
              locale: fr-FR
              from:
                - example@example.com
              to:
                - '{{ invoice.customer.email }}'
              subject: Sujet de démonstration
              text: Texte de démonstration
              html: <p>Texte de démonstration</p>
              editor: <div class="block">Texte de démonstration</div>
      required:
        - templates
    send-email:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            id:
              type: string
              format: uuid
              description: The action identifier string.
            title:
              type: string
              description: The title of the messages. (This title will appear in reports.)
            emails:
              type: array
              description: The list of messages.
              minItems: 1
              items:
                $ref: '#/components/schemas/RulesEmailNotification'
            splitTestStartTime:
              type: string
              format: date-time
              description: The split test start time
          required:
            - emails
    stop-subscriptions:
      description: Stop active subscriptions
      allOf:
        - $ref: '#/components/schemas/RuleAction'
    tag-or-untag-customer:
      description: Tag or untag a customer with specified list of tags
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - type: object
          properties:
            addingTags:
              description: The list of tag ID customer should be tagged with
              type: array
              maxItems: 1000
              items:
                type: string
            removingTags:
              description: The list of tag ID customer should be untagged from
              type: array
              maxItems: 1000
              items:
                type: string
          required:
            - addingTags
            - removingTags
    WebhookHeader:
      type: object
      properties:
        name:
          type: string
        status:
          $ref: '#/components/schemas/OnOff'
        value:
          type: string
          example:
            Header1: value1
            Header2: value2;value3
      required:
        - name
        - value
    Webhook:
      type: object
      properties:
        method:
          type: string
          enum:
            - GET
            - POST
            - PUT
            - PATCH
            - DELETE
        url:
          type: string
          format: uri
        query:
          type: object
          description: The URI parameters
          additionalProperties:
            type: string
            example:
              param1: value1
              param2: value2
        body:
          type: string
        credentialHash:
          type: string
          description: Webhook Credential identifier string.
        headers:
          type: array
          items:
            $ref: '#/components/schemas/WebhookHeader'
      required:
        - method
        - url
    trigger-webhook:
      description: ''
      allOf:
        - $ref: '#/components/schemas/RuleAction'
        - $ref: '#/components/schemas/Webhook'
    Bind:
      type: object
      description: The rule
      properties:
        name:
          type: string
        labels:
          type: array
          uniqueItems: true
          example:
            - test-rule
            - 'category:foo'
          items:
            type: string
            pattern: '[a-zA-Z][a-zA-Z0-9:-]*'
        status:
          $ref: '#/components/schemas/OnOff'
        criteria:
          $ref: '#/components/schemas/Condition'
        actions:
          type: array
          uniqueItems: true
          items:
            $ref: '#/components/schemas/RuleAction'
      required:
        - name
        - actions
    Rule:
      type: object
      allOf:
        - $ref: '#/components/schemas/Bind'
        - type: object
          properties:
            final:
              description: >-
                Whether rule is final, meaning stop further matching rules if
                this is matched
              type: boolean
              default: true
    RuleSet:
      type: object
      description: Set of rules for particular event
      properties:
        version:
          type: integer
          readOnly: true
        binds:
          type: array
          items:
            $ref: '#/components/schemas/Bind'
        rules:
          type: array
          items:
            $ref: '#/components/schemas/Rule'
        updatedTime:
          $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
      required:
        - rules
    RuleSetHistoryLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - history
      required:
        - rel
    RuleSetVersionLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - rules
      required:
        - rel
    RuleSetHistoryItem:
      type: object
      description: Version of rules
      readOnly: true
      properties:
        version:
          type: integer
        createdTime:
          $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to a resource
          readOnly: true
          minItems: 3
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/RuleSetHistoryLink'
              - $ref: '#/components/schemas/RuleSetVersionLink'
    RuleSetVersion:
      type: object
      description: Version of rules
      readOnly: true
      properties:
        version:
          type: integer
        binds:
          type: array
          items:
            $ref: '#/components/schemas/Bind'
        rules:
          type: array
          items:
            $ref: '#/components/schemas/Rule'
        createdTime:
          $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    ForgotPassword:
      type: object
      required:
        - email
      properties:
        email:
          description: Email
          type: string
          format: email
    GatewayAccountDowntimeSchedule:
      type: object
      required:
        - startTime
        - endTime
      properties:
        id:
          description: The gateway account downtime schedule identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        status:
          description: The gateway account downtime schedule status
          readOnly: true
          type: string
          enum:
            - pending
            - ongoing
            - finished
        reason:
          description: The gateway account downtime schedule reason
          readOnly: true
          type: string
          enum:
            - scheduled-maintenance
            - daily-limit-reached
            - monthly-limit-reached
        startTime:
          description: The gateway account scheduled downtime start time.
          type: string
          format: date-time
        endTime:
          description: The gateway account scheduled downtime end time.
          type: string
          format: date-time
        createdTime:
          description: Gateway downtime schedule created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Gateway downtime schedule updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    GatewayAccountLimit:
      type: object
      required:
        - cap
      properties:
        id:
          description: The gateway account limit identifier.
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        status:
          description: The gateway account limit status.
          readOnly: true
          type: string
          enum:
            - monitoring
            - reached
        startTime:
          description: The limit's current period start time.
          type: string
          format: date-time
          readOnly: true
        endTime:
          description: >-
            The limit's current period end time. At this time, the limit will
            reset.
          type: string
          format: date-time
          readOnly: true
        frequency:
          description: The limit's period will reset according to the frequency.
          type: string
          readOnly: true
          enum:
            - daily
            - monthly
        type:
          description: |
            The limit can be on `money` or `count` of transactions.
            If `money` is chosen, the currency is the report currency.
          type: string
          readOnly: true
          enum:
            - count
            - money
        cap:
          description: >
            The limit's value cap is the maximum desired value.

            If type is money, the currency is the report currency.

            The cap only applies to approved transactions of type `authorize` or
            `sale`.
          type: integer
          example: 1000
        usage:
          description: The limit's actual usage during this period.
          type: integer
          example: 375
          readOnly: true
        createdTime:
          description: Gateway account limit created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Gateway account limit updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    GatewayAccountTimeline:
      type: object
      properties:
        id:
          description: The Timeline message identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        type:
          description: Timeline message type
          type: string
          readOnly: true
          enum:
            - gateway-account-created
            - gateway-account-changed
            - gateway-account-enabled
            - gateway-account-disabled
            - gateway-account-down
            - gateway-account-up
            - gateway-account-closed
            - gateway-account-limit-reached
            - gateway-account-limit-reset
        triggeredBy:
          description: Shows who or what triggered the Timeline message
          type: string
          readOnly: true
          enum:
            - rebilly
            - app
            - direct-api
        message:
          description: The message that describes the message details
          type: string
        extraData:
          $ref: '#/components/schemas/TimelineExtraData'
        occurredTime:
          description: Timeline message time
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    Segment:
      type: object
      required:
        - data
        - owner
        - scope
      properties:
        id:
          description: ID of current Segment
          readOnly: true
          type: string
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        owner:
          description: Owner (creator) of Segment
          readOnly: true
          type: object
          properties:
            id:
              description: User ID
              type: string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            name:
              description: First and last name
              type: string
        data:
          description: >
            An object containing schema to set up the UI for the segment. This
            schema is built

            and consumed by the frontend. It includes such information as
            Segment name, UI settings, etc.
          type: object
        isStarred:
          description: Toggle whether this Segment is starred by the current user
          type: boolean
        isVisible:
          description: Toggle whether this Segment is visible to the current user
          type: boolean
        userIds:
          type: array
          uniqueItems: true
          writeOnly: true
          description: >
            A list of user id's with whom to share, used if scope is set to
            `shared`
          items:
            description: User ID
            allOf:
              - $ref: '#/components/schemas/ResourceId'
        users:
          type: array
          uniqueItems: true
          description: |
            A list of user's id and first and last names with whom this Segment
            is shared
          readOnly: true
          items:
            type: object
            description: User person
            properties:
              id:
                description: User ID
                type: string
                allOf:
                  - $ref: '#/components/schemas/ResourceId'
              name:
                description: First and last name
                type: string
        scope:
          description: >
            If `private`, then only the owner/creator can view this Segment. If
            set

            to `public`, then it's shared with anyone in the owner's
            organization.

            If set to `shared`, then it is only shared with specific users as
            specified

            in the `userIds` field
          type: string
          enum:
            - private
            - public
            - shared
        systemId:
          description: >
            If the Segment is based off of a system Segment, this will be the id
            of the system Segment from which it was

            derived. The scope must be `private` when providing this in the
            request.
          writeOnly: true
          type: string
    OAuth2ConnectLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - oauth2Connect
      required:
        - rel
    Integration:
      type: object
      properties:
        service:
          readOnly: true
          description: The integration service
          allOf:
            - $ref: '#/components/schemas/OAuth2CredentialService'
        count:
          readOnly: true
          type: integer
          minimum: 1
          description: The number of available rule sets
        configurations:
          readOnly: true
          type: array
          minItems: 1
          description: The list of configurations
          items:
            type: object
            properties:
              labels:
                description: The configuration labels
                type: array
                minItems: 1
                items:
                  type: string
              eventType:
                $ref: '#/components/schemas/EventType'
              title:
                type: string
                description: The configuration title
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/OAuth2ConnectLink'
    LayoutItem:
      type: object
      required:
        - planId
      properties:
        planId:
          description: The plan identifier string
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        starred:
          description: Boolean if the plan should be starred (special callout presentation)
          type: boolean
        order:
          description: Item's order in Layout
          type: integer
          readOnly: true
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    ItemsLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - items
      required:
        - rel
    Layout:
      type: object
      required:
        - name
      properties:
        id:
          description: The layout identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        name:
          description: The name of the layout string
          type: string
        items:
          description: The array of layout items (planId and starred)
          type: array
          items:
            $ref: '#/components/schemas/LayoutItem'
        createdTime:
          description: Layout created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 2
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/ItemsLink'
    List:
      type: object
      required:
        - description
        - values
      properties:
        id:
          description: List ID
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        version:
          description: List version
          type: integer
          readOnly: true
          minimum: 1
        description:
          description: List description
          type: string
        values:
          description: List values
          type: array
          items:
            type: string
        createdTime:
          description: List created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: List updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: Links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    Membership:
      type: object
      required:
        - organization
        - user
      properties:
        organization:
          description: Membership organization
          readOnly: true
          type: object
          properties:
            id:
              description: Organization ID
              type: string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            name:
              description: Organization name
              type: string
            createdTime:
              description: The organization created time
              allOf:
                - $ref: '#/components/schemas/ServerTimestamp'
        user:
          description: Membership user
          readOnly: true
          type: object
          properties:
            id:
              description: Organization ID
              type: string
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            name:
              description: First and last name
              type: string
        permissions:
          description: >-
            The user's permissions. See the format in example. Use wildcard `*`
            for full access.
          allOf:
            - $ref: '#/components/schemas/AclPermissions'
        isOwner:
          description: User is owner of organization
          type: boolean
        isDefault:
          description: This organization is default for membership user
          type: boolean
          readOnly: true
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    SendTestEmail:
      description: Send a test email
      allOf:
        - $ref: '#/components/schemas/RulesEmailNotification'
    SendPreviewWebhook:
      description: Trigger a test webhook
      allOf:
        - $ref: '#/components/schemas/Webhook'
    GlobalWebhookEventType:
      type: string
      description: Rebilly webhooks event type
      enum:
        - customer-merged
        - customer-created
        - customer-updated
        - dispute-created
        - gateway-account-requested
        - invoice-modified
        - invoice-created
        - invoice-abandoned
        - invoice-paid
        - invoice-voided
        - invoice-issued
        - invoice-past-due
        - invoice-past-due-reminder
        - offsite-payment-completed
        - payment-card-expired
        - payment-card-expiration-reminder
        - renewal-invoice-issued
        - renewal-invoice-payment-declined
        - subscription-trial-ended
        - subscription-activated
        - subscription-canceled
        - subscription-reactivated
        - subscription-renewed
        - subscription-trial-end-reminder
        - subscription-renewal-reminder
        - order-completed
        - transaction-processed
        - transaction-timeout-resolved
        - transaction-declined
        - transaction-discrepancy-found
        - transaction-amount-discrepancy-found
        - kyc-document-accepted
        - kyc-document-rejected
        - kyc-document-reviewed
    GlobalWebhook:
      type: object
      required:
        - method
        - url
        - credentialHash
      properties:
        id:
          description: The webhook identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        eventsFilter:
          description: An array of System event type
          type: array
          default: []
          items:
            $ref: '#/components/schemas/GlobalWebhookEventType'
        status:
          $ref: '#/components/schemas/OnOff'
        method:
          type: string
          enum:
            - GET
            - POST
            - PUT
            - PATCH
            - DELETE
        url:
          description: URL that will be triggered when the given event occurs.
          type: string
          format: uri
        headers:
          type: array
          items:
            $ref: '#/components/schemas/WebhookHeader'
        credentialHash:
          type: string
          description: >-
            Hash from Credentials which is used for authentication by the given
            URL
        createdTime:
          description: List created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: List updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: Links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    Profile:
      type: object
      properties:
        id:
          description: The user identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        email:
          description: The user email
          readOnly: true
          type: string
          format: email
          maxLength: 100
        firstName:
          description: User's first name
          readOnly: true
          type: string
        lastName:
          description: User's last name
          readOnly: true
          type: string
        businessPhone:
          description: The user business phone number
          readOnly: true
          type: string
        mobilePhone:
          description: The user mobile phone number
          readOnly: true
          type: string
        memberships:
          description: The user memberships.
          type: array
          items:
            $ref: '#/components/schemas/Membership'
        availableCurrencies:
          type: array
          description: An array of reporting currencies enabled for the merchant
          readOnly: true
          items:
            type: string
        reportingCurrency:
          description: The user's ISO Alpha-3 code used for reports
          type: string
        totpRequired:
          description: The user setting of two-factor authentification
          type: boolean
        totpSecret:
          description: The user TOTP key for authentification app (if TOTP enabled)
          readOnly: true
          type: string
        totpUrl:
          description: >-
            The user link to QR-code for TOTP authentification app (if TOTP
            enabled)
          readOnly: true
          type: string
          format: url
        oneTimePassword:
          description: >
            The one time password generated by Google Authenticator (required
            when enabling/disabling 2FA).

            Should contain digits only.
          type: string
          pattern: '^[0-9]{6}$'
          example: '123456'
        country:
          description: The user country setting - two letter code
          readOnly: true
          type: string
        preferences:
          description: >-
            User preferences like timezone, language and many more. This is an
            object with custom properties.
          type: object
    UpdatePassword:
      type: object
      required:
        - currentPassword
        - newPassword
      properties:
        currentPassword:
          description: Current user's password - used when requesting password change
          type: string
          format: password
        newPassword:
          description: New user's password - used when requesting password change
          type: string
          format: password
    ResetPasswordTokenInfo:
      type: object
      properties:
        token:
          description: Token
          type: string
          readOnly: true
        sentTime:
          description: Creation date/time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    ResetPassword:
      type: object
      required:
        - newPassword
      properties:
        newPassword:
          description: New password
          type: string
          format: password
    User:
      type: object
      required:
        - email
        - firstName
        - lastName
      properties:
        id:
          description: The user identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        email:
          description: The user email
          type: string
          format: email
          maxLength: 100
        firstName:
          description: User's first name
          type: string
        lastName:
          description: User's last name
          type: string
        businessPhone:
          description: The user business phone number
          type: string
        mobilePhone:
          description: The user mobile phone number
          type: string
        password:
          description: 'User''s password. If not provided, password reset email will be sent'
          type: string
          format: password
        permissions:
          description: >-
            The user's permissions. See the format in example. Use wildcard `*`
            for full access.
          allOf:
            - $ref: '#/components/schemas/AclPermissions'
        createdTime:
          description: The user created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: The user updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        loginTime:
          description: The user last login time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        reportingCurrency:
          description: The user's ISO Alpha-3 code used for reports
          readOnly: true
          type: string
        availableCurrencies:
          type: array
          description: An array of reporting currencies enabled for the merchant
          readOnly: true
          items:
            type: string
        totpRequired:
          description: The user setting of two-factor authentification
          type: boolean
        totpSecret:
          description: The user TOTP key for authentification app (if TOTP enabled)
          type: string
        totpUrl:
          description: >-
            The user link to QR-code for TOTP authentification app (if TOTP
            enabled)
          type: string
          format: url
        status:
          description: The user status
          type: string
          enum:
            - active
            - inactive
            - pending-confirmation
          readOnly: true
        country:
          description: The user country setting - two letter code
          type: string
        preferences:
          description: >-
            User preferences like timezone, language and many more. This is an
            object with custom properties.
          type: object
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    SendThroughAttribution:
      type: object
      description: The email notification send through attribution
      readOnly: true
      properties:
        eventType:
          $ref: '#/components/schemas/EventType'
        actionId:
          type: string
          format: uuid
          description: The email notification action's identifier number
        versionId:
          type: string
          format: uuid
          description: The email notification version's identifier number
        sent:
          type: integer
          minimum: 0
          description: The email notification send number
        goal:
          type: integer
          minimum: 0
          description: The email notification goal number
    Signin:
      type: object
      required:
        - email
        - password
      properties:
        email:
          description: Email
          type: string
          example: email@example.com
        password:
          description: Password
          type: string
          format: password
        oneTimePassword:
          description: >-
            One time password for 2 factor authentication. Should contain digits
            only.
          type: string
          pattern: '^[0-9]{6}$'
          example: '123456'
        expiredTime:
          description: Session expired time. Defaults to one hour
          type: string
          format: date-time
    Session:
      type: object
      required:
        - permissions
      properties:
        id:
          description: The session identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        token:
          description: The session's token used for authentication
          type: string
        permissions:
          description: >-
            The session's permissions. See the format in example. Use wildcard
            `*` for full access.
          allOf:
            - $ref: '#/components/schemas/AclPermissions'
        memberships:
          description: The user memberships.
          type: array
          items:
            $ref: '#/components/schemas/Membership'
        userId:
          description: The user identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        createdTime:
          description: Session created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Session updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        expiredTime:
          description: Session expired time. Defaults to one hour
          type: string
          format: date-time
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    Signup:
      type: object
      required:
        - email
        - company
        - firstName
        - lastName
        - businessPhone
        - password
        - website
      properties:
        email:
          description: The user email
          type: string
          format: email
          maxLength: 100
        company:
          description: The user company name
          type: string
        firstName:
          description: The user first name
          type: string
        lastName:
          description: The user last name
          type: string
        businessPhone:
          description: The user business phone number
          type: string
        password:
          description: The user password
          type: string
          format: password
        website:
          description: The user website address
          type: string
        country:
          description: The user country (ISO Alpha-2 code)
          type: string
          pattern: '^[A-Z]{2}$'
          default: US
        reportingCurrency:
          description: >-
            The currency to be set only once which will be used for conversion
            in reports
          type: string
          pattern: '^[A-Z]{3}$'
          default: USD
    Status:
      type: object
      properties:
        status:
          description: The API status. If everything is ok - value is 'ok'
          type: string
          readOnly: true
          enum:
            - ok
        time:
          description: Current time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
    ApiTracking:
      type: object
      description: Tracking API Requests.
      readOnly: true
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        status:
          type: integer
          description: HTTP response code
        url:
          type: string
          description: API request address
        route:
          type: string
          description: API request route
          example: '/v2.1/customers/{param}'
        method:
          type: string
          description: HTTP method
          enum:
            - HEAD
            - GET
            - POST
            - PUT
            - DELETE
            - PATCH
        request:
          type: string
          description: Request JSON-string
        response:
          type: string
          description: Response JSON-string
        requestHeaders:
          type: object
          additionalProperties:
            type: string
          example:
            User-Agent: Mozilla/5.0
            Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
        responseHeaders:
          type: object
          additionalProperties:
            type: string
          example:
            Rate-Limit-Limit: 5000
            Rate-Limit-Remaining: 4999
            Rate-Limit-Reset: 'Mon, 31 Jul 2017 04:16:00 +0000'
        user:
          type: object
          description: The user who has made a request
          readOnly: true
          properties:
            userId:
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            apiKeyId:
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            email:
              description: The user email
              type: string
              format: email
            firstName:
              description: The user first name
              type: string
            lastName:
              description: The user last name
              type: string
            ipAddress:
              type: string
              description: Client IP address
              format: ipv4
            userAgent:
              description: The software that is acting on behalf of a user
              type: string
            fingerprint:
              description: The user device fingerprint hash
              type: string
            isSupport:
              description: If user from support
              type: boolean
        relatedIds:
          type: object
          description: The IDs of related resources
          readOnly: true
          properties:
            customerId:
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            transactionId:
              allOf:
                - $ref: '#/components/schemas/ResourceId'
            tokenId:
              allOf:
                - $ref: '#/components/schemas/ResourceId'
        duration:
          type: integer
          description: Request duration in milliseconds
        createdTime:
          description: The log created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    WebhookTracking:
      type: object
      description: >
        Webhook tracking lists up to the 1,000 most-recent webhooks delivered.
        Filters are limited to only the id or the entityId (the core
        related-entity's id). The results are sorted in reverse chronological
        order. Sort order may not be further controlled.
      readOnly: true
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        eventType:
          $ref: '#/components/schemas/EventType'
        entityId:
          type: string
          description: The id of the main entity related to the event type.
        url:
          type: string
          description: Url where webhook was sent
        method:
          type: string
          description: HTTP method which was used to send webhook
          example: POST
        headers:
          type: object
          description: HTTP headers which were used to send webhook
          additionalProperties:
            type: string
          example:
            My-Header: Cool-Value
        responseCode:
          type: integer
          description: HTTP code response
        responseBody:
          type: string
          description: Response body received
        payload:
          type: string
          description: Webhook's payload
        source:
          type: string
          description: The Webhook's source
          enum:
            - webhooks
            - rules
        attempt:
          type: integer
          description: The Webhook's attempt number
        sentTime:
          description: Sent time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        initiatedTime:
          description: Initiated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        createdTime:
          description: The log created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            $ref: '#/components/schemas/SelfLink'
    Website:
      type: object
      required:
        - organizationId
        - name
        - url
        - servicePhone
        - serviceEmail
      properties:
        id:
          description: The website identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        organizationId:
          description: Organization ID
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        name:
          description: The website's name
          type: string
        url:
          description: The website's domain address
          type: string
        servicePhone:
          description: The website's customer service phone number
          type: string
        serviceEmail:
          description: The website's customer service email address
          type: string
          format: email
        createdTime:
          description: Website created time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Website updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        customFields:
          $ref: '#/components/schemas/ResourceCustomFields'
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          items:
            anyOf:
              - $ref: '#/components/schemas/SelfLink'
              - $ref: '#/components/schemas/OrganizationLink'
    CustomerInformation:
      type: object
      properties:
        currency:
          description: 'Currency (three letter ISO 4217 alpha code) (eg USD, EUR)'
          readOnly: true
          type: string
        refundsAmount:
          description: Sum of all refunded transactions
          readOnly: true
          type: number
          format: double
        revenueAmount:
          description: Sum of overall sales and captures that were approved
          readOnly: true
          type: number
          format: double
        disputesAmount:
          description: Sum of all disputed transactions
          readOnly: true
          type: number
          format: double
    LinkSelf:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - self
      required:
        - rel
    LinkUser:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - user
      required:
        - rel
    LinkFileDownload:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - download
      required:
        - rel
    LinkSignedLink:
      type: object
      allOf:
        - $ref: '#/components/schemas/Link'
      properties:
        rel:
          description: The link type
          type: string
          enum:
            - signedLink
      required:
        - rel
    DataExport:
      type: object
      discriminator:
        propertyName: resource
        mapping:
          customers: '#/components/schemas/customers'
          subscriptions: '#/components/schemas/subscriptions'
          transactions: '#/components/schemas/transactions'
      required:
        - name
        - format
        - resource
      properties:
        id:
          description: The export identifier string
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/ResourceId'
        name:
          description: Export name
          type: string
        resource:
          description: 'The type of resource being exported (eg., transactions).'
          type: string
          enum:
            - transactions
            - customers
            - subscriptions
        format:
          description: Export result format
          type: string
          enum:
            - csv
            - json
            - json-api
            - xml
        arguments:
          description: >-
            Export request arguments that can be passed to filter and/or sort
            the result set. See the [arguments
            guide](https://docs-reconciliation.rebilly.com/getting-started/arguments)
            for more options and examples.
          type: object
          properties:
            filter:
              description: >-
                The collection items filter requires a special format. Use ","
                for multiple allowed values. Use ";" for multiple fields.
              type: string
            sort:
              type: string
              description: >-
                The collection items sort field and order (prefix with "-" for
                descending sort).
            q:
              type: string
              description: The partial search of the text fields.
        dateRange:
          type: object
          description: >-
            The date range (can be in relative formats).  If omitted, all time
            will be included. See the [Date Range
            guide](https://docs-reconciliation.rebilly.com/getting-started/date-range)
            for more options and examples.
          properties:
            start:
              type: string
              description: >-
                Any valid datetime arguments including [relative datetime
                arguments](http://php.net/manual/en/datetime.formats.php).
              example: yesterday
            end:
              type: string
              description: >-
                Any valid datetime arguments including [relative datetime
                arguments](http://php.net/manual/en/datetime.formats.php).
              example: today
            field:
              type: string
              description: The field to apply date range to.
          required:
            - start
            - end
        emailNotification:
          description: List of emails to be notified when export is completed
          type: array
          items:
            type: string
            format: email
        fields:
          description: >-
            List of fields to include in the export.  See supporting
            documentation for more info.  If omitted, default fields will be
            included.
          type: array
          items:
            type: string
        recurring:
          description: Exports can reoccur according to your own schedule
          type: object
          required:
            - instruction
          properties:
            instruction:
              type: string
              description: RRule RFC 5545 formatted string used for recurring exports
            start:
              type: string
              format: date-time
              description: >-
                The date and time when the first recurring scheduled export will
                occur. Defaults to now.
        userId:
          description: The ID of the User who requested the data export
          readOnly: true
          type: string
        recordCount:
          description: The number of records in the export (excluding the header row)
          readOnly: true
          type: integer
        scheduledTime:
          description: The date and time this data export is scheduled to generate a file
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        createdTime:
          description: The time the data export was requested
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        updatedTime:
          description: Data export updated time
          allOf:
            - $ref: '#/components/schemas/ServerTimestamp'
        status:
          description: Status of export request
          readOnly: true
          type: string
          enum:
            - pending
            - queued
            - processing
            - completed
        _links:
          type: array
          description: The links related to resource
          readOnly: true
          minItems: 1
          maxItems: 4
          items:
            anyOf:
              - $ref: '#/components/schemas/LinkSelf'
              - $ref: '#/components/schemas/LinkUser'
              - $ref: '#/components/schemas/LinkFileDownload'
              - $ref: '#/components/schemas/LinkSignedLink'
    customers:
      description: Customers resource type to export
      allOf:
        - $ref: '#/components/schemas/DataExport'
        - type: object
          properties:
            dateRange:
              type: object
              properties:
                field:
                  type: string
                  default: createdTime
                  example: createdTime
    subscriptions:
      description: Subscriptions resource type to export
      allOf:
        - $ref: '#/components/schemas/DataExport'
        - type: object
          properties:
            dateRange:
              type: object
              properties:
                field:
                  type: string
                  default: createdTime
                  example: createdTime
    transactions:
      description: Transactions resource type to export
      allOf:
        - $ref: '#/components/schemas/DataExport'
        - type: object
          properties:
            dateRange:
              type: object
              properties:
                field:
                  type: string
                  default: processedTime
                  example: processedTime
    HistogramData:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains date-time and value
            readOnly: true
            properties:
              date:
                type: string
                description: Entry date-time
              value:
                type: number
                description: Entry value
    ReportPaymentsSuccessfulRetries:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains a report of payments successful retries throughput
            readOnly: true
            properties:
              declineCode:
                type: string
                description: Decline reason code
              declineMessage:
                type: string
                description: Decline reason message
              successfulRatio:
                type: number
                format: double
                description: Successful ratio
    APILogSummary:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: The number of requests per each method.
            readOnly: true
            properties:
              route:
                type: string
                description: Route string pattern
              total:
                type: integer
                description: Total count of requests
              get:
                type: integer
                description: Count of GET requests.
              post:
                type: integer
                description: Count of POST requests.
              put:
                type: integer
                description: Count of PUT requests.
              patch:
                type: integer
                description: Count of PATCH requests.
              delete:
                type: integer
                description: Count of DELETE requests.
              head:
                type: integer
                description: Count of HEAD requests.
              options:
                type: integer
                description: Count of OPTIONS requests.
    CumulativeSubscriptionsPlans:
      type: array
      items:
        type: object
        description: Contains an aggregation
        readOnly: true
        properties:
          day:
            type: string
            description: Date in format YYYY-MM-DD
          month:
            type: integer
            description: Date in format YYYY-MM
          planId:
            type: integer
            description: Plan id for which the aggregation is given
          newCount:
            type: integer
            description: Number of new subscriptions within the aggregation
          canceledCount:
            type: integer
            description: Number of canceled subscriptions within the aggregation
          netCount:
            type: integer
            description: newCount - canceledCount
          cumulativeCount:
            type: integer
            description: >
              Number of cumulative subscriptions from the previous aggregation +

              number of new subscriptions - number of canceled subscriptions
              within the aggregation.
    CumulativeSubscriptions:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains an aggregation
            readOnly: true
            properties:
              aggregationValue:
                type: string
                description: >-
                  Date in format YYYY-MM (monthly aggregation) or YYYY-MM-DD
                  (daily aggregation)
              newCount:
                type: integer
                description: Number of new subscriptions within the aggregation
              canceledCount:
                type: integer
                description: Number of canceled subscriptions within the aggregation
              cumulativeCount:
                type: integer
                description: >
                  Number of cumulative subscriptions from the previous
                  aggregation +

                  number of new subscriptions - number of canceled subscriptions
                  within the aggregation.
    DashboardResponse:
      type: array
      items:
        type: object
        properties:
          metric:
            type: string
            description: Metric type
            enum:
              - approvalRate
              - salesCount
              - salesValue
              - refundsValue
              - chargebacksCount
              - chargebacksValue
              - transactionsCount
              - redeemedCouponsCount
              - newLeadsCount
              - newCustomersCount
              - appliedCouponsCount
              - trialConversionsCount
              - trialConversionsRate
              - renewalSuccessRate
              - renewalsCount
              - newTrialsCount
              - reactivationsCount
              - successfulRetriesCount
              - invoicedRevenue
              - churnCount
              - churnRate
              - cancellationsCount
              - cancellationsRate
              - activeSubscriptionsCount
              - newSubscriptionsCount
              - upgradesCount
              - downgradesCount
          humanName:
            type: string
            description: Metric name to display
          increaseIsGood:
            type: boolean
            description: >-
              True when the higher value means a better performance thus
              positive for a merchant, false otherwise
          segments:
            type: array
            items:
              type: object
              properties:
                name:
                  type: string
                  description: Segment name
                value:
                  type: number
                  format: double
                  description: Segment value for the given date range
                previousValue:
                  type: number
                  format: double
                  description: >-
                    Segment value for the previous date range (relative to the
                    given date range)
                humanValue:
                  type: string
                  description: >-
                    Human readable segment value (formatted with a currency
                    sign)
                changeRatio:
                  type: number
                  format: double
                  description: Ratio of current value per previous value null is infinity
                humanChangeRatio:
                  type: string
                  description: >-
                    Human readable change ratio (formatted percentage with a "%"
                    sign), null is infinity
                timeseries:
                  type: array
                  items:
                    type: object
                    description: Chart data
                    readOnly: true
                    properties:
                      date:
                        type: string
                        description: Entry date-time
                      value:
                        type: number
                        description: Entry value
    DccMarkup:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains an aggregation
            readOnly: true
            properties:
              aggregationValue:
                type: string
                description: >
                  Value by which the report provides aggregated data.

                  The date values are displayed as following: Day: YYYY-MM-DD;
                  Month: YYYY-MM.
              selectedCount:
                type: integer
                description: Number of selected offers in the aggregation
              selectedSum:
                type: number
                format: double
                description: Amount of selected offers in the aggregation
              rejectedCount:
                type: integer
                description: Number of rejected offers in the aggregation
              rejectedSum:
                type: number
                format: double
                description: Amount of rejected offers in the aggregation
              unknownCount:
                type: integer
                description: >-
                  Number of offers in the aggregation which weren't selected nor
                  rejected
              unknownSum:
                type: number
                format: double
                description: >-
                  Amount of offers in the aggregation which weren't selected nor
                  rejected
    ReportDisputes:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              aggregationValue:
                description: >
                  Selected aggregation field value (defined by query). It can
                  be, for example, website or country.

                  You define it in aggregationField param in query.
                type: string
              countVisa:
                description: Disputes count on Visa
                type: integer
              ratioCountVisa:
                description: Disputes count / Settled transactions count
                type: number
                format: double
              ratioAmountVisa:
                description: Disputes amount / Settled transactions amount
                type: number
                format: double
              countMastercard:
                description: Disputes count on Mastercard
                type: integer
              ratioCountMastercard:
                description: Disputes count / Settled transactions count
                type: number
                format: double
              ratioAmountMastercard:
                description: Disputes amount / Settled transactions amount
                type: number
                format: double
    ReportEventsTriggeredSummary:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              eventName:
                description: |
                  System event name.
                type: string
                enum:
                  - dispute-created
                  - gateway-account-requested
                  - transaction-processed
                  - subscription-canceled
                  - subscription-renewed
                  - payment-card-expired
                  - payment-declined
                  - transaction-process-requested
                  - risk-score-changed
              count:
                description: Count of event triggered
                type: integer
    ReportRulesMatchedSummary:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              rule:
                description: |
                  Rule matched name.
                type: string
              count:
                description: Count of matched rule.
                type: integer
              approvalRate:
                description: Transaction approval rate by rule.
                type: number
                format: double
    FutureRenewals:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains an aggregation
            readOnly: true
            properties:
              date:
                type: string
                description: Date in format YYYY-MM
              sum:
                type: number
                format: double
                description: Amount of future renewals in user's reporting currency
              plansCount:
                type: array
                items:
                  type: object
                  description: Plan within the aggregation
                  readOnly: true
                  properties:
                    planId:
                      description: Plan identifier
                      allOf:
                        - $ref: '#/components/schemas/ResourceId'
                    count:
                      type: integer
                      description: Amount of plan's future renewals
    RenewalSales:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains an aggregation
            readOnly: true
            properties:
              aggregationValue:
                type: string
                description: Date in format YYYY-MM
              newSales:
                type: number
                format: double
                description: Amount of new sales
              newRefunds:
                type: number
                format: double
                description: Amount of new refunds
              renewalSales:
                type: number
                format: double
                description: Amount of renewal sales
              renewalRefunds:
                type: number
                format: double
                description: Amount of renewal refunds
    ReportRetentionPercentage:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains an aggregation
            readOnly: true
            properties:
              aggregationValue:
                type: string
                description: >
                  Value by which the report provides retention periods and
                  percentages.

                  The date values are displayed as following:

                  Day: YYYY-MM-DD;

                  Month: YYYY-MM;

                  Quarter: YYYY-MM/YYYY-MM;

                  Year: YYYY.
              subscriptionsCount:
                type: integer
                description: Number of subscriptions created within the aggregation
              periods:
                type: array
                items:
                  type: object
                  description: The period for the given aggregation
                  properties:
                    period:
                      type: integer
                      description: >
                        Retention period (0 - first, 1 - second etc) since the
                        beginning boundary of the aggregation
                    retentionRatio:
                      type: number
                      format: double
                      description: >
                        Ratio % of remaining subcriptions (not canceled) at the
                        moment of retention period

                        to all subscriptions created in the aggregation period
                    canceledSubscriptionsCount:
                      type: integer
                      description: >-
                        Number of canceled subscriptions within the given
                        retention period
    ReportRetentionValue:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains an aggregation
            readOnly: true
            properties:
              aggregationValue:
                type: string
                description: >
                  Value by which the report provides retention periods and
                  values. The date values are displayed as following:

                  Day: YYYY-MM-DD;

                  Month: YYYY-MM;

                  Quarter: YYYY-MM/YYYY-MM;

                  Year: YYYY.
              customersCount:
                type: integer
                description: >-
                  Number of customers within the aggregation with their first
                  payment
              periods:
                type: array
                items:
                  type: object
                  description: The period for the given aggregation
                  properties:
                    period:
                      type: integer
                      description: >
                        Retention period (0 - first, 1 - second etc) since the
                        beginning boundary of the aggregation
                    retentionAverage:
                      type: number
                      format: double
                      description: >
                        Summary amount of all transactions for all periods up to
                        the current one

                        divided by the aggregation customers number
                    transactionsCount:
                      type: integer
                      description: >-
                        The number of transactions happened in the retention
                        period (e.g. in 3 rebills)
                    transactionsValue:
                      type: number
                      format: double
                      description: >-
                        The amount of transactions (income transactions - loss
                        transactions)
    ReportPaymentRetry:
      type: object
      properties:
        data:
          type: array
          readOnly: true
          items:
            type: object
            properties:
              retryNumber:
                description: Retry attempts number
                type: integer
              attempts:
                description: Attempts count
                type: integer
              successfulTransactions:
                description: Successful transactions count
                type: integer
              successRate:
                description: Successful transactions ratio
                type: number
                format: double
    ReportStatistics:
      type: object
      properties:
        revenue:
          description: Revenue in last 24 hours
          type: number
          format: double
        revenueGrowthPercentage:
          description: >-
            Revenue growth (in percents) in last 24 hours (against previous 24
            hours)
          type: number
          format: double
        customers:
          description: New customers count in last 24 hours
          type: integer
        customersGrowthPercentage:
          description: >-
            Customers count growth (in percents) in last 24 hours (against
            previous 24 hours)
          type: number
          format: double
        cancels:
          description: Cancels count in last 24 hours
          type: integer
        cancelsGrowthPercentage:
          description: >-
            Cancels count growth (in percents) in last 24 hours (against
            previous 24 hours)
          type: number
          format: double
        refunds:
          description: Refunds count
          type: integer
        refundsGrowthPercentage:
          description: >-
            Refunds count growth (in percents) in last 24 hours (against
            previous 24 hours)
          type: number
          format: double
    SubscriptionCancellationReport:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains an aggregation
            readOnly: true
            properties:
              aggregationValue:
                type: string
                description: Aggregation value
              count:
                type: integer
                description: Count of canceled subscriptions
              averageLength:
                type: number
                format: double
                description: >-
                  Average length of canceled subscription from start to end
                  within the aggregation in seconds
              medianLength:
                type: number
                format: double
                description: >-
                  Median length of canceled subscription from start to end
                  within the aggregation in seconds
    SubscriptionRenewal:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains an aggregation
            readOnly: true
            properties:
              planId:
                description: Plan identifier for which subscriptions are counted
                allOf:
                  - $ref: '#/components/schemas/ResourceId'
              allRenewalCount:
                type: integer
                description: All renewed subscriptions number
              allDunningCount:
                type: integer
                description: All dunned subscriptions number
              abandonedCount:
                type: integer
                description: Abandon subscriptions number
              paidRenewalCount:
                type: integer
                description: >-
                  Number of paid renewed subscriptions. Divide by
                  allRenewalCount to know the renewal success rate
              paidDunningCount:
                type: integer
                description: >-
                  Number of paid dunned subscriptions. Divide by allDunningCount
                  to know the dun success rate
              refundedRenewalCount:
                type: integer
                description: >-
                  Number of paid renewed subscriptions. Divide by
                  allRenewalCount to know the renewal refund rate
              refundedDunningCount:
                type: integer
                description: >-
                  Number of paid dunned subscriptions. Divide by allDunningCount
                  to know the dun refund rate
              chargebackRenewalCount:
                type: integer
                description: >-
                  Number of paid renewed subscriptions. Divide by
                  allRenewalCount to know the renewal chargeback rate
              chargebackDunningCount:
                type: integer
                description: >-
                  Number of paid dunned subscriptions. Divide by allDunningCount
                  to know the dun chargeback rate
    TimeSeriesTransaction:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            description: Contains an aggregation
            readOnly: true
            properties:
              date:
                type: string
                description: Date in format YYYY-MM-DD
              total:
                type: number
                format: double
                description: Amount or count of all transactions within the aggregation
              subaggregates:
                type: object
                description: >-
                  Subaggregates which have appropriate transactions within the
                  range
                properties:
                  subaggregate:
                    type: string
                    description: Subaggregate identifier
                  value:
                    type: number
                    format: double
                    description: >-
                      Amount or count of the subaggregate's transactions within
                      the aggregation
    TransactionsPlan:
      type: array
      items:
        type: object
        description: Contains transaction's data
        readOnly: true
        properties:
          transactionId:
            description: Transaction's identifier
            allOf:
              - $ref: '#/components/schemas/ResourceId'
          websiteId:
            description: Website's identifier
            allOf:
              - $ref: '#/components/schemas/ResourceId'
          customerId:
            description: Customer's identifier
            allOf:
              - $ref: '#/components/schemas/ResourceId'
          customerEmail:
            type: string
            description: Customer's email
          planId:
            description: Plan's identifier
            allOf:
              - $ref: '#/components/schemas/ResourceId'
          subscriptionId:
            description: Subscription's identifier
            allOf:
              - $ref: '#/components/schemas/ResourceId'
          currency:
            type: string
            description: Transaction's currency 3-letters code
          amount:
            type: number
            format: double
            description: Transaction's amount
          rebillNumber:
            type: integer
            description: Transaction's rebill number
          createdTime:
            description: Transaction's created time
            allOf:
              - $ref: '#/components/schemas/ServerTimestamp'
          type:
            type: string
            description: Transaction's type
            enum:
              - authorize
              - capture
              - credit
              - refund
              - sale
              - void
          result:
            type: string
            description: Transaction's result
            enum:
              - approved
              - connection-error
              - declined
              - never-sent
              - pending
              - pending-processor
              - timeout
              - unknown
          gatewayTransactionId:
            type: string
            description: Gateway's own transaction identifier
          paymentType:
            type: string
            enum:
              - payment_card
              - ach
              - paypal
              - china_unionpay
              - ochapay
            description: Type of payment
    ReportDisputeDelays:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              aggregationFieldValue:
                description: >
                  Selected aggregation field value (defined by query). It can
                  be, for example, website or country.

                  You define it in aggregationField param in query.
                type: string
              25th:
                description: 25th percentile
                type: integer
              50th:
                description: 50th percentile
                type: integer
              75th:
                description: 75th percentile
                type: integer
    ReportTransactions:
      type: object
      properties:
        data:
          type: array
          readOnly: true
          items:
            type: object
            properties:
              aggregationFieldValue:
                description: Selected aggregation field value
                type: string
              authApprovedThroughput:
                description: Approved auth transactions to all transactions percentage
                type: integer
              approvedThroughput:
                description: Approved sale transactions to all transactions percentage
                type: integer
              authApprovalCount:
                description: Approved auth transactions count
                type: integer
              disputesRate:
                description: >-
                  Disputed transactions to all approved sale and capture
                  transactions percentage
                type: integer
              disputesCount:
                description: >-
                  Disputed transactions to all approved sale and capture
                  transactions count
                type: integer
              salesCount:
                description: Sales count
                type: integer
              salesValue:
                description: Sales value
                type: number
                format: double
              salesAverage:
                description: Sales average value
                type: number
                format: double
              refundsCount:
                description: Refunds count
                type: integer
              refundsValue:
                description: Refunds value
                type: number
                format: double
              amount:
                description: Amount
                type: number
                format: double
              count:
                description: Transactions count
                type: number
                format: double
    SubscriptionSummaryMetrics:
      type: object
      properties:
        currency:
          description: 'Currency (three letter ISO 4217 alpha code) (eg USD, EUR)'
          readOnly: true
          type: string
        invoicedAmount:
          description: 'Sum of all issued, past due, or paid invoices'
          readOnly: true
          type: number
          format: double
        collectedAmount:
          description: Sum of all paid invoices
          readOnly: true
          type: number
          format: double
        invoiceCount:
          description: 'Number of issued, past due, or paid invoices'
          readOnly: true
          type: integer
  parameters:
    organizationId:
      name: Organization-Id
      in: header
      description: >-
        Organization identifier in scope of which need to perform request (if
        not specified, the default organization will be used)
      schema:
        $ref: '#/components/schemas/ResourceId'
      required: false
    collectionLimit:
      name: limit
      in: query
      description: The collection items limit
      schema:
        type: integer
        minimum: 0
        maximum: 1000
    collectionOffset:
      name: offset
      in: query
      description: The collection items offset
      schema:
        type: integer
        minimum: 0
    resourceId:
      name: id
      in: path
      description: The resource identifier string
      required: true
      schema:
        type: string
        maxLength: 50
        pattern: '^[@~\-\.\w]+$'
    collectionFilter:
      name: filter
      in: query
      description: >
        The collection items filter requires a special format.

        Use "," for multiple allowed values.  Use ";" for multiple fields.

        See the [filter guide](#section/Using-filter) for more options and
        examples about this format.
      schema:
        type: string
    collectionQuery:
      name: q
      in: query
      description: The partial search of the text fields.
      schema:
        type: string
    collectionExpand:
      name: expand
      in: query
      description: >
        Expand a response to get a full related object included inside

        of the `_embedded` path in the response.


        It accepts a comma-separated list of objects to expand.


        See the [expand guide](#section/Expand-to-Include-Embedded-Objects) for
        more info.
      schema:
        type: string
    collectionFields:
      name: fields
      in: query
      description: >-
        Limit the returned fields to the list specified, separated by comma.
        Note that id is always returned.
      schema:
        type: string
    collectionSort:
      name: sort
      in: query
      description: >-
        The collection items sort field and order (prefix with "-" for
        descending sort).
      style: form
      explode: false
      schema:
        type: array
        items:
          type: string
    customFieldResource:
      name: resource
      in: path
      description: The resource type string
      required: true
      schema:
        type: string
        enum:
          - customers
          - payment-cards
          - subscriptions
          - transactions
          - websites
          - contacts
          - products
          - plans
    subscriptionExpand:
      name: expand
      in: query
      description: >
        Expand a response to get a full related object included inside

        of the `_embedded` path in the response.


        To expand multiple objects, it accepts a comma-separated

        list of objects (example: `expand=recentInvoice,initialInvoice`).


        Available arguments are:
          - recentInvoice
          - initialInvoice
          - customer
          - website

        See the [expand guide](#section/Expand-to-Include-Embedded-Objects) for
        more info.
      schema:
        type: string
    tag:
      name: tag
      in: path
      description: The tag name
      required: true
      schema:
        type: string
        pattern: '^[@~\-\.\w\s]+$'
    customerId:
      name: customerId
      in: path
      description: The customer identifier string
      required: true
      schema:
        type: string
        maxLength: 50
        pattern: '^[@~\-\.\w]+$'
    hash:
      name: hash
      in: path
      description: The token identifier string
      required: true
      schema:
        type: string
    token:
      name: token
      in: path
      description: The token string
      required: true
      schema:
        type: string
    systemEventType:
      name: eventType
      in: path
      description: The event type
      required: true
      schema:
        type: string
    rulesVersion:
      name: version
      in: path
      required: true
      description: >-
        The rule set version. Expand response to get full related object instead
        of ID.  See the expand guide for more info.
      schema:
        type: integer
        minimum: 1
    integrationLabel:
      name: label
      in: path
      description: The integration label
      required: true
      schema:
        $ref: '#/components/schemas/OAuth2CredentialService'
    reportTimezone:
      name: tz
      in: query
      description: Report's timezone offset in minutes
      schema:
        type: integer
        minimum: -720
        maximum: 720
  headers:
    Rate-Limit-Limit:
      description: The number of allowed requests in the current period
      schema:
        type: integer
    Rate-Limit-Remaining:
      description: The number of remaining requests in the current period
      schema:
        type: integer
    Rate-Limit-Reset:
      description: >
        The date in format defined by [RFC
        822](https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1)

        when the current period will reset
      schema:
        type: string
    Pagination-Total:
      description: Total items count
      schema:
        type: integer
    Pagination-Limit:
      description: Items per page limit
      schema:
        type: integer
    Pagination-Offset:
      description: Pagination offset
      schema:
        type: integer
  responses:
    Unauthorized:
      description: 'Unauthorized access, invalid credentials was used'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Access forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: Invalid data was sent
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InvalidError'
    NotFound:
      description: Resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Customer:
      description: Customer
      headers:
        Rate-Limit-Limit:
          $ref: '#/components/headers/Rate-Limit-Limit'
        Rate-Limit-Remaining:
          $ref: '#/components/headers/Rate-Limit-Remaining'
        Rate-Limit-Reset:
          $ref: '#/components/headers/Rate-Limit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Customer'
    Found:
      description: Resource was moved
      headers:
        Location:
          schema:
            type: string
    NoContent:
      description: 'Request was accepted, but no response body is returned'
  requestBodies:
    Attachment:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Attachment'
      description: Attachment resource
      required: true
    Blacklist:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Blacklist'
      description: Blacklist resource
      required: true
    Coupon:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Coupon'
      description: Coupon resource
      required: true
    Credential:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Credential'
      description: Credential resource
      required: true
    Customer:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Customer'
      description: Customer resource
      required: true
    Dispute:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Dispute'
      description: Dispute resource
      required: true
    Invoice:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Invoices_Invoice'
      description: Invoice resource
      required: true
    Plan:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Plans_Plan'
      description: Plan resource
      required: true
    Product:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/schemas_Product'
      description: Product resource
      required: true
    SubscriptionCancellation:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SubscriptionCancellation'
      description: Cancellation resource
      required: true
    Subscription:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Subscription'
      description: Subscription resource
      required: true
    Tag:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Tag'
      description: Tag resource
      required: true
    TransactionRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TransactionRequest'
      description: Payment resource
      required: true
    ApiKey:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiKey'
      description: ApiKey resource
      required: true
    CheckoutPage:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CheckoutPage'
      description: Checkout Page resource
      required: true
    OAuth2Credential:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OAuth2Credential'
      description: OAuth2 credential resource
      required: true
    RuleSet:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RuleSet'
      description: Set of rules resource
      required: true
    GatewayAccount:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GatewayAccount'
      description: Gateway Account resource
      required: true
    GatewayAccountDowntimeSchedule:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GatewayAccountDowntimeSchedule'
      description: Gateway Account downtime schedule resource
      required: true
    Segment:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Segment'
      description: Segment resource
      required: true
    Layout:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Layout'
      description: Layout resource
      required: true
    List:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/List'
      description: List resource
      required: true
    Organization:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Organization'
      description: Organization resource
      required: true
    GlobalWebhook:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GlobalWebhook'
      description: Webhook resource
      required: true
    UpdatePassword:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UpdatePassword'
      description: currentPassword and newPassword
      required: true
    User:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/User'
      description: User resource
      required: true
    Website:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Website'
      description: Website resource
      required: true
    DataExport:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DataExport'
      description: Data Export Request
      required: true
    PostOrganization:
      content:
        application/json:
          schema:
            required:
              - name
              - website
              - country
              - reportCurrency
            properties:
              name:
                description: >-
                  The organization name. It must be globally unique within
                  Rebilly.
                type: string
              website:
                description: The organization website address
                type: string
                format: url
              address:
                description: The organization street address
                type: string
                maxLength: 60
              address2:
                description: The organization street address
                type: string
                maxLength: 60
              city:
                description: The organization city
                type: string
                maxLength: 45
              region:
                description: The organization region (state)
                type: string
                maxLength: 45
              country:
                description: The organization country ISO Alpha-2 code
                type: string
                pattern: '^[A-Z]{2}$'
              postalCode:
                description: The organization postal code
                type: string
                maxLength: 10
              phoneNumbers:
                $ref: '#/components/schemas/ContactPhoneNumbers'
              emails:
                $ref: '#/components/schemas/ContactEmails'
              taxDescriptor:
                description: >-
                  The organization's tax label. This will be displayed on the
                  invoice.
                type: string
                maxLength: 255
              invoiceTimeZone:
                description: >-
                  Invoice will use this time zone to display time otherwise UTC
                  will be used. Example "America/New_York"
                type: string
                maxLength: 50
              reportCurrency:
                description: >-
                  The currency used for reports. It can only be set upon
                  organization creation.
                type: string
                pattern: '^[A-Z]{3}$'
      description: Create Organization Request
    PatchOrganization:
      content:
        application/json:
          schema:
            properties:
              name:
                description: >-
                  The organization name. It must be globally unique within
                  Rebilly.
                type: string
              address:
                description: The organization street address
                type: string
                maxLength: 60
              address2:
                description: The organization street address
                type: string
                maxLength: 60
              city:
                description: The organization city
                type: string
                maxLength: 45
              region:
                description: The organization region (state)
                type: string
                maxLength: 45
              country:
                description: The organization country ISO Alpha-2 code
                type: string
                pattern: '^[A-Z]{2}$'
              postalCode:
                description: The organization postal code
                type: string
                maxLength: 10
              phoneNumbers:
                $ref: '#/components/schemas/ContactPhoneNumbers'
              emails:
                $ref: '#/components/schemas/ContactEmails'
              taxDescriptor:
                description: >-
                  The organization's tax label. This will be displayed on the
                  invoice.
                type: string
                maxLength: 255
              invoiceTimeZone:
                description: >-
                  Invoice will use this time zone to display time otherwise UTC
                  will be used. Example "America/New_York"
                type: string
                maxLength: 50
      description: Create Organization Request
paths:
  /3dsecure:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - 3D Secure
      summary: Retrieve a list of ThreeDSecure entries
      operationId: Get3DSecureCollection
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ThreeDSecure'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - 3D Secure
      summary: Create a ThreeDSecure entry
      operationId: Post3DSecure
      description: |
        Create a ThreeDSecure entry
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ThreeDSecure'
        description: ThreeDSecure resource
        required: true
      responses:
        '201':
          description: ThreeDSecure entry was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreeDSecure'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/3dsecure/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - 3D Secure
      summary: Retrieve a ThreeDSecure entry
      operationId: Get3DSecure
      description: |
        Retrieve a ThreeDSecure entry with specified identifier string
      responses:
        '200':
          description: ThreeDSecure entry was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreeDSecure'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /attachments:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Files
      summary: Retrieve a list of Attachments
      operationId: GetAttachmentCollection
      description: |
        Retrieve a list of Attachments
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionQuery'
        - $ref: '#/components/parameters/collectionExpand'
        - $ref: '#/components/parameters/collectionFields'
        - name: sort
          in: query
          description: >-
            The collection items sort field and order (prefix with "-" for
            descending sort).
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
              enum:
                - id
                - '-id'
                - name
                - '-name'
                - relatedId
                - '-relatedId'
                - relatedType
                - '-relatedType'
                - fileId
                - '-fileId'
                - createdTime
                - '-createdTime'
                - updatedTime
                - '-updatedTime'
      responses:
        '200':
          description: A list of Attachments was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Attachment'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $attachments = $client->attachments()->search([
                'filter' => 'relatedType:customer',
            ]);
    post:
      tags:
        - Files
      summary: Create an Attachment
      operationId: PostAttachment
      description: |
        Create an Attachment
      requestBody:
        $ref: '#/components/requestBodies/Attachment'
      responses:
        '201':
          description: Attachment was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Attachment'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $attachmentForm = new Rebilly\Entities\Attachment();
            $attachmentForm->setFileId('fileId');
            $attachmentForm->setRelatedType($attachmentForm::TYPE_CUSTOMER);
            $attachmentForm->setRelatedId('customerId');

            try {
                $attachment = $client->attachments()->create($attachmentForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/attachments/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Files
      summary: Retrieve an Attachment
      operationId: GetAttachment
      description: |
        Retrieve a Attachment with specified identifier string
      responses:
        '200':
          description: Attachment was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Attachment'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $attachment = $client->attachments()->load('attachmentId');
    put:
      tags:
        - Files
      summary: Update the Attachment with predefined ID
      operationId: PutAttachment
      description: |
        Update the Attachment with predefined ID
      requestBody:
        $ref: '#/components/requestBodies/Attachment'
      responses:
        '200':
          description: Attachment was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Attachment'
        '201':
          description: Attachment was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Attachment'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $attachmentForm = new Rebilly\Entities\Attachment();
            $attachmentForm->setFileId('fileId');
            $attachmentForm->setRelatedType($attachmentForm::TYPE_CUSTOMER);
            $attachmentForm->setRelatedId('customerId');

            try {
                $attachment = $client->attachments()->update('attachmentId', $attachmentForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Files
      summary: Delete an Attachment
      operationId: DeleteAttachment
      description: |
        Delete the Attachment with predefined identifier string
      responses:
        '204':
          description: Attachment was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $client->attachments()->delete('attachmentId');
  /authentication-options:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customer Authentication
      summary: Read current authentication options
      operationId: GetAuthenticationOption
      description: |
        Read current authentication options
      responses:
        '200':
          description: Current authentication options was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AuthenticationOptions'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $authenticationOptions = $client->authenticationOptions()->load();
    put:
      tags:
        - Customer Authentication
      summary: Change authentication options
      operationId: PutAuthenticationOption
      description: |
        Change options
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthenticationOptions'
        description: Authentication Options resource
        required: true
      responses:
        '200':
          description: Authentication Options were updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationOptions'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: >
            $authenticationOptionsForm = new
            Rebilly\Entities\AuthenticationOptions();

            // Regular expression below matches any password with 6+ length that
            contains alphabet symbols and/or numbers.

            $authenticationOptionsForm->setPasswordPattern('/^[a-zA-Z0-9]{6,}$/');


            try {
                $authenticationOptions = $client->authenticationOptions()->update($authenticationOptionsForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  /authentication-tokens:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customer Authentication
      summary: Retrieve a list of auth tokens
      operationId: GetAuthenticationTokenCollection
      description: |
        Retrieve a list of auth tokens
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of auth tokens was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AuthenticationToken'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $authenticationTokens = $client->authenticationTokens()->search([
                'filter' => 'customerId:testCustomer',
            ]);
    post:
      tags:
        - Customer Authentication
      summary: Login
      operationId: PostAuthenticationToken
      description: |
        Login a customer
      security:
        - SecretApiKey: []
        - JWT: []
        - PublishableApiKey: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthenticationToken'
        description: AuthenticationToken resource
        required: true
      responses:
        '201':
          description: Login successful
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationToken'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $authenticationForm = new Rebilly\Entities\AuthenticationToken();
            $authenticationForm->setUsername('username');
            $authenticationForm->setPassword('test123');

            try {
                $authenticationToken = $client->authenticationTokens()->login($authenticationForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/authentication-tokens/{token}':
    parameters:
      - name: token
        in: path
        description: The token identifier string
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customer Authentication
      summary: Verify
      operationId: GetAuthenticationTokenVerification
      description: |
        Verify an authentication token
      security:
        - SecretApiKey: []
        - JWT: []
        - PublishableApiKey: []
      responses:
        '200':
          description: Authentication Token was verified
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationToken'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $isVerified = $client->authenticationTokens()->verify('token');
    delete:
      tags:
        - Customer Authentication
      summary: Logout a customer
      operationId: DeleteAuthenticationToken
      description: |
        Logout a customer
      security:
        - SecretApiKey: []
        - JWT: []
        - PublishableApiKey: []
      responses:
        '204':
          description: Customer was logged out
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $client->authenticationTokens()->logout('token');
  '/authentication-tokens/{token}/exchange':
    parameters:
      - name: token
        in: path
        description: The token identifier string
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Customer Authentication
      summary: Exchange
      operationId: PostAuthenticationTokenExchange
      description: >
        Exchange Authentication Token for JWT


        It will also invalidate an Authentication Token by default (so it can
        only be exchanged once).
      security:
        - SecretApiKey: []
        - JWT: []
        - PublishableApiKey: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerJWT'
        required: true
      responses:
        '200':
          description: Authentication Token exchanged for JWT
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerJWT'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /bank-accounts:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Bank Accounts
      summary: Create a Bank Account
      operationId: PostBankAccount
      description: |
        Create a Bank Account
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/BankAccountCreateToken'
                - $ref: '#/components/schemas/BankAccountCreatePlain'
        description: BankAccount resource
        required: true
      responses:
        '201':
          description: Bank Account was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $bankAccountForm = new Rebilly\Entities\BankAccount();
            $bankAccountForm->setCustomerId('customerId');
            $bankAccountForm->setRoutingNumber('0123456');
            $bankAccountForm->setAccountNumber('0123456');
            $bankAccountForm->setAccountType('checking');
            $bankAccountForm->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 {
                $bankAccount = $client->bankAccounts()->create($bankAccountForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    get:
      tags:
        - Bank Accounts
      summary: Retrieve a list of bank accounts
      operationId: GetBankAccountCollection
      description: |
        Retrieve a list of Bank Accounts
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of Bank Accounts was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BankAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $bankAccounts = $client->bankAccounts()->search([
                'filter' => 'customerId:testId',
            ]);
  '/bank-accounts/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Bank Accounts
      summary: Retrieve a Bank Account
      operationId: GetBankAccount
      description: |
        Retrieve a Bank Account with specified identifier string
      responses:
        '200':
          description: Bank Account was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $bankAccount = $client->bankAccounts()->load('bankAccountId');
    patch:
      tags:
        - Bank Accounts
      summary: Update a bank account's values
      operationId: PatchBankAccount
      description: >
        Update bank account's values except for the account number and routing
        number
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                bankName:
                  description: Bank's name.
                  type: string
                accountType:
                  description: Bank's Account type.
                  type: string
                  enum:
                    - checking
                    - savings
                    - other
                address:
                  description: The Address.
                  allOf:
                    - $ref: '#/components/schemas/ContactObject'
                customFields:
                  $ref: '#/components/schemas/ResourceCustomFields'
        description: Bank Account
      responses:
        '200':
          description: Bank Account was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
    put:
      tags:
        - Bank Accounts
      summary: Create a Bank Account with predefined ID
      operationId: PutBankAccount
      description: |
        Create or update a BankAccount with predefined identifier string
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/BankAccountCreateToken'
                - $ref: '#/components/schemas/BankAccountCreatePlain'
        description: BankAccount resource
        required: true
      responses:
        '200':
          description: BankAccount was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankAccount'
        '201':
          description: BankAccount was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $bankAccountForm = new Rebilly\Entities\BankAccount();
            $bankAccountForm->setCustomerId('customerId');
            $bankAccountForm->setRoutingNumber('0123456');
            $bankAccountForm->setAccountNumber('0123456');
            $bankAccountForm->setAccountType('checking');
            $bankAccountForm->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 {
                $bankAccount = $client->customers()->create($bankAccountForm, 'bankAccountId');
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/bank-accounts/{id}/deactivation':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Bank Accounts
      summary: Deactivate a Bank Account
      operationId: PostBankAccountDeactivation
      description: |
        Deactivate a Bank Account
      responses:
        '201':
          description: Bank Account was deactivated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
      x-code-samples:
        - lang: PHP
          source: |
            $bankAccount = $client->bankAccounts()->deactivate('bankAccountId');
  /blacklists:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Blacklists
      summary: Retrieve a list of blacklists
      operationId: GetBlacklistCollection
      description: |
        Retrieve a list of blacklists
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of Blacklists was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Blacklist'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $blacklists = $client->blacklists()->search([
                'filter' => 'value:testValue',
            ]);
    post:
      tags:
        - Blacklists
      summary: Create a blacklist
      operationId: PostBlacklist
      description: |
        Create a blacklist
      requestBody:
        $ref: '#/components/requestBodies/Blacklist'
      responses:
        '201':
          description: Blacklist was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Blacklist'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $blacklistForm = new Rebilly\Entities\Blacklist();
            $blacklistForm->setType($blacklistForm::TYPE_EMAIL);
            $blacklistForm->setValue('test@test.com');
            $blacklistForm->setExpiredTime('2025-01-01 05:00:00');

            try {
                $blacklist = $client->blacklists()->create($blacklistForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/blacklists/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Blacklists
      summary: Retrieve a blacklist
      operationId: GetBlacklist
      description: |
        Retrieve a blacklist with specified identifier string
      responses:
        '200':
          description: Blacklist was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Blacklist'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $blacklist = $client->blacklists()->load('blacklistId');
    put:
      tags:
        - Blacklists
      summary: Create a blacklist with predefined ID
      operationId: PutBlacklist
      description: |
        Create a blacklist with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/Blacklist'
      responses:
        '201':
          description: Blacklist was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Blacklist'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: Blacklist exist and cannot be updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $blacklistForm = new Rebilly\Entities\Blacklist();
            $blacklistForm->setType($blacklistForm::TYPE_EMAIL);
            $blacklistForm->setValue('test@test.com');
            $blacklistForm->setExpiredTime('2025-01-01 05:00:00');

            try {
                $blacklist = $client->blacklists()->create($blacklistForm, 'blacklistId');
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Blacklists
      summary: Delete a blacklist
      operationId: DeleteBlacklist
      description: |
        Delete a blacklist with predefined identifier string
      responses:
        '204':
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          description: Blacklist was deleted
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $client->blacklists()->delete('blacklistId');
  /coupons-redemptions:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Coupons
      summary: Retrieve a list of coupon redemptions
      operationId: GetCouponRedemptionCollection
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionQuery'
        - $ref: '#/components/parameters/collectionSort'
      responses:
        '200':
          description: Coupons redemptions were retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CouponRedemption'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $couponRedemptions = $client->couponsRedemptions()->search([
                'filter' => 'customerId:testCustomer',
            ]);
    post:
      tags:
        - Coupons
      summary: Redeem a coupon
      operationId: PostCouponRedemption
      description: |
        Redeem a coupon
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CouponRedemption'
        description: Redeem a coupon
        required: true
      responses:
        '201':
          description: Coupon was redeemed
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CouponRedemption'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $redemptionForm = new Rebilly\Entities\Coupons\Redemption();
            $redemptionForm->setCustomerId('customerId');
            $redemptionForm->setRedemptionCode('redemptionCode');

            $restrictionArray = [
                'type' => Rebilly\Entities\Coupons\Restriction::TYPE_DISCOUNTS_PER_REDEMPTION,
                'quantity' => 2,
            ];

            $restrictionForm = new Rebilly\Entities\Coupons\Restriction([
                $restrictionArray,
            ]);

            $redemptionForm->setAdditionalRestrictions($restrictionForm);

            try {
                $couponRedemption = $client->couponsRedemptions()->redeem($redemptionForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/coupons-redemptions/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Coupons
      summary: Retrieve a coupon redemption with specified identifier string
      operationId: GetCouponRedemption
      responses:
        '200':
          description: Retrieve a coupon redemption with specified identifier string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CouponRedemption'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: >
            $couponRedemption =
            $client->couponsRedemptions()->load('redemptionCode');
  '/coupons-redemptions/{id}/cancel':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Coupons
      summary: Cancel a coupon redemption
      operationId: PostCouponRedemptionCancellation
      responses:
        '201':
          description: Cancel a coupon redemption
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $client->couponsRedemptions()->cancel('id');
  /coupons:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Coupons
      summary: Retrieve a list of coupons
      operationId: GetCouponCollection
      description: |
        Retrieve a list of coupons
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionQuery'
        - $ref: '#/components/parameters/collectionSort'
      responses:
        '200':
          description: A list of coupons was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Coupon'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $coupons = $client->coupons()->search([
                'filter' => 'status:issued',
            ]);
    post:
      tags:
        - Coupons
      summary: Create a coupon
      operationId: PostCoupon
      description: |
        Create a coupon
      requestBody:
        $ref: '#/components/requestBodies/Coupon'
      responses:
        '201':
          description: Coupon was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Coupon'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: >
            $couponForm = new Rebilly\Entities\Coupons\Coupon();


            $discountArray = [
                'currency' => 'USD',
                'amount' => 1.99,
            ];


            $discountForm = new
            \Rebilly\Entities\Coupons\Discounts\Fixed($discountArray);

            $couponForm->setDiscount($discountForm);

            // Coupon can be used right now

            $couponForm->setIssuedTime(date('Y-m-d H:i:s'));


            $restrictionArray = [
                'quantity' => 2,
            ];


            $restrictionForm = new
            Rebilly\Entities\Coupons\Restrictions\DiscountsPerRedemption($restrictionArray);


            $couponForm->setRestrictions([$restrictionForm]);


            try {
                $coupon = $client->coupons()->create($couponForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/coupons/{redemptionCode}':
    parameters:
      - name: redemptionCode
        in: path
        description: The Coupon's redemption code
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Coupons
      summary: Retrieve a coupon
      operationId: GetCoupon
      description: |
        Retrieve a coupon with specified redemption code string
      responses:
        '200':
          description: Coupon was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Coupon'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $coupon = $client->coupons()->load('redemptionCode');
    put:
      tags:
        - Coupons
      summary: Create or update a coupon with predefined redemption code
      operationId: PutCoupon
      description: |
        Create or update a coupon with predefined redemption code
      requestBody:
        $ref: '#/components/requestBodies/Coupon'
      responses:
        '200':
          description: Coupon was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Coupon'
        '201':
          description: Coupon was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Coupon'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: >
            $couponForm = new Rebilly\Entities\Coupons\Coupon();


            $discountArray = [
                'type' => Rebilly\Entities\Coupons\Discount::TYPE_FIXED,
                'currency' => 'USD',
                'amount' => 1.99,
            ];


            $discountForm = new
            Rebilly\Entities\Coupons\Discount($discountArray);

            $couponForm->setDiscount($discountForm);


            $restrictionArray = [
                'type' => Rebilly\Entities\Coupons\Restriction::TYPE_DISCOUNTS_PER_REDEMPTION,
                'quantity' => 2,
            ];


            $restrictionForm = new Rebilly\Entities\Coupons\Restriction([
                $restrictionArray,
            ]);


            $couponForm->setRestrictions($restrictionForm);


            try {
                $coupon = $client->coupons()->create($couponForm, 'redemptionCode');
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/coupons/{redemptionCode}/expiration':
    parameters:
      - name: redemptionCode
        in: path
        description: The coupon's redemption code
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Coupons
      summary: Set a coupon's expiration time.
      operationId: PostCouponExpiration
      description: |
        Set a coupon's expiry time with the specified redemption code.
        The expiredTime of a coupon must be greater than its issuedTime.
        This cannot be performed on expired coupons.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CouponExpiration'
        description: Coupon resource
      responses:
        '201':
          description: Coupon expiration was successfully set
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Coupon'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            The coupon is already expired and has been redeemed, unable to
            reschedule expiration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationError'
  /credentials:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customer Authentication
      summary: Retrieve a list of credentials
      operationId: GetCredentialCollection
      description: |
        Retrieve a list of credentials
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of Credentials was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Credential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $customerCredentials = $client->customerCredentials()->search([
                'filter' => 'customerId:testCustomer',
            ]);
    post:
      tags:
        - Customer Authentication
      summary: Create a credential
      operationId: PostCredential
      description: |
        Create a credential
      requestBody:
        $ref: '#/components/requestBodies/Credential'
      responses:
        '201':
          description: Credential was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $customerCredentialForm = new Rebilly\Entities\CustomerCredential();
            $customerCredentialForm->setCustomerId('customerId');
            $customerCredentialForm->setUsername('test');
            $customerCredentialForm->setPassword('1234');

            try {
                $customerCredential = $client->customerCredentials()->create($customerCredentialForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/credentials/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customer Authentication
      summary: Retrieve a credential
      operationId: GetCredential
      description: |
        Retrieve a credential with specified identifier string
      responses:
        '200':
          description: Credential was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: >
            $customerCredential =
            $client->customerCredentials()->load('credentialId');
    put:
      tags:
        - Customer Authentication
      summary: Create or update a credential with predefined ID
      operationId: PutCredential
      description: |
        Create or update a credential with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/Credential'
      responses:
        '200':
          description: Credential was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credential'
        '201':
          description: Credential was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $customerCredentialForm = new Rebilly\Entities\CustomerCredential();
            $customerCredentialForm->setCustomerId('customerId');
            $customerCredentialForm->setUsername('test');
            $customerCredentialForm->setPassword('1234');

            try {
                $customerCredential = $client->customerCredentials()->update('credentialId', $customerCredentialForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Customer Authentication
      summary: Delete a credential
      operationId: DeleteCredential
      description: |
        Delete a credential with predefined identifier string
      responses:
        '204':
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          description: Credential was deleted
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $client->customerCredentials()->delete('credentialId');
  '/custom-fields/{resource}':
    parameters:
      - $ref: '#/components/parameters/customFieldResource'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Custom Fields
      summary: Retrieve Custom Fields
      operationId: GetCustomFieldCollection
      description: |
        Retrieve a schema of Custom Fields for the given resource type
      responses:
        '200':
          description: A schema of Custom Fields was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                description: The list of custom fields
                type: array
                items:
                  $ref: '#/components/schemas/CustomField'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $customFields = $client->customFields()->search('customers', [
                'filter' => 'type:boolean',
            ]);
  '/custom-fields/{resource}/{name}':
    parameters:
      - $ref: '#/components/parameters/customFieldResource'
      - name: name
        in: path
        description: The custom field's identifier string
        required: true
        schema:
          type: string
          maxLength: 60
          pattern: '^[\w-]+$'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Custom Fields
      summary: Retrieve a Custom Field
      operationId: GetCustomField
      description: |
        Retrieve a schema of the given Custom Field for the given resource type
      responses:
        '200':
          description: A schema of the Custom Field was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomField'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: >
            $customField = $client->customFields()->load('customers',
            'testFieldName');
    put:
      tags:
        - Custom Fields
      summary: Create or alter a Custom Field
      operationId: PutCustomField
      description: >
        Create or alter a schema of the given Custom Field for the given
        resource type.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomField'
        description: Custom Fields schema of the given resource type
        required: true
      responses:
        '200':
          description: The Custom Field was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomField'
        '201':
          description: The Custom Fields was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomField'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: >
            The schema is in use: remove all the associated data in order to
            remove or alter the schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $customFieldForm = new Rebilly\Entities\CustomField();
            $customFieldForm->setType($customFieldForm::TYPE_BOOLEAN);

            try {
                $customField = $client->customFields()->update('customers', 'testFieldName', $customFieldForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  /customers:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customers
      summary: Retrieve a list of customers
      operationId: GetCustomerCollection
      description: |
        Retrieve a list of customers
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionQuery'
        - $ref: '#/components/parameters/collectionExpand'
        - $ref: '#/components/parameters/collectionFields'
        - name: sort
          in: query
          description: >-
            The collection items sort field and order (prefix with "-" for
            descending sort).
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
              enum:
                - id
                - '-id'
                - email
                - '-email'
                - averageValue
                - '-averageValue'
                - paymentCount
                - '-paymentCount'
                - lastPaymentTime
                - '-lastPaymentTime'
                - lifetimeRevenue
                - '-lifetimeRevenue'
                - invoiceCount
                - '-invoiceCount'
                - createdTime
                - '-createdTime'
                - updatedTime
                - '-updatedTime'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
              - text/csv
            default: application/json
      responses:
        '200':
          description: A list of Customers was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Customer'
            text/csv:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Customer'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $customers = $client->customers()->search([
                'filter' => 'firstName:John',
            ]);
    post:
      tags:
        - Customers
      summary: Create a customer (without an ID)
      operationId: PostCustomer
      description: >
        Create a customer without a predefined ID.

        The customer's primary address

        will be used as the default address for payment

        instruments, subscriptions and invoices if none

        are provided.


        If you wish to create the customer with a predefined

        ID (which we recommend to prevent duplication), you

        may use our `PUT` request described below.


        Read our guide to [preventing
        duplicates](https://api-guides.rebilly.com/core-concepts/preventing-duplicates)

        to understand more.
      requestBody:
        $ref: '#/components/requestBodies/Customer'
      responses:
        '201':
          $ref: '#/components/responses/Customer'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $customerForm = new Rebilly\Entities\Customer();
            $customerForm->setPrimaryAddress([
                '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 {
                $customer = $client->customers()->create($customerForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/customers/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customers
      summary: Retrieve a customer
      operationId: GetCustomer
      description: |
        Retrieve a customer with specified identifier string
      responses:
        '200':
          description: Customer was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Customer'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $customers = $client->customers()->load('myCustomerId');
    put:
      tags:
        - Customers
      summary: Upsert a customer with predefined ID
      operationId: PutCustomer
      description: >
        Create or update (upsert) a customer with predefined identifier string.

        Read our guide to [preventing
        duplicates](https://api-guides.rebilly.com/core-concepts/preventing-duplicates)

        to understand more.
      requestBody:
        $ref: '#/components/requestBodies/Customer'
      responses:
        '200':
          $ref: '#/components/responses/Customer'
        '201':
          $ref: '#/components/responses/Customer'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $customerForm = new Rebilly\Entities\Customer();
            $customerForm->setPrimaryAddress([
                '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 {
                $customer = $client->customers()->update('myCustomerId', $customerForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      parameters:
        - in: query
          name: targetCustomerId
          required: true
          schema:
            type: string
          description: >-
            The customer idendifier to get the data of the deleted duplicate
            customer
      tags:
        - Customers
      summary: Merge and delete a customer
      operationId: DeleteCustomer
      description: >-
        Merge one duplicate customer to another target customer and delete the
        former.
      responses:
        '204':
          description: Customer has been merged and removed
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /customer-timeline-custom-events:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customers Timeline
      summary: Retrieve a list of customer timeline custom event types
      operationId: GetCustomerTimelineCustomEventTypeCollection
      description: |
        Retrieve a list of customer timeline custom event types
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: >-
            A list of customer timeline custom event types was retrieved
            successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CustomerTimelineCustomEvent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Customers
      summary: Create Customer Timeline custom event type
      operationId: PostCustomerTimelineCustomEventType
      description: |
        Create Customer Timeline custom event type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerTimelineCustomEvent'
        description: Customer Timeline Custom Event Type resource
        required: true
      responses:
        '201':
          description: Customer Timeline Custom Event Type was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerTimelineCustomEvent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/customer-timeline-custom-events/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customers Timeline
      summary: >-
        Retrieve customer timeline custom event type with specified identifier
        string
      operationId: GetCustomerTimelineCustomEventType
      description: |
        Retrieve customer timeline custom event type
      responses:
        '200':
          description: Customer Timeline custom event type was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerTimelineCustomEvent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /customer-timeline-events:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customers Timeline
      summary: Retrieve a list of customer timeline messages for all customers
      operationId: GetCustomerTimelineEventCollection
      description: |
        Retrieve a list of customer timeline messages for all customers
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: A list of customer timeline messages was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CustomerTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  '/customers/{id}/lead-source':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customers
      summary: Retrieve a customer's Lead Source
      operationId: GetCustomerLeadSource
      description: |
        Retrieve a Lead Source of given customer
      responses:
        '200':
          description: Lead Source was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadSource'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $customer = $client->customers()->load('myCustomerId');
            $leadSource = $customer->getLeadSource();
    put:
      tags:
        - Customers
      summary: Create a Lead Source for a customer
      operationId: PutCustomerLeadSource
      description: |
        Create a Lead Source for a customer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeadSource'
        description: Lead Source resource
        required: true
      responses:
        '201':
          description: Lead Source was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadSource'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $leadSourceForm = new Rebilly\Entities\LeadSource();
            $leadSourceForm->setSource('TestSource');
            $leadSourceForm->setCampaign('TestCampaign');

            try {
                $customer = $client->customers()->updateLeadSource('myCustomerId', $leadSourceForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Customers
      summary: Delete a Lead Source for a customer
      operationId: DeleteCustomerLeadSource
      description: |
        Delete a Lead Source that belongs to a certain customer
      responses:
        '204':
          description: Lead Source was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
      x-code-samples:
        - lang: PHP
          source: |
            $customer = $client->customers()->deleteLeadSource('myCustomerId');
  '/customers/{id}/timeline':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customers Timeline
      summary: Retrieve a list of customer timeline messages
      operationId: GetCustomerTimelineCollection
      description: |
        Retrieve a list of customer timeline messages
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: A list of customer timeline messages was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CustomerTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Customers Timeline
      summary: Create a customer Timeline comment or custom defined event
      operationId: PostCustomerTimeline
      description: |
        Create a customer Timeline comment or custom defined event
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerTimeline'
        description: Customer Timeline resource
        required: true
      responses:
        '201':
          description: Customer Timeline comment or custom defined event was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/customers/{id}/timeline/{messageId}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - name: messageId
        in: path
        description: The Customer Timeline message ID
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customers Timeline
      summary: Retrieve a customer Timeline message
      operationId: GetCustomerTimeline
      description: |
        Retrieve a customer message with specified identifier string
      responses:
        '200':
          description: Customer message was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Customers Timeline
      summary: Delete a Customer Timeline message
      operationId: DeleteCustomerTimeline
      description: |
        Delete a Customer Timeline message with predefined identifier string
      responses:
        '204':
          description: Customer Timeline message was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  '/customers/{id}/upcoming-invoices':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Invoices
      summary: Retrieve customer's upcoming invoices
      operationId: GetCustomerUpcomingInvoiceCollection
      description: >
        Retrieve a list of upcoming invoices from the subscriptions which belong
        to the given customer.

        The endpoint is temporary before upcoming invoices get a complete
        integration.
      parameters:
        - $ref: '#/components/parameters/collectionExpand'
      responses:
        '200':
          description: Upcoming invoices are retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /disputes:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Disputes
      summary: Retrieve a list of disputes
      operationId: GetDisputeCollection
      description: |
        Retrieve a list of disputes
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of disputes was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Dispute'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $disputes = $client->disputes()->search([
                'filter' => 'transactionId:testId',
            ]);
    post:
      tags:
        - Disputes
      summary: Create a dispute
      operationId: PostDispute
      description: |
        Create a dispute
      requestBody:
        $ref: '#/components/requestBodies/Dispute'
      responses:
        '201':
          description: Dispute was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dispute'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $disputeForm = new Rebilly\Entities\Dispute();
            $disputeForm->setTransactionId('transactionId');
            $disputeForm->setCurrency('USD');
            $disputeForm->setAmount(10);
            $disputeForm->setReasonCode(1000);
            $disputeForm->setType($disputeForm::TYPE_1CB);
            $disputeForm->setStatus($disputeForm::STATUS_RESPONSE_NEEDED);
            $disputeForm->setPostedTime('2025-01-01 05:00:00');

            try {
                $dispute = $client->disputes()->create($disputeForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/disputes/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Disputes
      summary: Retrieve a dispute
      operationId: GetDispute
      description: |
        Retrieve a dispute with specified identifier string
      responses:
        '200':
          description: Dispute was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dispute'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $dispute = $client->disputes()->load('disputeId');
    put:
      tags:
        - Disputes
      summary: Create or update a Dispute with predefined ID
      operationId: PutDispute
      description: |
        Create or update a Dispute with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/Dispute'
      responses:
        '200':
          description: Dispute was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dispute'
        '201':
          description: Dispute was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dispute'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $disputeForm = new Rebilly\Entities\Dispute();
            $disputeForm->setTransactionId('transactionId');
            $disputeForm->setCurrency('USD');
            $disputeForm->setAmount(10);
            $disputeForm->setReasonCode(1000);
            $disputeForm->setType($disputeForm::TYPE_1CB);
            $disputeForm->setStatus($disputeForm::STATUS_RESPONSE_NEEDED);
            $disputeForm->setPostedTime('2025-01-01 05:00:00');

            try {
                $dispute = $client->disputes()->update('disputeId', $dispute);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/disputes/{id}/matched-rules':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Disputes
      summary: Get matched rules for the dispute
      operationId: GetDisputeMatchedRuleCollection
      description: Get matched rules for the dispute
      responses:
        '200':
          description: List of matched rules was retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MatchedRule'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /files:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Files
      summary: Retrieve a list of files
      operationId: GetFileCollection
      description: |
        Retrieve a list of files
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionQuery'
        - $ref: '#/components/parameters/collectionExpand'
        - $ref: '#/components/parameters/collectionFields'
        - name: sort
          in: query
          description: >-
            The collection items sort field and order (prefix with "-" for
            descending sort).
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
              enum:
                - id
                - '-id'
                - name
                - '-name'
                - extension
                - '-extension'
                - size
                - '-size'
                - width
                - '-width'
                - height
                - '-height'
                - createdTime
                - '-createdTime'
                - updatedTime
                - '-updatedTime'
      responses:
        '200':
          description: A list of Files was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/File'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $files = $client->files()->search([
                'filter' => 'name:TestFile',
            ]);
    post:
      tags:
        - Files
      summary: Create a file
      operationId: PostFile
      security:
        - SecretApiKey: []
        - JWT: []
        - PublishableApiKey: []
      description: >
        Additionally, a file can be sent with:
         - multipart/form-data POST request: in this case all property names are the same as the JSON ones (`file` is an uploaded file)
         - file body request: the file body is sent as the request body, with the appropriate `Content-Type`. No additional
         properties can be set along the request data

        The following file types only are allowed:
         - jpg
         - png
         - gif
         - pdf
         - mp3


        If using a Publishable Api Key, only private files can be created. The
        files can later on be modified or used using
         a secret API key.
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/FileCreateFromInline'
                - $ref: '#/components/schemas/FileCreateFromUrl'
        required: true
      responses:
        '201':
          description: File was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $fileForm = new Rebilly\Entities\File();
            $fileForm->setUrl('http://test.com/somefile.jpg');

            try {
                $file = $client->files()->create($fileForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/files/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Files
      summary: Retrieve a File Record
      operationId: GetFile
      description: |
        Retrieve a File with specified identifier string
      responses:
        '200':
          description: File was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $file = $client->files()->load('fileId');
    put:
      tags:
        - Files
      summary: Update the File with predefined ID
      operationId: PutFile
      description: >
        Update the File with predefined ID. Note that file can be uploaded with
        POST only.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/File'
        description: File resource
        required: true
      responses:
        '200':
          description: File was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $fileForm = new Rebilly\Entities\File();
            $fileForm->setDescription('This is a test file');

            try {
                $file = $client->files()->update('fileId', $fileForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Files
      summary: Delete a File
      operationId: DeleteFile
      description: |
        Delete the File with predefined identifier string
      responses:
        '204':
          description: File was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $client->files()->delete('fileId');
  '/files/{id}/download':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Files
      summary: Download a file
      operationId: GetFileDownload
      description: |
        Download a file
      responses:
        '200':
          description: The file was retrieved successfully
          headers:
            Content-Length:
              description: The number of bytes in the file
              schema:
                type: integer
            Content-Type:
              description: The MIME type of the file
              schema:
                type: string
          content:
            application/json:
              schema:
                type: string
                readOnly: true
        '302':
          $ref: '#/components/responses/Found'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/files/{id}/download{extension}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - name: extension
        in: path
        description: File extension which also indicates the desired file format
        required: true
        schema:
          type: string
          enum:
            - .png
            - .jpg
            - .gif
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Files
      summary: Download image in specific format
      operationId: GetFileDownloadExtension
      description: |
        Download image in specific format. Images are converted server-side
      responses:
        '200':
          description: The file was retrieved successfully
          headers:
            Content-Length:
              description: The number of bytes in the file
              schema:
                type: integer
            Content-Type:
              description: The MIME type of the file
              schema:
                type: string
          content:
            application/json:
              schema:
                type: string
                readOnly: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /invoices:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Invoices
      summary: Retrieve a list of invoices
      operationId: GetInvoiceCollection
      description: |
        Retrieve a list of invoices
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
              - text/csv
            default: application/json
      responses:
        '200':
          description: A list of invoices was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Invoices_Invoice'
            text/csv:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $invoices = $client->invoices()->search([
                'filter' => 'customerId:testCustomerId',
            ]);
    post:
      tags:
        - Invoices
      summary: Create an invoice
      operationId: PostInvoice
      description: |
        Create an invoice
      requestBody:
        $ref: '#/components/requestBodies/Invoice'
      responses:
        '201':
          description: Invoice was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          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 (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/invoices/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Invoices
      summary: Retrieve an invoice
      operationId: GetInvoice
      description: |
        Retrieve an invoice with specified identifier string
      parameters:
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
              - application/pdf
            default: application/json
      responses:
        '200':
          description: Invoice was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
            application/pdf:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $invoice = $client->invoices()->load('invoiceId');
    put:
      tags:
        - Invoices
      summary: Create or update an invoice with predefined ID
      operationId: PutInvoice
      description: |
        Create or update an invoice with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/Invoice'
      responses:
        '200':
          description: Invoice was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '201':
          description: Invoice was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          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()->update('invoiceId', $invoiceForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/invoices/{id}/abandon':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Invoices
      summary: Abandon an invoice
      operationId: PostInvoiceAbandonment
      description: |
        Abandon an invoice with specified identifier string
      responses:
        '201':
          description: Invoice was abandoned successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $invoice = $client->invoices()->abandon('invoiceId');
  '/invoices/{id}/issue':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Invoices
      summary: Issue an invoice
      operationId: PostInvoiceIssuance
      description: >
        Issue an invoice with specified identifier string. It must be in `draft`
        status.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceIssue'
        description: InvoiceIssue resource
        required: true
      responses:
        '201':
          description: Invoice was issued successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
      x-code-samples:
        - lang: PHP
          source: >
            $invoice = $client->invoices()->issue('invoiceId', '2025-01-01
            05:00:00');
  '/invoices/{id}/items':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Invoices
      summary: Retrieve invoice items
      operationId: GetInvoiceItemCollection
      description: |
        Retrieve an invoice items with specified invoice identifier string
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: Invoice items were retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/InvoiceItem'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $invoiceItems = $client->invoiceItems()->search('invoiceId', [
                'filter' => 'quantity:5',
            ]);
    post:
      tags:
        - Invoices
      summary: Create an invoice item
      operationId: PostInvoiceItem
      description: |
        Create an invoice item
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceItem'
        description: InvoiceItem resource
        required: true
      responses:
        '201':
          description: InvoiceItem was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceItem'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $invoiceItemForm = new Rebilly\Entities\InvoiceItem();
            $invoiceItemForm->setType($invoiceItemForm::TYPE_DEBIT);
            $invoiceItemForm->setUnitPrice(0.99);
            $invoiceItemForm->setQuantity(5);

            try {
                $invoiceItem = $client->invoiceItems()->create($invoiceItemForm, 'invoiceId');
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/invoices/{id}/matched-rules':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Invoices
      summary: Get matched rules for the invoice
      operationId: GetInvoiceMatchedRuleCollection
      description: Get matched rules for the invoice
      responses:
        '200':
          description: List of matched rules was retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MatchedRule'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/invoices/{id}/recalculate':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Invoices
      summary: Recalculate an invoice
      operationId: PostInvoiceRecalculation
      description: >
        Recalculate an invoice with specified identifier string.

        It will recalculate shipping rates, taxes, discounts. It is useful when
        coupon was revoked or customer redeemed coupon after invoice was issued
        and you want to apply it to this invoice.
      responses:
        '201':
          description: Invoice was recalculated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  '/invoices/{id}/reissue':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Invoices
      summary: Reissue an invoice
      operationId: PostInvoiceReissuance
      description: >
        Reissue an invoice with specified identifier string. It must be issued
        (status must be `unpaid` or `past-due`).
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceReissue'
        description: InvoiceReissue resource
        required: true
      responses:
        '201':
          description: Invoice was reissued successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  '/invoices/{id}/timeline':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Invoices
      summary: Retrieve a list of invoice timeline messages
      operationId: GetInvoiceTimelineCollection
      description: |
        Retrieve a list of invoice timeline messages
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: A list of invoice timeline messages was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/InvoiceTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Invoices
      summary: Create an invoice Timeline comment
      operationId: PostInvoiceTimeline
      description: |
        Create an invoice Timeline comment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceTimeline'
        description: Invoice Timeline resource
        required: true
      responses:
        '201':
          description: Invoice Timeline comment was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/invoices/{id}/timeline/{messageId}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - name: messageId
        in: path
        description: The Invoice Timeline message ID
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Invoices
      summary: Retrieve an Invoice Timeline message
      operationId: GetInvoiceTimeline
      description: |
        Retrieve a invoice message with specified identifier string
      responses:
        '200':
          description: Invoice message was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Invoices
      summary: Delete an Invoice Timeline message
      operationId: DeleteInvoiceTimeline
      description: |
        Delete an Invoice Timeline message with predefined identifier string
      responses:
        '204':
          description: Invoice Timeline message was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  '/invoices/{id}/transaction-allocations':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Invoices
      summary: Get transaction amounts allocated to an invoice
      operationId: GetInvoiceTransactionAllocationCollection
      description: Get the precise amounts from a transaction allocated as invoice payments
      responses:
        '200':
          description: List of allocations was retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/InvoiceTransactionAllocation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/invoices/{id}/void':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Invoices
      summary: Void an invoice
      operationId: PostInvoiceVoid
      description: |
        Void an invoice with specified identifier string
      responses:
        '201':
          description: Invoice was voided successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $invoice = $client->invoices()->void('invoiceId');
  /kyc-documents:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - KYC Documents
      summary: Retrieve a list of KYC documents
      operationId: GetKycDocumentCollection
      description: |
        Retrieve a list of KYC documents
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - name: sort
          in: query
          description: >-
            The collection items sort field and order (prefix with "-" for
            descending sort).
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
              enum:
                - id
                - '-id'
                - createdTime
                - '-createdTime'
                - updatedTime
                - '-updatedTime'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
            default: application/json
      responses:
        '200':
          description: A list of KYC documents was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/KycDocument_KycDocument'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - KYC Documents
      summary: Create a KYC Document
      operationId: PostKycDocument
      description: |
        Create a KYC Document
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KycDocument_KycDocument'
        description: Kyc document resource
        required: true
      responses:
        '201':
          description: Kyc document was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KycDocument_KycDocument'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/kyc-documents/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - KYC Documents
      summary: Retrieve a KYC Document
      operationId: GetKycDocument
      description: Retrieve a KYC document with specified identifier string.
      parameters:
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
            default: application/json
      responses:
        '200':
          description: KYC document was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KycDocument_KycDocument'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - KYC Documents
      summary: Create or update a KYC document with predefined ID
      operationId: PutKycDocument
      description: Create or update a KYC document with predefined identifier string.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KycDocument_KycDocument'
        description: KYC document resource.
        required: true
      responses:
        '200':
          description: KYC document was updated.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KycDocument_KycDocument'
        '201':
          description: KYC document was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KycDocument_KycDocument'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/kyc-documents/{id}/acceptance':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - KYC Documents
      summary: Accept a KYC document
      operationId: PostKycDocumentAcceptance
      description: >
        Marks that status of the document as `accepted`. Updates the review time
        and reviewer information. Intended to be used for manual overrides.
      responses:
        '201':
          description: KYC document acceptance was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KycDocument_KycDocument'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/kyc-documents/{id}/rejection':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - KYC Documents
      summary: Reject a KYC document
      operationId: PostKycDocumentRejection
      description: >
        Marks that status of the document as `rejected`. Updates the review time
        and reviewer information. Intended to be used for manual overrides.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KycDocumentRejection'
        description: KYC document resource
        required: true
      responses:
        '201':
          description: KYC document rejection was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KycDocument_KycDocument'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/kyc-documents/{id}/review':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - KYC Documents
      summary: Review a KYC document
      operationId: PostKycDocumentReview
      description: >-
        Mark the KYC document as reviewed. Updates the review time and reviewer
        information.
      responses:
        '201':
          description: KYC document was reviewed.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KycDocument_KycDocument'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /password-tokens:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customer Authentication
      summary: Retrieve a list of tokens
      operationId: GetPasswordTokenCollection
      description: |
        Retrieve a list of tokens
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of Reset Password Tokens was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ResetPasswordToken'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Customer Authentication
      summary: Create a Reset Password Token
      operationId: PostPasswordToken
      description: |
        Create a Reset Password Token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPasswordToken'
        description: ResetPasswordToken resource
        required: true
      responses:
        '201':
          description: Reset Password Token was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResetPasswordToken'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/password-tokens/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customer Authentication
      summary: Retrieve a Reset Password Token
      operationId: GetPasswordToken
      description: |
        Retrieve a Reset Password Token with specified identifier string
      responses:
        '200':
          description: ResetPasswordToken was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResetPasswordToken'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Customer Authentication
      summary: Delete a Reset Password Token
      operationId: DeletePasswordToken
      description: |
        Delete a Reset Password Token with predefined identifier string
      responses:
        '204':
          description: ResetPasswordToken was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  /payment-cards:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Payment Cards
      summary: Retrieve a list of Payment Cards
      operationId: GetPaymentCardCollection
      description: |
        Retrieve a list of Payments Cards
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of Payment Card was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PaymentCard'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $paymentCards = $client->paymentCards()->search([
                'filter' => 'status:active',
            ]);
    post:
      tags:
        - Payment Cards
      summary: Create a Payment Card
      operationId: PostPaymentCard
      description: |
        Create a Payment Card
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/PaymentCardCreateToken'
                - $ref: '#/components/schemas/PaymentCardCreatePlain'
        description: PaymentCard resource
        required: true
      responses:
        '200':
          description: Payment Card was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentCard'
        '201':
          description: Payment Card was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentCard'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $paymentCardForm = new Rebilly\Entities\PaymentCard();
            $paymentCardForm->setCustomerId('customerId');
            $paymentCardForm->setPan('4111111111111111');
            $paymentCardForm->setExpYear(2025);
            $paymentCardForm->setExpMonth(8);
            $paymentCardForm->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 {
                $paymentCard = $client->paymentCards()->create($paymentCardForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/payment-cards/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Payment Cards
      summary: Retrieve a Payment Card
      operationId: GetPaymentCard
      description: |
        Retrieve a Payment Card with specified identifier string
      responses:
        '200':
          description: Payment card was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentCard'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $paymentCard = $client->paymentCards()->load('paymentCardId');
    patch:
      tags:
        - Payment Cards
      summary: Update a payment card's values
      operationId: PatchPaymentCard
      description: |
        Update any of the payment card's values except for the pan
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                cvv:
                  description: Card's cvv (card verification value).
                  type: string
                expMonth:
                  description: Card's expiry month
                  type: integer
                expYear:
                  description: Card's expiry year
                  type: integer
                billingAddress:
                  description: Card's billing address
                  allOf:
                    - $ref: '#/components/schemas/ContactObject'
                stickyGatewayAccountId:
                  description: Sticky Gateway Account ID
                  allOf:
                    - $ref: '#/components/schemas/ResourceId'
                customFields:
                  $ref: '#/components/schemas/ResourceCustomFields'
        description: Payment card
      responses:
        '200':
          description: Payment card was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentCard'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
    put:
      tags:
        - Payment Cards
      summary: Create a payment card with predefined ID
      operationId: PutPaymentCard
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/PaymentCardCreateToken'
                - $ref: '#/components/schemas/PaymentCardCreatePlain'
        description: Payment card
      responses:
        '200':
          description: Payment card was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentCard'
        '201':
          description: Payment card was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentCard'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: Payment card already exists and cannot be updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $paymentCardForm = new Rebilly\Entities\PaymentCard();
            $paymentCardForm->setCustomerId('customerId');
            $paymentCardForm->setPan('4111111111111111');
            $paymentCardForm->setExpYear(2025);
            $paymentCardForm->setExpMonth(8);
            $paymentCardForm->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 {
                $paymentCard = $client->paymentCards()->create($paymentCardForm, 'paymentCardId');
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/payment-cards/{id}/authorization':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Payment Cards
      summary: Authorize a Payment Card
      operationId: PostPaymentCardAuthorization
      description: |
        Authorize a Payment Card

        Instead of using this endpoint a Payment Card will
        be authorized on first usage (new transaction or order).
      deprecated: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - websiteId
                - currency
              properties:
                websiteId:
                  description: The Website ID
                  type: string
                currency:
                  allOf:
                    - $ref: '#/components/schemas/CurrencyCode'
                gatewayAccountId:
                  description: The Gateway account ID
                  type: string
                amount:
                  description: Amount
                  type: number
                  format: double
                redirectUrl:
                  description: Redirect URL
                  type: string
        description: Payment Card resource
        required: true
      responses:
        '201':
          description: Payment Card was authorized
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentCard'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: >
            $paymentCardAuthorizationForm = new
            Rebilly\Entities\PaymentCardAuthorization();

            $paymentCardAuthorizationForm->setWebsiteId('websiteId');

            $paymentCardAuthorizationForm->setCurrency('USD');

            $paymentCardAuthorizationForm->setGatewayAccountId('gatewayAccountId');


            try {
                $paymentCard = $client->paymentCards()->authorize('paymentCardId', $paymentCardAuthorizationForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/payment-cards/{id}/deactivation':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Payment Cards
      summary: Deactivate a Payment Card
      operationId: PostPaymentCardDeactivation
      description: |
        Deactivate a Payment Card
      responses:
        '201':
          description: Payment Card was deactivated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentCard'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
      x-code-samples:
        - lang: PHP
          source: |
            $client->paymentCards()->deactivate('paymentCardId');
  '/payment-cards/{id}/matched-rules':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Payment Cards
      summary: Get matched rules for the payment card
      operationId: GetPaymentCardMatchedRuleCollection
      description: Get matched rules for the payment card
      responses:
        '200':
          description: List of matched rules was retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MatchedRule'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /payment-instrument-validation:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Payment Instrument Validation
      summary: Retrieve a Payment Instrument validation
      operationId: GetPaymentInstrumentValidationCollection
      description: >
        Retrieve a Payment Instrument validation with specified identifier
        string
      responses:
        '200':
          description: Successfully retrieved a payment instrument validation
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PaymentInstrumentValidation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Payment Instrument Validation
      summary: Validate a payment instrument
      operationId: PostPaymentInstrumentValidation
      description: |
        Validate a payment instrument
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - method
                - paymentInstrumentId
              properties:
                method:
                  description: Payment method
                  type: string
                paymentInstrumentId:
                  description: Payment instrument ID
                  type: string
        description: Payment instrument
      responses:
        '201':
          description: Validation successful
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentInstrumentValidation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/payment-instrument-validation/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Payment Instrument Validation
      summary: Retrieve a list of validated payment instruments
      operationId: GetPaymentInstrumentValidation
      description: |
        Retrieve a list of validated payment instruments
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of validated payment instrument was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentInstrumentValidation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /paypal-accounts:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - PayPal Accounts
      summary: Retrieve a list of PayPal accounts
      operationId: GetPayPalAccountCollection
      description: |
        Retrieve a list of PayPal Accounts
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of PayPal Accounts was retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PayPalAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $payPalAccounts = $client->payPalAccounts()->search([
                'filter' => 'status:active',
            ]);
    post:
      tags:
        - PayPal Accounts
      summary: Create a PayPal Account
      operationId: PostPayPalAccount
      description: |
        Create a PayPal Account
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayPalAccount'
        description: PayPalAccount resource
        required: true
      responses:
        '201':
          description: PayPal Account was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayPalAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $payPalForm = new Rebilly\Entities\PayPalAccount();
            $payPalForm->setCustomerId('customerId');
            $payPalForm->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 {
                $payPalAccount = $client->payPalAccounts()->create($payPalForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/paypal-accounts/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - PayPal Accounts
      summary: Retrieve a PayPal Account
      operationId: GetPayPalAccount
      description: |
        Retrieve a PayPal Account with specified identifier string
      responses:
        '200':
          description: PayPal Account was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayPalAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $payPalAccount = $client->payPalAccounts()->load('payPalAccountId');
    put:
      tags:
        - PayPal Accounts
      summary: Create a PayPal account with predefined ID
      operationId: PutPayPalAccount
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayPalAccount'
        description: PayPal Account
        required: true
      responses:
        '201':
          description: PayPal Account was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayPalAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: PayPal Account exist and cannot be updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $payPalForm = new Rebilly\Entities\PayPalAccount();
            $payPalForm->setCustomerId('customerId');
            $payPalForm->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 {
                $payPalAccount = $client->payPalAccounts()->create($payPalForm, 'payPalAccountId');
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/paypal-accounts/{id}/activation':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - PayPal Accounts
      summary: Activate a PayPal Account
      operationId: PostPayPalAccountActivation
      description: |
        Activate a PayPal Account

        Instead of using this endpoint a PayPal Account will
        be authorized on first usage (new transaction or order).
      deprecated: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayPalAccountAuthorization'
        description: PayPal Account resource
        required: true
      responses:
        '201':
          description: PayPal Account was activated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayPalAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $activationData = [
                'websiteId' => 'testWebsiteId',
                'currency' => 'USD',
            ];

            try {
                $client->payPalAccounts()->activate($activationData, 'payPalAccountId');
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/paypal-accounts/{id}/deactivation':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - PayPal Accounts
      summary: Deactivate a PayPal Account
      operationId: PostPayPalAccountDeactivation
      description: |
        Deactivate a PayPal Account
      responses:
        '201':
          description: PayPal Account was deactivated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayPalAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
      x-code-samples:
        - lang: PHP
          source: |
            $client->payPalAccounts()->deactivate('payPalAccountId');
  /plans:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Plans
      summary: Retrieve a list of plans
      operationId: GetPlanCollection
      description: |
        Retrieve a list of plans
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of Plans was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Plans_Plan'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $plans = $client->plans()->search([
                'filter' => 'name:TestPlan',
            ]);
    post:
      tags:
        - Plans
      summary: Create a plan
      operationId: PostPlan
      description: |
        Create a plan
      requestBody:
        $ref: '#/components/requestBodies/Plan'
      responses:
        '201':
          description: Plan was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plans_Plan'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $planForm = new Rebilly\Entities\Plan();
            $planForm->setName('TestPlan');
            $planForm->setCurrency('USD');
            $planForm->setTrialAmount(1);
            $planForm->setTrialPeriodUnit('day');
            $planForm->setTrialPeriodLength(1);
            $planForm->setProductId('test-product');

            try {
                $plan = $client->plans()->create($planForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/plans/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Plans
      summary: Retrieve a plan
      operationId: GetPlan
      description: |
        Retrieve a plan with specified identifier string
      responses:
        '200':
          description: Plan was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plans_Plan'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $plan = $client->plans()->load('planId');
    put:
      tags:
        - Plans
      summary: Create or update a Plan with predefined ID
      operationId: PutPlan
      description: |
        Create or update a Plan with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/Plan'
      responses:
        '200':
          description: Plan was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plans_Plan'
        '201':
          description: Plan was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plans_Plan'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $planForm = new Rebilly\Entities\Plan();
            $planForm->setName('TestPlan');
            $planForm->setCurrency('USD');
            $planForm->setTrialAmount(1);
            $planForm->setTrialPeriodUnit('day');
            $planForm->setTrialPeriodLength(1);

            try {
                $plan = $client->plans()->update('planId', $planForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Plans
      summary: Delete a Plan
      operationId: DeletePlan
      description: |
        Delete a Plan with predefined identifier string
      responses:
        '204':
          description: Plan was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
      x-code-samples:
        - lang: PHP
          source: |
            $client->plans()->delete('planId');
  /products:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Products
      summary: Retrieve a list of products
      operationId: GetProductCollection
      description: |
        Retrieve a list of products
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of products was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/schemas_Product'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Products
      summary: Create a Product
      operationId: PostProduct
      description: |
        Create a Product
      requestBody:
        $ref: '#/components/requestBodies/Product'
      responses:
        '201':
          description: Product was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schemas_Product'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/products/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Products
      summary: Retrieve a product
      operationId: GetProduct
      description: |
        Retrieve a product with specified identifier string
      responses:
        '200':
          description: Product was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schemas_Product'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Products
      summary: Create a product with predefined ID
      operationId: PutProduct
      description: |
        Create a product with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/Product'
      responses:
        '200':
          description: Product was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schemas_Product'
        '201':
          description: Product was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schemas_Product'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
    delete:
      tags:
        - Products
      summary: Delete a product
      operationId: DeleteProduct
      description: |
        Delete a product with predefined identifier string
      responses:
        '204':
          description: Product was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /search:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Search
      summary: Search merchant data
      operationId: GetSearch
      description: >
        Search merchant's data to return resources such as customers, invoices,
        orders, transactions
      parameters:
        - name: q
          in: query
          description: >
            The default or "global" search. It will search all searchable
            resources across as many fields as possible.
          schema:
            type: string
        - name: filter
          in: query
          description: >
            The collection items filter requires a special format.

            Use "," for multiple allowed values.  Use ";" for multiple fields.

            Use one or more of the listed filter fields. i.e. `is:customer
            email:bob@test.com`.

            The `date` value can be surrounded with quotes. Examples:

            `>2019-01-01`, `last month`, `yesterday`, `<=2019-04-30`.
          schema:
            type: string
            enum:
              - is
              - amount
              - bin
              - coupon
              - currency
              - date
              - email
              - last4
              - name
              - paypalUsername
              - plan
              - product
              - tag
      responses:
        '200':
          description: Results keyed by resource
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Search'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /shipping-zones:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Shipping Zones
      summary: Retrieve a list of shipping zones
      operationId: GetShippingZoneCollection
      description: |
        Retrieve a list of shipping zones
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of shipping zones was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ShippingZone'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Shipping Zones
      summary: Create a Shipping Zone
      operationId: PostShippingZone
      description: |
        Create a Shipping Zone
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShippingZone'
        description: Shipping Zone resource
        required: true
      responses:
        '201':
          description: Shipping Zone was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShippingZone'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/shipping-zones/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Shipping Zones
      summary: Retrieve a shipping zone
      operationId: GetShippingZone
      description: |
        Retrieve a shipping zone with specified identifier string
      responses:
        '200':
          description: Shipping zone was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShippingZone'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Shipping Zones
      summary: Create a shipping zone with predefined ID
      operationId: PutShippingZone
      description: |
        Create a shipping zone with predefined identifier string
      responses:
        '200':
          description: Shipping zone was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShippingZone'
        '201':
          description: Shipping zone was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShippingZone'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShippingZone'
        description: Shipping zone resource
        required: true
    delete:
      tags:
        - Shipping Zones
      summary: Delete a shipping zone
      operationId: DeleteShippingZone
      description: |
        Delete a shipping zone with predefined identifier string
      responses:
        '204':
          description: Shipping zone was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /subscription-cancellations:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Retrieve a list of cancellations
      operationId: GetSubscriptionCancellationCollection
      description: Retrieve a list of cancellations for all subscriptions
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of cancellations was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SubscriptionCancellation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Subscriptions
      summary: Cancel a subscription
      operationId: PostSubscriptionCancellation
      description: Cancel a subscription or preview the cancellation parameters before that
      requestBody:
        $ref: '#/components/requestBodies/SubscriptionCancellation'
      responses:
        '201':
          description: 'Cancellation was created, subscription is or will be deactivated'
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionCancellation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $subscriptionCancelForm = new Rebilly\Entities\SubscriptionCancel();
            $subscriptionCancelForm->setEffectiveTime(new DateTime());

            try {
                $subscription = $client->subscriptions()->cancel('subscriptionId', $subscriptionCancelForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/subscription-cancellations/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Retrieve a subscription сancellation
      operationId: GetSubscriptionCancellation
      description: Retrieve a subscription сancellation with specified identifier string
      responses:
        '200':
          description: Cancellation was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionCancellation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Subscriptions
      summary: Cancel a subscription
      operationId: PutSubscriptionCancellation
      description: Cancel a subscription
      requestBody:
        $ref: '#/components/requestBodies/SubscriptionCancellation'
      responses:
        '200':
          description: 'Cancellation was updated, subscription is or will be deactivated'
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionCancellation'
        '201':
          description: 'Cancellation was created, subscription is or will be deactivated'
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionCancellation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
    delete:
      tags:
        - Subscriptions
      summary: Delete a cancellation
      operationId: DeleteSubscriptionCancellation
      description: Delete a subscription's cancellation. Only draft can be deleted.
      responses:
        '204':
          description: Cancellaton was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  /subscription-reactivations:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Retrieve a list of reactivations
      operationId: GetSubscriptionReactivationCollection
      description: Retrieve a list of reactivations for all subscriptions
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of reactivations was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SubscriptionReactivation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Subscriptions
      summary: Reactivate a subscription
      operationId: PostSubscriptionReactivation
      description: Reactivate a subscription
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionReactivation'
        description: Reactivation resource
        required: true
      responses:
        '201':
          description: >
            Reactivation was created, subscription is active and won't be
            deactivated.

            If there was a cancellation with status "confirmed", it is revoked.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionReactivation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/subscription-reactivations/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Retrieve a subscription reactivation
      operationId: GetSubscriptionReactivation
      description: Retrieve a subscription reactivation with specified identifier string
      responses:
        '200':
          description: Reactivation was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionReactivation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /subscriptions:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Retrieve a list of subscriptions
      operationId: GetSubscriptionCollection
      description: |
        Retrieve a list of subscriptions
      parameters:
        - $ref: '#/components/parameters/subscriptionExpand'
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
              - text/csv
            default: application/json
      responses:
        '200':
          description: A list of subscriptions was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Subscription'
            text/csv:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Subscription'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $subscriptions = $client->subscriptions()->search([
                'filter' => 'customerId:testCustomerId',
            ]);
    post:
      tags:
        - Subscriptions
      summary: Create a subscription
      operationId: PostSubscription
      description: |
        Create a subscription. Consider using the upsert
        operation to accomplish this task.
      parameters:
        - $ref: '#/components/parameters/subscriptionExpand'
      requestBody:
        $ref: '#/components/requestBodies/Subscription'
      responses:
        '201':
          description: Subscription was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $subscriptionForm = new Rebilly\Entities\Subscription();
            $subscriptionForm->setCustomerId('customerId');
            $subscriptionForm->setWebsiteId('websiteId');
            $subscriptionForm->setItems([
                [
                    'planId' => 'my-plan',
                    'quantity' => 1,
                ],
            ]);
            $subscriptionForm->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 {
                $subscription = $client->subscriptions()->create($subscriptionForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/subscriptions/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Retrieve a subscription
      operationId: GetSubscription
      parameters:
        - $ref: '#/components/parameters/subscriptionExpand'
      description: |
        Retrieve a subscription with specified identifier string
      responses:
        '200':
          description: Subscription was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $subscription = $client->subscriptions()->load('subscriptionId');
    put:
      tags:
        - Subscriptions
      summary: Upsert a subscription with predefined ID
      operationId: PutSubscription
      description: |
        Create or update a subscription with predefined identifier string
      parameters:
        - $ref: '#/components/parameters/subscriptionExpand'
      requestBody:
        $ref: '#/components/requestBodies/Subscription'
      responses:
        '200':
          description: Subscription was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        '201':
          description: Subscription was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $subscriptionForm = new Rebilly\Entities\Subscription();
            $subscriptionForm->setCustomerId('customerId');
            $subscriptionForm->setWebsiteId('websiteId');
            $subscriptionForm->setItems($subscriptionForm->createItems([
                'planId' => 'my-plan',
                'quantity' => 1,
            ]));
            $subscriptionForm->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 {
                $subscription = $client->subscriptions()->update('subscriptionId', $subscriptionForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/subscriptions/{id}/change-plan':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Subscriptions
      summary: Change a subscription's plan
      operationId: PostSubscriptionPlanChange
      description: >
        Change a subscription's plan and designate when and if there should be
        pro rata credits given.

        Only active subscriptions with a single plan can be changed.

        Edit pending unpaid subscriptions directly regardless the number of
        plans.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionChange'
        description: Change the plan
        required: true
      responses:
        '201':
          description: Subscription was changed
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: >
            $subscriptionChangePlanForm = new
            Rebilly\Entities\SubscriptionChangePlan();

            $subscriptionChangePlanForm->setPlanId('newPlanId');

            $subscriptionChangePlanForm->setRenewalPolicy('retain');

            $subscriptionChangePlanForm->setPreview(true);

            $subscriptionChangePlanForm->setProrated(true);

            $subscriptionChangePlanForm->setEffectiveTime('2018-02-02
            00:00:00');


            try {
                $subscription = $client->subscriptions()->changePlan('subscriptionId', $subscriptionChangePlanForm);
                echo $subscription->getLineItemSubtotal();
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/subscriptions/{id}/interim-invoice':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Subscriptions
      summary: Issue an interim invoice for a subscription
      operationId: PostSubscriptionInterimInvoice
      description: >
        Issue an interim invoice for a subscription, typically used in
        conjunction with plan changes and pro rata adjustments.

        This process creates an invoice, adds the subscription's line items to
        the invoice, and issues the invoice, and applies

        payment to it if a transaction id is supplied.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionInvoice'
        description: Issue an interim invoice
        required: true
      responses:
        '201':
          description: Invoice was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/subscriptions/{id}/matched-rules':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Get matched rules for the subscription
      operationId: GetSubscriptionMatchedRuleCollection
      description: Get matched rules for the subscription
      responses:
        '200':
          description: List of matched rules was retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MatchedRule'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/subscriptions/{id}/timeline':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Retrieve a list of order timeline messages
      operationId: GetSubscriptionTimelineCollection
      description: |
        Retrieve a list of order timeline messages
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: A list of order timeline messages was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrderTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      tags:
        - Subscriptions
      summary: Create an order Timeline comment
      operationId: PostSubscriptionTimeline
      description: |
        Create an order Timeline comment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderTimeline'
        description: Order Timeline resource
        required: true
      responses:
        '201':
          description: Order Timeline comment was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/subscriptions/{id}/timeline/{messageId}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - name: messageId
        in: path
        description: The Order Timeline message ID
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Retrieve an Order Timeline message
      operationId: GetSubscriptionTimeline
      description: |
        Retrieve a order message with specified identifier string
      responses:
        '200':
          description: Order message was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Subscriptions
      summary: Delete an Order Timeline message
      operationId: DeleteSubscriptionTimeline
      description: |
        Delete an Order Timeline message with predefined identifier string
      responses:
        '204':
          description: Order Timeline message was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  '/subscriptions/{id}/upcoming-invoices':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Invoices
      summary: Retrieve subscription's upcoming invoice
      operationId: GetSubscriptionUpcomingInvoiceCollection
      description: >
        Retrieve an upcoming invoice from the specified subscription.

        The endpoint is temporary before upcoming invoices get a complete
        integration.
      parameters:
        - $ref: '#/components/parameters/collectionExpand'
      responses:
        '200':
          description: Upcoming invoices are retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/subscriptions/{id}/upcoming-invoices/{invoiceId}/issue':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - name: invoiceId
        in: path
        description: The Upcoming Invoice ID
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Subscriptions
      summary: Issue an upcoming invoice for early pay
      operationId: PostUpcomingInvoiceIssuance
      description: >
        Issue an upcoming invoice with specified identifier string for early
        pay.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceIssue'
        description: InvoiceIssue resource
        required: true
      responses:
        '201':
          description: Upcoming Invoice was issued successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoices_Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  /tags:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Tags
      summary: Retrieve a list of tags
      operationId: GetTagCollection
      description: |
        Retrieve a list of tags
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionQuery'
        - name: sort
          in: query
          description: >-
            The collection items sort field and order (prefix with "-" for
            descending sort).
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
              enum:
                - id
                - '-id'
                - name
                - '-name'
                - createdTime
                - '-createdTime'
                - updatedTime
                - '-updatedTime'
      responses:
        '200':
          description: A list of tags was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Tag'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Tags
      summary: Create a tag
      operationId: PostTag
      description: |
        Create a tag
      requestBody:
        $ref: '#/components/requestBodies/Tag'
      responses:
        '201':
          description: Tag was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tag'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/tags/{tag}':
    parameters:
      - $ref: '#/components/parameters/tag'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Tags
      summary: Retrieve a tag
      operationId: GetTag
      description: |
        Retrieve a tag
      responses:
        '200':
          description: Tag with specified name was retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tag'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      tags:
        - Tags
      summary: Update a tag
      operationId: PatchTag
      description: |
        Update a tag
      requestBody:
        $ref: '#/components/requestBodies/Tag'
      responses:
        '200':
          description: Tag was updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tag'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
    delete:
      tags:
        - Tags
      summary: Delete a tag
      operationId: DeleteTag
      description: |
        Delete a tag.
        It's an asynchronous operation.
      responses:
        '204':
          description: Tag was deleted
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/tags/{tag}/customers':
    parameters:
      - $ref: '#/components/parameters/tag'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Tags
      summary: Tag a list of customers
      operationId: PostTagCustomerCollection
      description: |
        Tag a list of customers.
        If the customer from the list is already tagged it will be ignored.
        It's an asynchronous operation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - customerIds
              properties:
                customerIds:
                  description: The list of customer IDs
                  type: array
                  minItems: 1
                  maxItems: 1000
                  items:
                    type: string
      responses:
        '204':
          description: Customers was tagged
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
    delete:
      tags:
        - Tags
      summary: Untag a list of customers
      operationId: DeleteTagCustomerCollection
      description: |
        Untag a list of customers.
        If the customer from the list is already untagged it will be ignored.
        It's an asynchronous operation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - customerIds
              properties:
                customerIds:
                  description: The list of customer IDs
                  type: array
                  minItems: 1
                  maxItems: 1000
                  items:
                    type: string
      responses:
        '204':
          description: Customers was untagged
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/tags/{tag}/customers/{customerId}':
    parameters:
      - $ref: '#/components/parameters/tag'
      - $ref: '#/components/parameters/customerId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Tags
      summary: Tag a customer
      operationId: PostTagCustomer
      description: |
        Tag a customer
      responses:
        '204':
          description: Customer was tagged
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Tags
      summary: Untag a customer
      operationId: DeleteTagCustomer
      description: |
        Untag a customer
      responses:
        '204':
          description: Customer was untagged
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /tokens:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Payment Tokens
      summary: Create a payment token
      operationId: PostToken
      description: |
        [FramePay](https://docs.rebilly.com/docs/developer-docs/framepay/)
        is the recommended way to
        create a payment token because it minimizes
        PCI DSS compliance.  Once a payment token
        is created, it can only be used once.

        A payment token expires upon first use
        or within 30 minutes of the token creation
        (whichever comes first).
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/PaymentCardToken'
                - $ref: '#/components/schemas/BankAccountToken'
                - $ref: '#/components/schemas/PaymentToken'
        description: PaymentToken resource
        required: true
      security:
        - PublishableApiKey: []
        - SecretApiKey: []
        - JWT: []
      responses:
        '201':
          description: Token was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/PaymentCardToken'
                  - $ref: '#/components/schemas/BankAccountToken'
                  - $ref: '#/components/schemas/PaymentToken'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: >
            $paymentCardTokenForm = new Rebilly\Entities\PaymentCardToken();

            $paymentCardTokenForm->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',
                    ],
                ],
            ]);


            $paymentInstrumentForm = new
            Entities\PaymentInstruments\PaymentCardPaymentInstrument();

            $paymentInstrumentForm->setPan('4111111111111111');

            $paymentInstrumentForm->setExpYear(2025);

            $paymentInstrumentForm->setExpMonth(8);

            $paymentInstrumentForm->setCvv(123);


            $paymentCardTokenForm->setPaymentInstrument($paymentInstrumentForm);


            try {
                $paymentCardToken = $client->paymentCardTokens()->create($paymentCardTokenForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    get:
      tags:
        - Payment Tokens
      summary: Retrieve a list of tokens
      operationId: GetTokenCollection
      description: |
        Retrieve a list of tokens
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of tokens was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PaymentToken'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $paymentCardTokens = $client->paymentCardTokens()->search([
                'filter' => 'token:string',
            ]);
  '/tokens/{token}':
    parameters:
      - name: token
        in: path
        description: The token identifier string
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Payment Tokens
      summary: Retrieve a token
      operationId: GetToken
      description: |
        Retrieve a token with specified identifier string
      security:
        - PublishableApiKey: []
      responses:
        '200':
          description: Token was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentToken'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $paymentCardToken = $client->paymentCardTokens()->load('tokenId');
  /transactions:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Transactions
      summary: Create a transaction
      operationId: PostTransaction
      description: |
        Create a transactions of type `sale`, `authorize`, or `credit`.
        This endpoint supports two main styles of transactions:
          1. A real-time decision and response.
          2. User approval/interaction is required.

        A real-time decision is very familiar.  You send a request, and
        inspect the `result` of the response for `approved` or `declined`.

        However, many transactions, especially those for alternative
        methods, require the user to interact with a 3rd party.  You
        may be able to envision PayPal, for example, the user must
        give permission to complete the payment (or accept the
        billing agreement).

        Even payment cards may require user approval in the case of
        3D secure authentication.  In the event that approval is
        required, you will receive a response back and notice
        that the `result` is `unknown`.  You will find that the
        `status` is `waiting-approval`. And you will find in the
        `_links` section of the response a link for the `approvalUrl`.

        In this case you would either open the `approvalUrl` in an
        iframe or in a pop (better workflow for mobile).
      requestBody:
        $ref: '#/components/requestBodies/TransactionRequest'
      responses:
        '201':
          description: Transaction was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transactions_Transaction'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
    get:
      tags:
        - Transactions
      summary: Retrieve a list of transactions
      operationId: GetTransactionCollection
      description: |
        Retrieve a list of transactions
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionQuery'
        - $ref: '#/components/parameters/collectionSort'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
              - text/csv
            default: application/json
      responses:
        '200':
          description: A list of transactions was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Transactions_Transaction'
            text/csv:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Transactions_Transaction'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $transactions = $client->transactions()->search([
                'filter' => 'result:approved',
            ]);
  '/transactions/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Transactions
      summary: Retrieve a Transaction
      operationId: GetTransaction
      description: |
        Retrieve a Transaction with specified identifier string
      responses:
        '200':
          description: Transaction was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transactions_Transaction'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $transaction = $client->transactions()->load('transactionId');
  '/transactions/{id}/cancel':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Transactions
      summary: Cancel a pending or suspended transaction
      operationId: PostTransactionCancellation
      description: >-
        Cancel a scheduled transaction. Once handled a transaction cannot be
        canceled
      responses:
        '201':
          description: Successful cancel the payment
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transactions_Transaction'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            try {
                $payment = $client->transactions()->cancel('transactionId');
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/transactions/{id}/gateway-logs':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Transactions
      summary: Retrieve a Transaction Gateway Logs
      operationId: GetTransactionGatewayLogCollection
      description: >-
        Retrieve Gateway communication Logs for Transaction with specified
        identifier string
      responses:
        '200':
          description: Logs were retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionGatewayLog'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/transactions/{id}/matched-rules':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Transactions
      summary: Get matched rules for the transaction
      operationId: GetTransactionMatchedRuleCollection
      description: Get matched rules for the transaction
      responses:
        '200':
          description: List of matched rules was retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MatchedRule'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/transactions/{id}/refund':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Transactions
      summary: Refund a Transaction
      operationId: PostTransactionRefund
      description: >
        Refund a Transaction with specified identifier string.

        Note that the refund will be in the same currency as the original
        transaction.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionRefund'
        description: Transaction resource
        required: true
      responses:
        '201':
          description: Transaction was refunded successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transactions_Transaction'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: >
            $transaction = $client->transactions()->refund('transactionId',
            1.99);
  '/transactions/{id}/timeline':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Transactions
      summary: Retrieve a list of transaction timeline messages
      operationId: GetTransactionTimelineCollection
      description: |
        Retrieve a list of transaction timeline messages
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: A list of transaction timeline messages was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TransactionTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Transactions
      summary: Create a transaction Timeline comment
      operationId: PostTransactionTimeline
      description: |
        Create a transaction Timeline comment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionTimeline'
        description: Transaction Timeline resource
        required: true
      responses:
        '201':
          description: Transaction Timeline comment was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/transactions/{id}/timeline/{messageId}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - name: messageId
        in: path
        description: The Transaction Timeline message ID
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Transactions
      summary: Retrieve a transaction Timeline message
      operationId: GetTransactionTimeline
      description: |
        Retrieve a timeline message with specified identifier string
      responses:
        '200':
          description: Timeline message was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Transactions
      summary: Delete a Transaction Timeline message
      operationId: DeleteTransactionTimeline
      description: |
        Delete a Transaction Timeline message with predefined identifier string
      responses:
        '204':
          description: Transaction Timeline message was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  '/activation/{token}':
    parameters:
      - name: token
        in: path
        description: The token string
        required: true
        schema:
          type: string
    post:
      tags:
        - Profile
      summary: Activate
      operationId: PostActivation
      description: |
        Sends a token to activate user account
      security: []
      responses:
        '204':
          description: User account was activated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '422':
          description: Invalid token was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: |
            try {
                $client->users()->activate('token');
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  /api-keys:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - API Keys
      summary: Retrieve a list of api keys
      operationId: GetApiKeyCollection
      description: |
        Retrieve a list of api keys
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of api keys was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $apiKeys = $client->apiKeys()->search([
                'filter' => 'description:Test',
            ]);
    post:
      tags:
        - API Keys
      summary: Create an api key
      operationId: PostApiKey
      description: |
        Create an api key
      requestBody:
        $ref: '#/components/requestBodies/ApiKey'
      responses:
        '201':
          description: Api Key was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: |
            $apiKeyForm = new Rebilly\Entities\ApiKey();
            $apiKeyForm->setDescription('Test');
            $apiKeyForm->setDatetimeFormat($apiKeyForm::DATETIME_FORMAT_MYSQL);

            try {
                $apiKey = $client->apiKeys()->create($apiKeyForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/api-keys/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - API Keys
      summary: Retrieve api key
      operationId: GetApiKey
      description: |
        Retrieve api key with specified identifier string
      responses:
        '200':
          description: Api key was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $apiKeys = $client->apiKeys()->load('apiKeyID');
    put:
      tags:
        - API Keys
      summary: Create or update api key with predefined ID
      operationId: PutApiKey
      description: |
        Create or update api key with predefined identifier string
      responses:
        '200':
          description: ApiKey was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKey'
        '201':
          description: ApiKey was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        $ref: '#/components/requestBodies/ApiKey'
      x-code-samples:
        - lang: PHP
          source: |
            $apiKeyForm = new Rebilly\Entities\ApiKey();
            $apiKeyForm->setDescription('TestPut');
            $apiKeyForm->setDatetimeFormat($apiKeyForm::DATETIME_FORMAT_MYSQL);

            try {
                $apiKey = $client->apiKeys()->update('apiKeyID', $apiKeyForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - API Keys
      summary: Delete api key
      operationId: DeleteApiKey
      description: |
        Delete api key with predefined identifier string
      responses:
        '204':
          description: ApiKey was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: ApiKey has related resources and cannot be deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-code-samples:
        - lang: PHP
          source: |
            $client->apiKeys()->delete('apiKeyID');
  /broadcast-messages:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Broadcast Messages
      summary: Retrieve a list of broadcast messages
      operationId: GetBroadcastMessageCollection
      description: |
        Retrieve a list of broadcast messages
      responses:
        '200':
          description: A list of broadcast messages was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BroadcastMessage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Broadcast Messages
      summary: Create a broadcast message
      operationId: PostBroadcastMessage
      description: |
        Create a broadcast message
      responses:
        '201':
          description: Broadcast message was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BroadcastMessage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BroadcastMessage'
        description: Broadcast message resource
        required: true
  '/broadcast-messages/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Broadcast Messages
      summary: Retrieve a broadcast message
      operationId: GetBroadcastMessage
      description: |
        Retrieve a broadcast message
      responses:
        '200':
          description: >-
            Broadcast message with specified identifier was retrieved
            successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BroadcastMessage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Broadcast Messages
      summary: Delete a broadcast message
      operationId: DeleteBroadcastMessage
      description: |
        Delete a broadcast message
      responses:
        '204':
          description: Broadcast message was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
    patch:
      tags:
        - Broadcast Messages
      summary: Update a broadcast message
      operationId: PatchBroadcastMessage
      description: |
        Update a broadcast message
      responses:
        '200':
          description: Broadcast message was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BroadcastMessage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BroadcastMessage'
        description: Broadcast message resource
        required: true
  /checkout-pages:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Checkout Pages
      summary: Browse a list of checkout pages
      operationId: GetCheckoutPageCollection
      description: |
        Browse a list of checkout pages
      responses:
        '200':
          description: A list of checkout pages was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CheckoutPage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $checkoutPages = $client->checkoutPages()->search([
                'filter' => 'name:testCheckoutPage',
            ]);
    post:
      tags:
        - Checkout Pages
      summary: Add a Checkout Page
      operationId: PostCheckoutPage
      description: |
        Add a Checkout Page
      responses:
        '201':
          description: Checkout Page was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutPage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      requestBody:
        $ref: '#/components/requestBodies/CheckoutPage'
      x-code-samples:
        - lang: PHP
          source: |
            $checkoutPageForm = new Rebilly\Entities\CheckoutPage();
            $checkoutPageForm->setPlanId('planId');
            $checkoutPageForm->setWebsiteId('websiteId');
            $checkoutPageForm->setName('TestCheckoutPage');
            $checkoutPageForm->setUrlPathSegment('test-checkout-page');

            try {
                $checkoutPage = $client->checkoutPages()->create($checkoutPageForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/checkout-pages/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Checkout Pages
      summary: Read a Checkout Page
      operationId: GetCheckoutPage
      description: |
        Retrieve a Checkout Page with specified identifier string
      responses:
        '200':
          description: Checkout Page was retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutPage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $checkoutPage = $client->checkoutPages()->load('checkoutPageId');
    put:
      tags:
        - Checkout Pages
      summary: Edit a Checkout Page
      operationId: PutCheckoutPage
      description: |
        Create or update a Checkout Page with predefined identifier string
      responses:
        '200':
          description: Checkout Page was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutPage'
        '201':
          description: Checkout Page was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutPage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      requestBody:
        $ref: '#/components/requestBodies/CheckoutPage'
      x-code-samples:
        - lang: PHP
          source: |
            $checkoutPageForm = new Rebilly\Entities\CheckoutPage();
            $checkoutPageForm->setPlanId('planId');
            $checkoutPageForm->setWebsiteId('websiteId');
            $checkoutPageForm->setName('TestCheckoutPage');
            $checkoutPageForm->setUrlPathSegment('test-checkout-page');

            try {
                $checkoutPage = $client->checkoutPages()->update('checkoutPageId', $checkoutPageForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Checkout Pages
      summary: Delete a Checkout Page
      operationId: DeleteCheckoutPage
      description: |
        Delete a Checkout Page with predefined identifier string
      responses:
        '204':
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          description: Checkout Page was deleted
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Checkout page cannot be deleted
      x-code-samples:
        - lang: PHP
          source: |
            $client->checkoutPages()->delete('checkoutPageId');
  /credential-hashes/aws-ses:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Email Credentials
      summary: Create an AWS SES credential
      operationId: PostAwsSesCredentialHash
      description: |
        Create an AWS SES credential
      responses:
        '201':
          description: AWS SES credential was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SESCredential'
        '303':
          description: An existent AWS SES credential was retrieved
          headers:
            Location:
              description: The location of the related resource
              schema:
                type: string
                format: url
            Rate-Limit-Limit:
              description: The number of allowed requests in the current period
              schema:
                type: integer
            Rate-Limit-Remaining:
              description: The number of remaining requests in the current period
              schema:
                type: integer
            Rate-Limit-Reset:
              description: >
                The date in format defined by [RFC
                822](https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1)
                when the current period will reset
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SESCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SESCredential'
        description: AWS SES credential resource
        required: true
  '/credential-hashes/aws-ses/{hash}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/hash'
    get:
      tags:
        - Email Credentials
      summary: Retrieve an AWS SES credential
      operationId: GetAwsSesCredentialHash
      description: |
        Retrieve an AWS SES credential with specified token identifier string
      responses:
        '200':
          description: AWS SES credential was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SESCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      tags:
        - Email Credentials
      summary: Update an AWS SES credential
      operationId: PatchAwsSesCredentialHash
      description: |
        Update an AWS SES credential with specified token identifier string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchCredential'
        description: AWS SES credential resource
        required: true
      responses:
        '200':
          description: AWS SES credential was updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SESCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /credential-hashes/emails:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Email Credentials
      summary: Create an email credential
      operationId: PostEmailCredentialHash
      description: |
        Create an email credential
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SmtpCredential'
        description: SMTP credential resource
        required: true
      responses:
        '201':
          description: SMTP credential was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmtpCredential'
        '303':
          description: An existent SMTP credential was retrieved
          headers:
            Location:
              description: The location of the related resource
              schema:
                type: string
                format: url
            Rate-Limit-Limit:
              description: The number of allowed requests in the current period
              schema:
                type: integer
            Rate-Limit-Remaining:
              description: The number of remaining requests in the current period
              schema:
                type: integer
            Rate-Limit-Reset:
              description: >
                The date in format defined by [RFC
                822](https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1)
                when the current period will reset
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmtpCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/credential-hashes/emails/{hash}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/hash'
    get:
      tags:
        - Email Credentials
      summary: Retrieve an email credential
      operationId: GetEmailCredentialHash
      description: |
        Retrieve an email credential with specified token identifier string
      responses:
        '200':
          description: Email credential was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmtpCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      tags:
        - Email Credentials
      summary: Update an email credential
      operationId: PatchEmailCredentialHash
      description: |
        Update an email credential with specified token identifier string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchCredential'
        description: Email credential resource
        required: true
      responses:
        '200':
          description: Email credential was updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmtpCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /credential-hashes/mailgun:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Email Credentials
      summary: Create a mailgun credential
      operationId: PostMailgunCredentialHash
      description: |
        Create a mailgun credential
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MailgunCredential'
        description: Mailgun credential resource
        required: true
      responses:
        '201':
          description: Mailgun credential was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MailgunCredential'
        '303':
          description: An existent Mailgun credential was retrieved
          headers:
            Location:
              description: The location of the related resource
              schema:
                type: string
                format: url
            Rate-Limit-Limit:
              description: The number of allowed requests in the current period
              schema:
                type: integer
            Rate-Limit-Remaining:
              description: The number of remaining requests in the current period
              schema:
                type: integer
            Rate-Limit-Reset:
              description: >
                The date in format defined by [RFC
                822](https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1)
                when the current period will reset
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MailgunCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/credential-hashes/mailgun/{hash}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/hash'
    get:
      tags:
        - Email Credentials
      summary: Retrieve a mailgun credential
      operationId: GetMailgunCredentialHash
      description: |
        Retrieve a mailgun credential with specified token identifier string
      responses:
        '200':
          description: Mailgun credential was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MailgunCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      tags:
        - Email Credentials
      summary: Update a mailgun credential
      operationId: PatchMailgunCredentialHash
      description: |
        Update a mailgun credential with specified token identifier string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchCredential'
        description: Mailgun credential resource
        required: true
      responses:
        '200':
          description: Mailgun credential was updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MailgunCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /credential-hashes/oauth2:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Webhook Credentials
      summary: Retrieve a list of OAuth2 credentials
      operationId: GetOauth2CredentialHashCollection
      description: |
        Retrieve a list of OAuth2 credentials
      responses:
        '200':
          description: A list of OAuth2 credentials was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OAuth2Credential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Webhook Credentials
      summary: Create OAuth2 credential
      operationId: PostOauth2CredentialHash
      description: |
        Begins the creation of an OAuth2 credential that can be re-used within
        webhooks.  The result will be a `RedirectUrl` that the user must
        authenticate and authorize Rebilly to receive the credentials.
      requestBody:
        $ref: '#/components/requestBodies/OAuth2Credential'
      responses:
        '201':
          description: OAuth2 credential was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuth2Credential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/credential-hashes/oauth2/{hash}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/hash'
    get:
      tags:
        - Webhook Credentials
      summary: Retrieve an OAuth2 credential
      operationId: GetOauth2CredentialHash
      description: |
        Retrieve an OAuth2 credential with specified token identifier string
      responses:
        '200':
          description: OAuth2 credential was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuth2Credential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      tags:
        - Webhook Credentials
      summary: Update an OAuth2 credential with specified token identifier string
      operationId: PatchOauth2CredentialHash
      description: |
        Update an OAuth2 credential with specified token identifier string
      requestBody:
        $ref: '#/components/requestBodies/OAuth2Credential'
      responses:
        '200':
          description: OAuth2 credential was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuth2Credential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/credential-hashes/oauth2/{hash}/items':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/hash'
    get:
      tags:
        - Webhook Credentials
      summary: Retrieve a list of root items available for specified credential
      operationId: GetOauth2CredentialHashItemCollection
      description: |
        Retrieve a list of root items available for specified credential
      responses:
        '200':
          description: >-
            A list of root items available for specified credential was
            retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GoogleSpreadsheet'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /credential-hashes/postmark:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Email Credentials
      summary: Create a Postmark credential
      operationId: PostPostmarkCredentialHash
      description: |
        Create a Postmark credential
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostmarkCredential'
        description: Postmark credential resource
        required: true
      responses:
        '201':
          description: Postmark credential was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostmarkCredential'
        '303':
          description: An existent Postmark credential was retrieved
          headers:
            Location:
              description: The location of the related resource
              schema:
                type: string
                format: url
            Rate-Limit-Limit:
              description: The number of allowed requests in the current period
              schema:
                type: integer
            Rate-Limit-Remaining:
              description: The number of remaining requests in the current period
              schema:
                type: integer
            Rate-Limit-Reset:
              description: >
                The date in format defined by [RFC
                822](https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1)
                when the current period will reset
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostmarkCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/credential-hashes/postmark/{hash}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/hash'
    get:
      tags:
        - Email Credentials
      summary: Retrieve a Postmark credential
      operationId: GetPostmarkCredentialHash
      description: |
        Retrieve a Postmark credential with specified token identifier string
      responses:
        '200':
          description: Postmark credential was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostmarkCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      tags:
        - Email Credentials
      summary: Update a Postmark credential
      operationId: PatchPostmarkCredentialHash
      description: |
        Update a Postmark credential with specified token identifier string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchCredential'
        description: Postmark credential resource
        required: true
      responses:
        '200':
          description: Postmark credential was updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostmarkCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /credential-hashes/sendgrid:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Email Credentials
      summary: Create a SendGrid credential
      operationId: PostSendGridCredentialHash
      description: |
        Create a SendGrid credential
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendGridCredential'
        description: SendGrid credential resource
        required: true
      responses:
        '201':
          description: SendGrid credential was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendGridCredential'
        '303':
          description: An existent SendGrid credential was retrieved
          headers:
            Location:
              description: The location of the related resource
              schema:
                type: string
                format: url
            Rate-Limit-Limit:
              description: The number of allowed requests in the current period
              schema:
                type: integer
            Rate-Limit-Remaining:
              description: The number of remaining requests in the current period
              schema:
                type: integer
            Rate-Limit-Reset:
              description: >
                The date in format defined by [RFC
                822](https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1)
                when the current period will reset
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendGridCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/credential-hashes/sendgrid/{hash}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/hash'
    get:
      tags:
        - Email Credentials
      summary: Retrieve a SendGrid credential
      operationId: GetSendGridCredentialHash
      description: |
        Retrieve a SendGrid credential with specified token identifier string
      responses:
        '200':
          description: SendGrid credential was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendGridCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      tags:
        - Email Credentials
      summary: Update a SendGrid credential
      operationId: PatchSendGridCredentialHash
      description: |
        Update a SendGrid credential with specified token identifier string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchCredential'
        description: SendGrid credential resource
        required: true
      responses:
        '200':
          description: SendGrid credential was updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendGridCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /credential-hashes/webhooks:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Webhook Credentials
      summary: Create a webhook credential
      operationId: PostWebhookCredentialHash
      description: |
        Create a webhook credential
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookCredential'
        description: Credential resource
        required: true
      responses:
        '201':
          description: Webhook credential was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookCredential'
        '303':
          description: An existent Webhook credential was retrieved
          headers:
            Location:
              description: The location of the related resource
              schema:
                type: string
                format: url
            Rate-Limit-Limit:
              description: The number of allowed requests in the current period
              schema:
                type: integer
            Rate-Limit-Remaining:
              description: The number of remaining requests in the current period
              schema:
                type: integer
            Rate-Limit-Reset:
              description: >
                The date in format defined by [RFC
                822](https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1)
                when the current period will reset
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/credential-hashes/webhooks/{hash}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/hash'
    get:
      tags:
        - Webhook Credentials
      summary: Retrieve a webhook credential
      operationId: GetWebhookCredentialHash
      description: |
        Retrieve a webhook credential with specified token identifier string
      responses:
        '200':
          description: Webhook credential was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      tags:
        - Webhook Credentials
      summary: Update a webhook credential
      operationId: PatchWebhookCredentialHash
      description: |
        Update a webhook credential with specified token identifier string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchCredential'
        description: Webhook credential resource
        required: true
      responses:
        '200':
          description: Webhook credential was updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookCredential'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/email-delivery-setting-verifications/{token}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/token'
    put:
      tags:
        - Email Delivery Settings
      summary: Verify an email delivery setting
      operationId: VerifyEmailDeliverySettings
      description: |
        Verify an email delivery setting
      responses:
        '200':
          description: Email delivery setting was verified successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailDeliverySetting'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /email-delivery-settings:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Email Delivery Settings
      summary: Retrieve a list of email delivery settings
      operationId: GetEmailDeliverySettingCollection
      responses:
        '200':
          description: A list of email delivery settings was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EmailDeliverySetting'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Email Delivery Settings
      summary: Create an email delivery setting
      operationId: PostEmailDeliverySetting
      description: >
        Create an email delivery setting.  The email delivery setting is used in
        conjunction with email messages or templates to send emails.
      responses:
        '201':
          description: Email delivery setting was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailDeliverySetting'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailDeliverySetting'
        description: Email delivery setting resource
        required: true
  '/email-delivery-settings/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Email Delivery Settings
      summary: Retrieve an email delivery setting
      operationId: GetEmailDeliverySetting
      description: |
        Retrieve an email delivery setting
      responses:
        '200':
          description: >-
            Email delivery setting with specified identifier was retrieved
            successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailDeliverySetting'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Email Delivery Settings
      summary: Delete an email delivery setting
      operationId: DeleteEmailDeliverySetting
      description: |
        Delete an email delivery setting
      responses:
        '204':
          description: Email delivery setting was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '409':
          $ref: '#/components/responses/Conflict'
    patch:
      tags:
        - Email Delivery Settings
      summary: Update an email delivery setting
      operationId: PatchEmailDeliverySettings
      description: |
        Update an email delivery setting
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailDeliverySetting'
        description: Email delivery setting resource
        required: true
      responses:
        '200':
          description: Email delivery setting was updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailDeliverySetting'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/email-delivery-settings/{id}/resend-email-verification':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    post:
      tags:
        - Email Delivery Settings
      summary: Resend verification email for an email delivery setting.
      operationId: ResendEmailDeliverySettingVerification
      description: |
        Resend verification email for an email delivery setting.
      responses:
        '200':
          description: Verification email was sent successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailDeliverySetting'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  /email-messages:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Email Messages
      summary: Retrieve a list of email messages
      operationId: GetEmailMessageCollection
      description: |
        Retrieve a list of email messages
      responses:
        '200':
          description: A list of email messages was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EmailMessage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Email Messages
      summary: Create an email message
      operationId: PostEmailMessage
      description: |
        Create an email message
      responses:
        '201':
          description: Email message was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailMessage'
        description: Email message resource
        required: true
  '/email-messages/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Email Messages
      summary: Retrieve an email message
      operationId: GetEmailMessage
      description: |
        Retrieve an email message
      responses:
        '200':
          description: Email message with specified identifier was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Email Messages
      summary: Delete an email message
      operationId: DeleteEmailMessage
      description: |
        Delete an email message
      responses:
        '204':
          description: Email message was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '409':
          $ref: '#/components/responses/Conflict'
    patch:
      tags:
        - Email Messages
      summary: Send an email message
      operationId: PatchEmailMessage
      description: |
        Send an email message
      responses:
        '200':
          description: Email message was accepted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailMessage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - status
              properties:
                status:
                  description: The email message's status
                  type: string
                  enum:
                    - outbox
        description: Email message status
        required: true
  /email-notifications:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Email Notifications
      summary: Retrieve a list of email notification events
      operationId: GetEmailNotificationCollection
      responses:
        '200':
          description: A list of email notification events was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EmailNotification'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /events:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Rules
      summary: Retrieve a list of existing events
      operationId: GetEventCollection
      responses:
        '200':
          description: A list of System Events was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SystemEvent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  '/events/{eventType}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/systemEventType'
    get:
      tags:
        - Rules
      summary: Retrieve the event information
      operationId: GetEvent
      responses:
        '200':
          description: Rules were retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SystemEvent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/events/{eventType}/rules':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/systemEventType'
    get:
      tags:
        - Rules
      summary: Retrieve a list of rules for event
      operationId: GetEventRuleCollection
      responses:
        '200':
          description: Rules were retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RuleSet'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Rules
      summary: Update the rules for event
      operationId: PutEventRuleCollection
      responses:
        '200':
          description: Rules were updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RuleSet'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      requestBody:
        $ref: '#/components/requestBodies/RuleSet'
  '/events/{eventType}/rules/history':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/systemEventType'
    get:
      tags:
        - Rules
      summary: Retrieve the change history of the set of rules
      operationId: GetEventRuleHistoryCollection
      description: |
        Retrieve the change history of the selected set of rules.
        The history is updated each time you change the rules.
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionQuery'
        - $ref: '#/components/parameters/collectionSort'
        - $ref: '#/components/parameters/collectionFields'
        - $ref: '#/components/parameters/collectionExpand'
      responses:
        '200':
          description: History was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RuleSetHistoryItem'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/events/{eventType}/rules/history/{version}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/systemEventType'
      - $ref: '#/components/parameters/rulesVersion'
    get:
      tags:
        - Rules
      summary: Retrieve the record from the change history of the set of rules
      operationId: GetEventRuleHistoryVersion
      description: >
        Retrieve the record from the change history of the selected set of
        rules.

        A history record is created each time you change the rules.
      parameters:
        - $ref: '#/components/parameters/collectionFields'
        - $ref: '#/components/parameters/collectionExpand'
      responses:
        '200':
          description: History record was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RuleSetHistoryItem'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/events/{eventType}/rules/versions/{version}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/systemEventType'
      - $ref: '#/components/parameters/rulesVersion'
    get:
      tags:
        - Rules
      summary: Retrieve the version of the set of rules
      operationId: GetEventRuleVersion
      description: |
        Retrieve the version of the selected set of rules.
        The versions are created each time you change the rules.
      parameters:
        - $ref: '#/components/parameters/collectionFields'
        - $ref: '#/components/parameters/collectionExpand'
      responses:
        '200':
          description: Rules version was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RuleSetVersion'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /forgot-password:
    post:
      tags:
        - Reset password
      summary: Request password reset
      operationId: PostForgotPasswordRequest
      description: |
        Sends an email with a link containing a token to reset user password
      responses:
        '204':
          description: Email sent successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForgotPassword'
        description: Forgot password resource
        required: true
      x-code-samples:
        - lang: PHP
          source: |
            $forgotPasswordForm = new Rebilly\Entities\ForgotPassword();
            $forgotPasswordForm->setEmail('johndoe@test.com');

            try {
                $client->users()->forgotPassword($forgotPasswordForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  /gateway-accounts:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Gateway Accounts
      summary: Retrieve a list of gateway accounts
      operationId: GetGatewayAccountCollection
      description: |
        Retrieve a list of gateway accounts
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of Gateway Accounts was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GatewayAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $gatewayAccounts = $client->$gatewayAccounts()->search([
                'filter' => 'currency:USD',
            ]);
    post:
      tags:
        - Gateway Accounts
      summary: Create a Gateway Account
      operationId: PostGatewayAccount
      description: |
        Create a Gateway Account
      requestBody:
        $ref: '#/components/requestBodies/GatewayAccount'
      responses:
        '201':
          description: Gateway Account was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: >
            $gatewayAccountForm = new Rebilly\Entities\GatewayAccount();


            $gatewayAccountForm->setGatewayName('A1Gateway');

            $gatewayAccountForm->setAcquirerName('Bank of Rebilly');

            $gatewayAccountForm->setOrganizationId('organizationId');

            $gatewayAccountForm->setMerchantCategoryCode(5734);

            $gatewayAccountForm->setWebsites([
                'websiteId1',
                'websiteId2',
            ]);

            $gatewayAccountForm->setPaymentCardSchemes([
                Rebilly\Entities\PaymentCardScheme::SCHEME_VISA,
                Rebilly\Entities\PaymentCardScheme::SCHEME_MASTERCARD,
            ]);

            $gatewayAccountForm->setMethod(Rebilly\Entities\PaymentMethod::METHOD_CASH);


            $gatewayConfig = [
                'accountId' => 'test',
                'password' => '123',
            ];


            $gatewayAccountForm->setGatewayConfig($gatewayConfig);


            try {
                $gatewayAccount = $client->gatewayAccounts()->create($gatewayAccountForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/gateway-accounts/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Gateway Accounts
      summary: Retrieve a Gateway Account
      operationId: GetGatewayAccount
      description: |
        Retrieve a Gateway Account with specified identifier string
      responses:
        '200':
          description: Gateway Account was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: >
            $gatewayAccount =
            $client->gatewayAccounts()->load('gatewayAccountId');
    put:
      tags:
        - Gateway Accounts
      summary: Create or update a Gateway Account with predefined ID
      operationId: PutGatewayAccount
      description: |
        Create or update a GatewayAccount with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/GatewayAccount'
      responses:
        '200':
          description: Gateway Account was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccount'
        '201':
          description: Gateway Account was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: >
            $gatewayAccountForm = new Rebilly\Entities\GatewayAccount();


            $gatewayAccountForm->setGatewayName('A1Gateway');

            $gatewayAccountForm->setAcquirerName('Bank of Rebilly');

            $gatewayAccountForm->setOrganizationId('organizationId');

            $gatewayAccountForm->setMerchantCategoryCode(5734);

            $gatewayAccountForm->setWebsites([
                'websiteId1',
                'websiteId2',
            ]);

            $gatewayAccountForm->setPaymentCardSchemes([
                Rebilly\Entities\PaymentCardScheme::SCHEME_VISA,
                Rebilly\Entities\PaymentCardScheme::SCHEME_MASTERCARD,
            ]);

            $gatewayAccountForm->setMethod(Rebilly\Entities\PaymentMethod::METHOD_CASH);


            $gatewayConfig = [
                'accountId' => 'test',
                'password' => '123',
            ];


            $gatewayAccountForm->setGatewayConfig($gatewayConfig);


            try {
                $gatewayAccount = $client->gatewayAccounts()->update('gatewayAccountId', $gatewayAccountForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    patch:
      tags:
        - Gateway Accounts
      summary: Update a Gateway Account with predefined ID
      operationId: PatchGatewayAccount
      description: |
        Update a GatewayAccount with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/GatewayAccount'
      responses:
        '200':
          description: Gateway Account was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
    delete:
      tags:
        - Gateway Accounts
      summary: Delete a Gateway Account
      operationId: DeleteGatewayAccount
      description: |
        Delete a Gateway Account with predefined identifier string
      responses:
        '204':
          description: Gateway Account was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
      x-code-samples:
        - lang: PHP
          source: |
            try {
                $client->gatewayAccounts()->delete('gatewayAccountId');
            } catch (ServerException $e) {
                echo $e->getMessage();
            }
  '/gateway-accounts/{id}/close':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    post:
      tags:
        - Gateway Accounts
      summary: Close a Gateway Account
      operationId: PostGatewayAccountClosure
      description: >
        Close a gateway account with specified identifier string.

        Also known as archiving. Closing a Gateway Account cannot be undone, so
        use with caution. It will no longer be able

        to process transactions. The "status" attribute will be set to "closed".
      responses:
        '201':
          description: Closed successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/gateway-accounts/{id}/disable':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    post:
      tags:
        - Gateway Accounts
      summary: Disable a Gateway Account
      operationId: PostGatewayAccountDisablement
      description: >
        Disable a gateway account with specified identifier string.

        Disabled gateway accounts have their "status" attribute set to
        "inactive" and cannot process transactions.
      responses:
        '201':
          description: Disabled successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Gateway account is pending activation and cannot be disabled.
  '/gateway-accounts/{id}/downtime-schedules':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Gateway Accounts
      summary: Retrieve a list of gateway account downtime schedules
      operationId: GetGatewayAccountDowntimeScheduleCollection
      description: |
        Retrieve a list of gateway account downtime schedules
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: >-
            A list of Gateway Account downtime schedules was retrieved
            successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GatewayAccountDowntimeSchedule'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Gateway Accounts
      summary: Create a Gateway Account downtime schedule.
      operationId: PostGatewayAccountDowntimeSchedule
      description: |
        Create a Gateway Account downtime schedule
      responses:
        '201':
          description: Gateway Account downtime schedule was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccountDowntimeSchedule'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      requestBody:
        $ref: '#/components/requestBodies/GatewayAccountDowntimeSchedule'
  '/gateway-accounts/{id}/downtime-schedules/{downtimeId}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
      - name: downtimeId
        in: path
        description: The Gateway Account downtime schedule ID
        required: true
        schema:
          type: string
    get:
      tags:
        - Gateway Accounts
      summary: Retrieve a Gateway Downtime schedule
      operationId: GetGatewayAccountDowntimeSchedule
      description: |
        Retrieve a Gateway Downtime schedule with specified identifier string
      responses:
        '200':
          description: Gateway Downtime schedule was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccountDowntimeSchedule'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Gateway Accounts
      summary: Update a Gateway Account downtime schedule
      operationId: PutGatewayAccountDowntimeSchedule
      description: >
        Update a Gateway Account downtime schedule with predefined identifier
        string
      responses:
        '200':
          description: Gateway Account downtime schedule was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccountDowntimeSchedule'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      requestBody:
        $ref: '#/components/requestBodies/GatewayAccountDowntimeSchedule'
    delete:
      tags:
        - Gateway Accounts
      summary: Delete a Gateway Account downtime schedule
      operationId: DeleteGatewayAccountDowntimeSchedule
      description: |
        Delete a Gateway Account downtime schedule
      responses:
        '204':
          description: Gateway Account downtime schedule was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/gateway-accounts/{id}/enable':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    post:
      tags:
        - Gateway Accounts
      summary: Enable a Gateway Account
      operationId: PostGatewayAccountEnablement
      description: >
        Enable a gateway account with specified identifier string.

        Enabled gateway accounts have their "status" attribute set to "active"
        and can process transactions.
      responses:
        '201':
          description: Enabled successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccount'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Gateway account is pending activation and cannot be enabled.
  '/gateway-accounts/{id}/limits':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Gateway Accounts
      summary: Retrieve a list of gateway account limits
      operationId: GetGatewayAccountLimitCollection
      description: |
        Retrieve a list of gateway account limits.
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of gateway account limits was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GatewayAccountLimit'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  '/gateway-accounts/{id}/limits/{limitId}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
      - name: limitId
        in: path
        description: The gateway account limit ID
        required: true
        schema:
          type: string
          enum:
            - daily-money
            - monthly-money
            - daily-count
            - monthly-count
    get:
      tags:
        - Gateway Accounts
      summary: Retrieve a gateway account limit
      operationId: GetGatewayAccountLimit
      description: |
        Retrieve a gateway account limit with specified identifier string.
      responses:
        '200':
          description: Gateway account limit was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccountLimit'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Gateway Accounts
      summary: Update a gateway account limit
      operationId: PutGatewayAccountLimit
      description: |
        Update a gateway account limit with predefined identifier string.
      responses:
        '200':
          description: Gateway account limit was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccountLimit'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GatewayAccountLimit'
    delete:
      tags:
        - Gateway Accounts
      summary: Delete a gateway account limit
      operationId: DeleteGatewayAccountLimit
      description: |
        Delete a gateway account limit.
      responses:
        '204':
          description: Gateway account limit was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/gateway-accounts/{id}/timeline':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Gateway Accounts
      summary: Retrieve a list of gateway account timeline messages
      operationId: GetGatewayAccountTimelineCollection
      description: |
        Retrieve a list of gateway account timeline messages
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: >-
            A list of Gateway Account timeline messages was retrieved
            successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GatewayAccountTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Gateway Accounts
      summary: Create a Gateway Account Timeline comment
      operationId: PostGatewayAccountTimeline
      description: |
        Create a Gateway Account Timeline comment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GatewayAccountTimeline'
        description: Gateway Account Timeline resource
        required: true
      responses:
        '201':
          description: Gateway Account Timeline comment was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccountTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
  '/gateway-accounts/{id}/timeline/{messageId}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
      - name: messageId
        in: path
        description: The Gateway Account Timeline message ID
        required: true
        schema:
          type: string
    get:
      tags:
        - Gateway Accounts
      summary: Retrieve a Gateway Timeline message
      operationId: GetGatewayAccountTimeline
      description: |
        Retrieve a Gateway Timeline message with specified identifier string
      responses:
        '200':
          description: Gateway Timeline message was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayAccountTimeline'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags:
        - Gateway Accounts
      summary: Delete a Gateway Timeline message
      operationId: DeleteGatewayAccountTimeline
      description: |
        Delete a Gateway Timeline message with predefined identifier string
      responses:
        '204':
          description: Gateway Account Timeline message was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  /grid-segments:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Segments
      summary: Retrieve a user's Segments
      operationId: GetGridSegmentCollection
      description: |
        Retrieve a user's UI Segments
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Segments were retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Segment'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Segments
      summary: Create a new UI Segment
      operationId: PostGridSegment
      description: |
        Create a new Segment for oneself or to share with others within the
        organization
      responses:
        '201':
          description: Segment was created successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        $ref: '#/components/requestBodies/Segment'
  '/grid-segments/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Segments
      summary: Retrieve a specific Segment
      operationId: GetGridSegment
      description: |
        Retrieve a specific UI Segment
      responses:
        '200':
          description: Segment was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Segments
      summary: Update a Segment
      operationId: PutGridSegment
      description: |
        Update a Segment
      responses:
        '200':
          description: Segment was updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '403':
          description: |
            This will be sent if the user is not the owner.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Segment'
    delete:
      tags:
        - Segments
      summary: Delete a Segment
      operationId: DeleteGridSegment
      description: >
        Delete a Segment. This will also remove all shares. Only the owner may
        perform this.
      responses:
        '204':
          description: Segment was deleted successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '403':
          description: |
            This will be sent if the user is not the owner.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          $ref: '#/components/responses/NotFound'
  /integrations:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Integrations
      summary: Retrieve a list of integrations
      operationId: GetIntegrationCollection
      description: |
        Retrieve a list of integrations
      responses:
        '200':
          description: A list of integrations was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Integration'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  '/integrations/{label}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/integrationLabel'
    get:
      tags:
        - Integrations
      summary: Retrieve an integration for specific label
      operationId: GetIntegration
      description: |
        Retrieve an integration for specific label
      responses:
        '200':
          description: An integration with specific label was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Integration'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /layouts:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Layouts
      summary: Retrieve a layout list
      operationId: GetLayoutCollection
      description: |
        Retrieve a layout list
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: Layout list was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Layout'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $layouts = $client->layouts()->search([
                'filter' => 'name:TestLayout',
            ]);
    post:
      tags:
        - Layouts
      summary: Create a layout
      operationId: PostLayout
      description: |
        Create a layout
      requestBody:
        $ref: '#/components/requestBodies/Layout'
      responses:
        '201':
          description: Layout was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Layout'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $layoutForm = new Rebilly\Entities\Layout();
            $layoutItemForm = new Rebilly\Entities\LayoutItem();

            $layoutItemForm->setPlanId('planId');
            $layoutItemForm->setStarred(false);

            $layoutForm->setName('TestLayout');
            $layoutForm->setLayoutItems([
                $layoutItemForm,
            ]);

            try {
                $layout = $client->layouts()->create($layoutForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/layouts/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Layouts
      summary: Retrieve a layout
      operationId: GetLayout
      description: |
        Retrieve a layout with specified identifier string
      responses:
        '200':
          description: Layout was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Layout'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $layout = $client->layouts()->load('layoutId');
    put:
      tags:
        - Layouts
      summary: Create or update a layout with predefined ID
      operationId: PutLayout
      description: |
        Create or update a layout with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/Layout'
      responses:
        '200':
          description: Layout was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Layout'
        '201':
          description: Layout was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Layout'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $layoutForm = new Rebilly\Entities\Layout();
            $layoutItemForm = new Rebilly\Entities\LayoutItem();

            $layoutItemForm->setPlanId('planId');
            $layoutItemForm->setStarred(false);

            $layoutForm->setName('TestLayout');
            $layoutForm->setLayoutItems([
                $layoutItemForm,
            ]);

            try {
                $layout = $client->layouts()->update('layoutId', $layoutForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Layouts
      summary: Delete a layout
      operationId: DeleteLayout
      description: |
        Delete a layout with predefined identifier string
      responses:
        '204':
          description: Layout was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $client->layouts()->delete('layoutId');
  /lists:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Lists
      summary: Retrieve a collection of Lists (latest version of each List)
      operationId: GetListCollection
      description: |
        Retrieve a collection of Lists
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - $ref: '#/components/parameters/collectionSort'
      responses:
        '200':
          description: A collection of Lists was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/List'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Lists
      summary: Create a List
      operationId: PostList
      description: |
        Create a List
      responses:
        '201':
          description: List was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/List'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      requestBody:
        $ref: '#/components/requestBodies/List'
  '/lists/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Lists
      summary: Retrieve list's latest version
      operationId: GetList
      description: |
        Retrieve latest version of List with specified identifier string
      responses:
        '200':
          description: List was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/List'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Lists
      summary: Create or update a list with predefined ID
      operationId: PutList
      description: |
        Create or update a list with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/List'
      responses:
        '200':
          description: List was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/List'
        '201':
          description: List was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/List'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
    delete:
      tags:
        - Lists
      summary: Delete a list
      operationId: DeleteList
      description: |
        Delete a list with predefined identifier string
      responses:
        '204':
          description: List was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: List is used in Rules and cannot be deleted
  '/lists/{id}/{version}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
      - name: version
        in: path
        required: true
        description: List version
        schema:
          type: integer
          minimum: 1
    get:
      tags:
        - Lists
      summary: Retrieve List's exact version
      operationId: GetListVersion
      responses:
        '200':
          description: List's exact version was retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/List'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /logout:
    post:
      tags:
        - JWT Session
      summary: Destroys the user's current session
      operationId: PostLogoutRequest
      description: >
        Destroys the user's current session. Endpoint must be accessed with
        valid JWT Authorization header.
      responses:
        '204':
          description: Session was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /memberships:
    get:
      tags:
        - Memberships
      summary: Retrieve a list of memberships
      operationId: GetMembershipCollection
      description: |
        Retrieve a list of memberships
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: A list of memberships was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Membership'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  '/memberships/{organizationId}/{userId}':
    parameters:
      - name: organizationId
        in: path
        required: true
        description: Organization identifier
        schema:
          $ref: '#/components/schemas/ResourceId'
      - name: userId
        in: path
        required: true
        description: User identifier
        schema:
          $ref: '#/components/schemas/ResourceId'
    get:
      tags:
        - Memberships
      summary: Retrieve the membership
      operationId: GetMembership
      description: |
        Retrieve the membership using organization and user identifiers
      responses:
        '200':
          description: Membership was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Membership'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Memberships
      summary: Create or update membership
      operationId: PutMembership
      description: |
        Create or update membership using organization and user identifiers.
        Only membership's owner can add other users in the membership.
      requestBody:
        content:
          application/json:
            schema:
              properties:
                isOwner:
                  type: boolean
                permissions:
                  description: >-
                    The memberships's permissions. See the format in example.
                    Use wildcard `*` for full access.
                  allOf:
                    - $ref: '#/components/schemas/AclPermissions'
        required: true
      responses:
        '200':
          description: Membership was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Membership'
        '201':
          description: Membership was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Membership'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
    delete:
      tags:
        - Memberships
      summary: Delete the membership
      operationId: DeleteMembership
      description: |
        Delete the membership using organization and user identifiers
      responses:
        '204':
          description: Membership message was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  /organizations:
    get:
      tags:
        - Organizations
      summary: Retrieve a list of organizations
      operationId: GetOrganizationCollection
      description: |
        Retrieve a list of organizations
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of organizations was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Organization'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $organizations = $client->organizations()->search([
                'filter' => 'city:Test',
            ]);
    post:
      tags:
        - Organizations
      summary: Create a organization
      operationId: PostOrganization
      description: |
        Create a organization
      requestBody:
        $ref: '#/components/requestBodies/Organization'
      responses:
        '201':
          description: Organization was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: The similar organization already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $organizationForm = new Rebilly\Entities\Organization();
            $organizationForm->setName('Test Organization');
            $organizationForm->setCountry('US');

            try {
                $organization = $client->organizations()->create($organizationForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/organizations/{id}':
    parameters:
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Organizations
      summary: Retrieve a organization
      operationId: GetOrganization
      description: |
        Retrieve a organization with specified identifier string
      responses:
        '200':
          description: Organization was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $organization = $client->organizations()->load('organizationId');
    put:
      tags:
        - Organizations
      summary: Create or update a organization with predefined ID
      operationId: PutOrganization
      description: |
        Create or update a organization with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/Organization'
      responses:
        '200':
          description: Organization was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '201':
          description: Organization was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: The similar organization already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $organizationForm = new Rebilly\Entities\Organization();
            $organizationForm->setName('Test Organization');
            $organizationForm->setCountry('US');

            try {
                $organization = $client->organizations()->update('organizationId', $organizationForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Organizations
      summary: Delete a organization
      operationId: DeleteOrganization
      description: |
        Delete a organization with predefined identifier string
      responses:
        '204':
          description: Organization was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Organization has related resources and cannot be deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /payment-cards-bank-names:
    get:
      tags:
        - Payment Cards
      summary: Retrieve a list of payment card issuing bank names
      operationId: GetPaymentCardBankNameCollection
      description: |
        Retrieve a list of payment card issuing bank names
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionQuery'
      responses:
        '200':
          description: A list of payment card issuing bank names was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      description: Bank Name
                      type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /previews/rule-actions/send-email:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Rules
      summary: Send a test email
      operationId: PostPreviewRuleActionEmailSending
      description: |
        Send a test email
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendTestEmail'
        description: Test email resource
        required: true
      responses:
        '200':
          description: Test email was sent
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendTestEmail'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
  /previews/rule-actions/trigger-webhook:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Rules
      summary: Trigger a test webhook
      operationId: PostPreviewRuleActionWebhookTrigger
      description: |
        Trigger a test webhook
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendPreviewWebhook'
        description: Test webhook resource
        required: true
      responses:
        '200':
          description: Test webhook was triggered
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendPreviewWebhook'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
  /previews/webhooks:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Webhooks
      summary: Trigger a test webhook
      operationId: PostPreviewWebhook
      description: |
        Trigger a test webhook
      requestBody:
        $ref: '#/components/requestBodies/GlobalWebhook'
      responses:
        '204':
          description: Test webhook was triggered
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
  /profile:
    get:
      tags:
        - Profile
      summary: Retrieve user's profile
      operationId: GetProfile
      description: |
        Retrieve user's profile
      responses:
        '200':
          description: Profile was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Profile'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Profile
      summary: Update user's profile
      operationId: PutProfile
      description: |
        Update user's profile
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Profile'
        description: Profile resource
        required: true
      responses:
        '200':
          description: Profile was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Profile'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /profile/password:
    post:
      tags:
        - Profile
      summary: Change password
      operationId: PostProfilePasswordChange
      description: >
        Updates user's password with the specified newPassword. And checks if
        currentPassword matches the actual one.
      requestBody:
        $ref: '#/components/requestBodies/UpdatePassword'
      responses:
        '201':
          description: Password updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Profile'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
  /profile/totp-reset:
    post:
      tags:
        - Profile
      summary: Reset (renew) totpSecret
      operationId: PostProfileTotpReset
      description: |
        Reset (renew) totpSecret
      responses:
        '201':
          description: totpSecret reset (renewed) successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Profile'
        '404':
          $ref: '#/components/responses/NotFound'
  '/reset-password/{token}':
    parameters:
      - name: token
        in: path
        description: The token string
        required: true
        schema:
          type: string
    get:
      tags:
        - Reset password
      summary: Read token information
      operationId: GetPasswordResetToken
      responses:
        '200':
          description: Token was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResetPasswordTokenInfo'
        '404':
          $ref: '#/components/responses/NotFound'
    post:
      tags:
        - Reset password
      summary: Finish password reset
      operationId: PostPasswordReset
      description: |
        Reset user password
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPassword'
        description: ResetPassword resource
        required: true
      responses:
        '201':
          description: Password was reseted successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: |
            $resetPasswordForm = new Rebilly\Entities\ResetPassword();
            $resetPasswordForm->setNewPassword('1234');

            try {
                $user = $client->users()->resetPassword('token', $resetPasswordForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/send-through-attribution/{eventType}':
    parameters:
      - $ref: '#/components/parameters/systemEventType'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Email Notifications
      summary: Retrieve a list of email notification send through attributions
      operationId: GetSendThroughAttributionCollection
      responses:
        '200':
          description: >-
            A list of email notification send through attributions was retrieved
            successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SendThroughAttribution'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /signin:
    post:
      tags:
        - JWT Session
      summary: Create a session with email and password
      operationId: PostSigninRequest
      description: |
        Create a session with email and password
      security: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Signin'
        description: Signin resource
        required: true
      responses:
        '201':
          description: Session was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: |
            $loginForm = new Rebilly\Entities\Login();
            $loginForm->setEmail('test@test.com');
            $loginForm->setPassword('1234');

            try {
                $user = $client->users()->signin($loginForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  /signup:
    post:
      tags:
        - Profile
      summary: Register and create new profile
      operationId: PostSignupRequest
      description: |
        Creates a new user and sends an email confirmation
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Signup'
        description: Signup resource
        required: true
      responses:
        '201':
          description: User was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: |
            $signupForm = new Rebilly\Entities\Signup();
            $signupForm->setFirstName('John');
            $signupForm->setLastName('Doe');
            $signupForm->setEmail('johndoe@test.com');
            $signupForm->setBusinessPhone('+123456789');
            $signupForm->setPassword('1234');

            try {
                $client->users()->signup($signupForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  /status:
    get:
      tags:
        - Status
      summary: Retrieve API current status
      operationId: GetStatus
      description: |
        Retrieve API current status
      security: []
      responses:
        '200':
          description: Status was received
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Status'
  /tracking/api:
    get:
      tags:
        - Tracking
      summary: Retrieve a list of tracking API logs
      operationId: GetTrackingApiCollection
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
              - text/csv
            default: application/json
      responses:
        '200':
          description: Tracking API logs was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApiTracking'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $apiTrackingLog = $client->apiTracking()->search([
                'filter' => 'status:200',
            ]);
  '/tracking/api/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Tracking
      summary: Retrieve a tracking API log with specified identifier string
      operationId: GetTrackingApi
      responses:
        '200':
          description: Tracking API log was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTracking'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $apiTrackingLog = $client->apiTracking()->load('apiLogId');
  /tracking/lists:
    get:
      tags:
        - Tracking
      summary: Retrieve Lists changes history
      operationId: GetTrackingListCollection
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: Lists changes history was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/List'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /tracking/webhooks:
    get:
      tags:
        - Tracking
      summary: Retrieve a list of tracking webhook notifications
      operationId: GetTrackingWebhookCollection
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Tracking webhook notifications were retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WebhookTracking'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  '/tracking/webhooks/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Tracking
      summary: >-
        Retrieve a tracking webhook notification with specified identifier
        string
      operationId: GetTrackingWebhook
      responses:
        '200':
          description: Tracking webhook notification was retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookTracking'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/tracking/webhooks/{id}/history':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Tracking
      summary: Retrieve related webhook attempts for specified webhook tracking.
      operationId: GetTrackingWebhookHistoryCollection
      responses:
        '200':
          description: Webhook tracking related attempts were retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WebhookTracking'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  '/tracking/webhooks/{id}/resend':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    post:
      tags:
        - Tracking
      summary: Schedules webhook resend attempt for specified webhook tracking.
      operationId: PostTrackingWebhookResendRequest
      responses:
        '204':
          description: Webhook resend attempt was scheduled
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /users:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Users
      summary: Retrieve a list of users
      operationId: GetUserCollection
      description: |
        Retrieve a list of users
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of users was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $users = $client->users()->search([
                'filter' => 'firstName:John',
            ]);
    post:
      tags:
        - Users
      summary: Create an user
      operationId: PostUser
      description: |
        Create an user
      requestBody:
        $ref: '#/components/requestBodies/User'
      responses:
        '201':
          description: User was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: |
            $userForm = new Rebilly\Entities\User();
            $userForm->setFirstName('John');
            $userForm->setLastName('Doe');
            $userForm->setEmail('johndoe@test.com');

            try {
                $user = $client->users()->create($userForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/users/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Users
      summary: Retrieve user
      operationId: GetUser
      description: |
        Retrieve user with specified identifier string
      responses:
        '200':
          description: User was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $user = $client->users()->load('userId');
    put:
      tags:
        - Users
      summary: Create or update user with predefined ID
      operationId: PutUser
      description: |
        Create or update user with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/User'
      responses:
        '200':
          description: User was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '201':
          description: User was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $userForm = new Rebilly\Entities\User();
            $userForm->setFirstName('John');
            $userForm->setLastName('Doe');
            $userForm->setEmail('johndoe@test.com');

            try {
                $user = $client->users()->update('userId', $userForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Users
      summary: Delete user
      operationId: DeleteUser
      description: |
        Delete user with predefined identifier string
      responses:
        '204':
          description: User was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: User has related resources and cannot be deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-code-samples:
        - lang: PHP
          source: |
            try {
                $client->users()->delete('userId');
            } catch (ServerException $e) {
                echo $e->getMessage();
            }
  '/users/{id}/password':
    parameters:
      - $ref: '#/components/parameters/resourceId'
    post:
      tags:
        - Users
      summary: Change a user's password
      operationId: PostUserPasswordChange
      description: >
        Updates user's password with the specified newPassword. And checks if
        currentPassword matches the actual one.
      requestBody:
        $ref: '#/components/requestBodies/UpdatePassword'
      responses:
        '201':
          description: Password updated successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
      x-code-samples:
        - lang: PHP
          source: |
            $updatePasswordForm = new Rebilly\Entities\UpdatePassword();
            $updatePasswordForm->setCurrentPassword('1234');
            $updatePasswordForm->setNewPassword('5678');

            try {
                $user = $client->users()->updatePassword('userId', $updatePasswordForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/users/{id}/totp-reset':
    parameters:
      - $ref: '#/components/parameters/resourceId'
    post:
      tags:
        - Users
      summary: Reset (renew) totpSecret
      operationId: PostUserTotpReset
      description: |
        Reset (renew) totpSecret
      responses:
        '201':
          description: totpSecret reset (renewed) successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $user = $client->users()->resetTotp('userId');
  /webhooks:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Webhooks
      summary: Retrieve a list of webhooks
      operationId: GetWebhookCollection
      description: |
        Retrieve a list of webhooks
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: A list of Webhooks was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GlobalWebhook'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    post:
      tags:
        - Webhooks
      summary: Create a webhook
      operationId: PostWebhook
      description: |
        Create a webhook
      requestBody:
        $ref: '#/components/requestBodies/GlobalWebhook'
      responses:
        '201':
          description: Webhook was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalWebhook'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
  '/webhooks/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Webhooks
      summary: Retrieve a webhook
      operationId: GetWebhook
      description: |
        Retrieve a webhook with specified identifier string
      responses:
        '200':
          description: Webhook was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalWebhook'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Webhooks
      summary: Create or update a webhook with predefined ID
      operationId: PutWebhook
      description: |
        Create or update a webhook with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/GlobalWebhook'
      responses:
        '200':
          description: Webhook was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalWebhook'
        '201':
          description: Webhook was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalWebhook'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
  /websites:
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Websites
      summary: Retrieve a list of websites
      operationId: GetWebsiteCollection
      description: |
        Retrieve a list of websites
      parameters:
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
              - text/csv
            default: application/json
      responses:
        '200':
          description: A list of Websites was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Website'
            text/csv:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Website'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-code-samples:
        - lang: PHP
          source: |
            $websites = $client->websites()->search([
                'filter' => 'name:TestWebsite',
            ]);
    post:
      tags:
        - Websites
      summary: Create a website
      operationId: PostWebsite
      description: |
        Create a website
      requestBody:
        $ref: '#/components/requestBodies/Website'
      responses:
        '201':
          description: Website was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Website'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: |
            $websiteForm = new Rebilly\Entities\Website();
            $websiteForm->setName('TestWebsite');
            $websiteForm->setUrl('http://testwebsite.com');
            $websiteForm->setServicePhone('+0123456789');
            $websiteForm->setServiceEmail('test@testwebsite.com');

            try {
                $website = $client->websites()->create($websiteForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
  '/websites/{id}':
    parameters:
      - $ref: '#/components/parameters/organizationId'
      - $ref: '#/components/parameters/resourceId'
    get:
      tags:
        - Websites
      summary: Retrieve a website
      operationId: GetWebsite
      description: |
        Retrieve a website with specified identifier string
      responses:
        '200':
          description: Website was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Website'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-code-samples:
        - lang: PHP
          source: |
            $website = $client->websites()->load('websiteId');
    put:
      tags:
        - Websites
      summary: Create or update a website with predefined ID
      operationId: PutWebsite
      description: |
        Create or update a website with predefined identifier string
      requestBody:
        $ref: '#/components/requestBodies/Website'
      responses:
        '200':
          description: Website was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Website'
        '201':
          description: Website was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Website'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
      x-code-samples:
        - lang: PHP
          source: |
            $websiteForm = new Rebilly\Entities\Website();
            $websiteForm->setName('TestWebsite');
            $websiteForm->setUrl('http://testwebsite.com');
            $websiteForm->setServicePhone('+0123456789');
            $websiteForm->setServiceEmail('test@testwebsite.com');

            try {
                $website = $client->websites()->update('websiteId', $websiteForm);
            } catch (UnprocessableEntityException $e) {
                echo $e->getMessage();
            }
    delete:
      tags:
        - Websites
      summary: Delete a website
      operationId: DeleteWebsite
      description: |
        Delete a website with predefined identifier string
      responses:
        '204':
          description: Website was deleted
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Website has related resources and cannot be deleted
      x-code-samples:
        - lang: PHP
          source: |
            try {
                $client->websites()->delete('websiteId');
            } catch (ServerException $e) {
                echo $e->getMessage();
            }
  '/customers/{customerId}/summary-metrics':
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - name: customerId
        in: path
        required: true
        description: Customer's ID
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Customers
      summary: Retrieve customer lifetime summary metrics
      operationId: GetCustomerSummaryMetricReport
      description: |
        Retrieve customer lifetime summary metrics
      responses:
        '200':
          description: Metrics were retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerInformation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /data-exports:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    post:
      tags:
        - Data Exports
      summary: Request a data export of selected resource
      operationId: PostDataExport
      description: |
        Request a data export of selected resource
      requestBody:
        $ref: '#/components/requestBodies/DataExport'
      responses:
        '201':
          description: Data export request received
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataExport'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
    get:
      tags:
        - Data Exports
      summary: Retrieve a list of data export requests
      operationId: GetDataExportCollection
      description: |
        Retrieve a list of data export requests
      responses:
        '200':
          description: A list of data export requests was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DataExport'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  '/data-exports/{id}':
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/resourceId'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Data Exports
      summary: Retrieve a data export request
      operationId: GetDataExport
      description: |
        Retrieve a data export request
      responses:
        '200':
          description: Data Export request
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataExport'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      tags:
        - Data Exports
      summary: Modify a data export
      operationId: PutDataExport
      description: |
        A data export may be changed as long as it is still pending
      requestBody:
        $ref: '#/components/requestBodies/DataExport'
      responses:
        '200':
          description: Data Export was modified
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataExport'
        '201':
          description: Data Export was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataExport'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Invalid data was sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidError'
    delete:
      tags:
        - Data Exports
      summary: Delete a data export
      operationId: DeleteDataExport
      description: |
        Delete an existing data export
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /histograms/transactions:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Histograms
      summary: Get Transaction histogram report data
      operationId: GetHistogramTransactionReport
      description: |
        Get Transaction histogram report data.
      parameters:
        - name: periodStart
          in: query
          description: Report start day
          required: true
          schema:
            type: string
            format: date-time
        - name: periodEnd
          in: query
          description: Report end day
          required: true
          schema:
            type: string
            format: date-time
        - name: aggregationField
          in: query
          description: Report aggregation field
          required: true
          schema:
            type: string
            enum:
              - website
              - currency
              - bin
              - rebillNumber
              - transactionResult
              - transactionType
              - gatewayAccount
              - leadsAffiliate
              - leadsCampaign
              - leadsContent
              - leadsMedium
              - leadsSalesAgent
              - leadsSource
              - leadsSubAffiliate
              - leadsTerm
        - name: aggregationPeriod
          in: query
          description: Report aggregation period
          required: true
          schema:
            type: string
            enum:
              - hour
              - day
              - month
        - name: metric
          in: query
          description: Report metric
          required: true
          schema:
            type: string
            enum:
              - ApprovalThroughput
              - AuthApprovalThroughput
              - AvgSalesPrice
              - Refunds
              - RefundCount
              - Sales
              - SalesCount
      responses:
        '200':
          description: Transaction report was retrieved successfully.
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistogramData'
        '403':
          $ref: '#/components/responses/Forbidden'
  /experimental/organizations:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    post:
      deprecated: true
      tags:
        - Organizations
      summary: Create an organization
      operationId: ExperimentalPostOrganization
      description: |
        Create an organization
      security:
        - JWT: []
      requestBody:
        $ref: '#/components/requestBodies/PostOrganization'
      responses:
        '201':
          description: Organization was created
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  '/experimental/organizations/{id}':
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/resourceId'
    patch:
      deprecated: true
      tags:
        - Organizations
      summary: Update an organization
      operationId: PatchOrganization
      description: |
        Update an organization with predefined identifier string
      security:
        - JWT: []
      requestBody:
        $ref: '#/components/requestBodies/PatchOrganization'
      responses:
        '200':
          description: Organization was updated
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationError'
  /reports/payments-success-by-decline-reason:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a report of payments successful retries throughput
      operationId: GetPaymentSuccessByDeclineReasonReport
      description: Retrieve a report of payments successful retries throughput
      parameters:
        - name: periodStart
          in: query
          description: Report start day
          required: true
          schema:
            type: string
            format: date-time
        - name: periodEnd
          in: query
          description: Report end day
          required: true
          schema:
            type: string
            format: date-time
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportPaymentsSuccessfulRetries'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/api-log-summary:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a API Log Summary Report
      operationId: GetApiLogSummaryReport
      description: Retrieve a API Log Summary Report
      parameters:
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APILogSummary'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/cumulative-subscriptions-plans:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a cumulative subscriptions plans report
      operationId: GetCumulativeSubscriptionPlanReport
      description: Retrieve a cumulative subscriptions report aggregated by day and plans
      parameters:
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
              - text/csv
            default: application/json
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CumulativeSubscriptionsPlans'
            text/csv:
              schema:
                $ref: '#/components/schemas/CumulativeSubscriptionsPlans'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/cumulative-subscriptions:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a cumulative subscriptions report
      operationId: GetCumulativeSubscriptionReport
      description: Retrieve a cumulative subscriptions report
      parameters:
        - name: aggregationField
          in: query
          description: Report aggregation field
          required: true
          schema:
            type: string
            enum:
              - day
              - month
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CumulativeSubscriptions'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/dashboard:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve dashboard data
      operationId: GetDashboardReport
      description: Retrieve dashboard data
      parameters:
        - name: periodStart
          in: query
          description: Report start day
          required: true
          schema:
            type: string
            format: date-time
        - name: periodEnd
          in: query
          description: Report end day
          required: true
          schema:
            type: string
            format: date-time
        - name: metrics
          in: query
          description: Comma-separated list of metrics
          schema:
            type: string
            format: date-time
        - name: segments
          in: query
          description: Dashboard report segments as a JSON array
          schema:
            type: string
        - $ref: '#/components/parameters/reportTimezone'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DashboardResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/dcc-markup:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a DCC markup report
      operationId: GetDccMarkupReport
      description: Retrieve a DCC markup report
      parameters:
        - name: aggregationField
          in: query
          description: Report aggregation field
          required: true
          schema:
            type: string
            enum:
              - day
              - month
              - bin
              - country
              - baseCurrency
              - quoteCurrency
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DccMarkup'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/disputes:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a disputes report
      operationId: GetDisputeReport
      description: |
        Retrieve a disputes report
      parameters:
        - name: aggregationField
          in: query
          description: Report will be aggregated by this field
          required: true
          schema:
            type: string
            enum:
              - website
              - gatewayAcquirer
              - currency
              - bin
              - country
              - rebillNumber
              - retryNumber
              - gatewayAccount
              - transactionAmount
        - name: periodMonth
          in: query
          description: Report month in format YYYY-MM
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportDisputes'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/events-triggered:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a events triggered summary report
      operationId: GetTriggeredEventReport
      description: |
        Retrieve a events triggered summary report.
      parameters:
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportEventsTriggeredSummary'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  '/reports/events-triggered/{eventType}/rules':
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - name: eventType
        in: path
        required: true
        description: The system event type
        schema:
          $ref: '#/components/schemas/EventType'
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a rules matched summary report
      operationId: GetTriggeredEventRuleReport
      description: |
        Retrieve a rules matched summary report by events triggered.
      parameters:
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportRulesMatchedSummary'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/future-renewals:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a future renewals report
      operationId: GetFutureRenewalReport
      description: Retrieve a future renewals report
      parameters:
        - name: periodStart
          in: query
          description: Report start date. It should be in the future
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FutureRenewals'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/renewal-sales:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a renewal sales report
      operationId: GetRenewalSaleReport
      description: |
        Retrieve a renewal sales report
      parameters:
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RenewalSales'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/retention-percentage:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a retention percentage report
      operationId: GetRetentionPercentageReport
      description: |
        Retrieve a retention percentage report
      parameters:
        - name: aggregationField
          in: query
          description: Report aggregation field
          required: true
          schema:
            type: string
            enum:
              - day
              - month
              - quarter
              - year
        - name: aggregationPeriod
          in: query
          description: Report aggregation period
          required: true
          schema:
            type: string
            enum:
              - day
              - month
              - quarter
              - year
              - cycle
        - name: includeSwitchedSubscriptions
          in: query
          description: If to include switched subscriptions
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportRetentionPercentage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/retention-value:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a retention value report
      operationId: GetRetentionValueReport
      description: >
        The retention value report shows the count of new customers

        per aggregation bucket and the corresponding per customer value over
        time.
      parameters:
        - name: aggregationField
          in: query
          description: Report aggregation field
          required: true
          schema:
            type: string
            enum:
              - day
              - month
              - quarter
              - year
              - leadsSource
              - leadsMedium
              - leadsCampaign
              - leadsContent
              - leadsTerm
              - leadsAffiliate
              - leadsSubAffiliate
              - leadsSalesAgent
        - name: aggregationPeriod
          in: query
          description: Report aggregation period
          required: true
          schema:
            type: string
            enum:
              - day
              - month
              - quarter
              - year
        - name: includeRefunds
          in: query
          description: If to include refunds
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
        - name: includeDisputes
          in: query
          description: If to include disputes
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportRetentionValue'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/retry-transaction:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a payment retry report
      operationId: GetTransactionRetryReport
      description: |
        Retrieve a payment retry report
      parameters:
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
            format: date-time
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
            format: date-time
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportPaymentRetry'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/statistics:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a statistics report
      operationId: GetStatisticReport
      description: |
        Retrieve a statistics report
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportStatistics'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/subscription-cancellation:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve transactions with their plan data
      operationId: GetSubscriptionCancellationReport
      description: Retrieve transactions with their plan data
      parameters:
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - name: aggregationField
          in: query
          description: Report aggregation field
          required: true
          schema:
            type: string
            enum:
              - planId
              - websiteId
              - canceledBy
              - cancelCategory
              - leadSource.source
              - leadSource.medium
              - leadSource.campaign
              - leadSource.content
              - leadSource.term
              - leadSource.affiliate
              - leadSource.subAffiliate
              - leadSource.salesAgent
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
            default: application/json
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionCancellationReport'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/subscription-renewal:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a subscription renewal report
      operationId: GetSubscriptionRenewalReport
      description: Retrieve a subscription renewal report
      parameters:
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionRenewal'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/time-series-transaction:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a time series transactions report
      operationId: GetTimeSeriesTransactionReport
      description: Retrieve a transactions report aggregated by time periods
      parameters:
        - name: type
          in: query
          description: Report aggregation type
          required: true
          schema:
            type: string
            enum:
              - count
              - amount
              - approval-rate
              - incomplete-rate
        - name: subaggregate
          in: query
          description: Report subaggregate
          required: true
          schema:
            type: string
            enum:
              - website
              - gateway-account
              - currency
              - plan
              - leads.source
              - leads.medium
              - leads.campaign
              - leads.content
              - leads.term
              - leads.affiliate
              - leads.subaffiliate
              - leads.sales-agent
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeSeriesTransaction'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/transactions-plan:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve transactions with their plan data
      operationId: GetTransactionPlanReport
      description: Retrieve transactions with their plan data
      parameters:
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - name: Accept
          in: header
          description: The response media type
          schema:
            type: string
            enum:
              - application/json
              - text/csv
            default: application/json
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionsPlan'
            text/csv:
              schema:
                $ref: '#/components/schemas/TransactionsPlan'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/transactions-time-dispute:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a dispute delays in days report
      operationId: GetTransactionTimeDisputeReport
      description: >
        Retrieve a dispute delays in days report, how much time between a
        transaction and a dispute.
      parameters:
        - name: aggregationField
          in: query
          description: Report will be aggregated by this field
          required: true
          schema:
            type: string
            enum:
              - website
              - processor
              - currency
              - bin
              - country
              - rebillNumber
              - retryNumber
              - gatewayAccount
              - transactionAmount
        - name: periodStart
          in: query
          description: Report start date
          required: true
          schema:
            type: string
        - name: periodEnd
          in: query
          description: Report end date
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportDisputeDelays'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /reports/transactions:
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Reports
      summary: Retrieve a transactions report
      operationId: GetTransactionReport
      description: Retrieve a transactions report
      parameters:
        - name: periodStart
          in: query
          description: Report start day
          required: true
          schema:
            type: string
            format: date-time
        - name: periodEnd
          in: query
          description: Report end day
          required: true
          schema:
            type: string
            format: date-time
        - name: aggregationField
          in: query
          description: Report aggregation field
          required: true
          schema:
            type: string
            enum:
              - website
              - currency
              - bin
              - rebillNumber
              - transactionResult
              - transactionType
              - gatewayAccount
              - gateway
              - retryNumber
              - plan
              - leadSource.source
              - leadSource.medium
              - leadSource.campaign
              - leadSource.content
              - leadSource.term
              - leadSource.affiliate
              - leadSource.subAffiliate
              - leadSource.salesAgent
        - $ref: '#/components/parameters/collectionLimit'
        - $ref: '#/components/parameters/collectionOffset'
        - $ref: '#/components/parameters/collectionFilter'
      responses:
        '200':
          description: Report was retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
            Pagination-Total:
              $ref: '#/components/headers/Pagination-Total'
            Pagination-Limit:
              $ref: '#/components/headers/Pagination-Limit'
            Pagination-Offset:
              $ref: '#/components/headers/Pagination-Offset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportTransactions'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  '/subscriptions/{subscriptionId}/summary-metrics':
    servers:
      - url: 'https://api.rebilly.com/experimental'
      - url: 'https://api-sandbox.rebilly.com/experimental'
    parameters:
      - name: subscriptionId
        in: path
        required: true
        description: Subscription's ID
        schema:
          type: string
      - $ref: '#/components/parameters/organizationId'
    get:
      tags:
        - Subscriptions
      summary: Retrieve subscription summary metrics
      operationId: GetSubscriptionSummaryMetricReport
      description: |
        Retrieve subscription summary metrics
      responses:
        '200':
          description: Metrics were retrieved successfully
          headers:
            Rate-Limit-Limit:
              $ref: '#/components/headers/Rate-Limit-Limit'
            Rate-Limit-Remaining:
              $ref: '#/components/headers/Rate-Limit-Remaining'
            Rate-Limit-Reset:
              $ref: '#/components/headers/Rate-Limit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionSummaryMetrics'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
