openapi: 3.0.3
info:
  title: DMG APIs
  description: This is an API specification for DMG based on the OpenAPI 3.0 specification.
  contact:
    email: ecomm@datameshgroup.com
  version: '2.4'
servers:
  - url: /
tags:
  - name: Charge
    description: API to manage charging a 'payment instrument' for an 'order' using a 'flow' that is part of an 'orchestration'
security:
  - bearerAuth: []
paths:
  /charge:
    post:
      tags:
        - Charge
      summary: Create a `charge` that requests money from a `payment_instrument` for an order
      description: Charges manage all of the payment events that occur during the lifecycle of being paid for an order, and also collect various types of information such as order, customer, payment_instrument, payer and session.
      parameters:
        - name: action
          in: query
          description: The initial action for a new `charge`
          required: true
          style: form
          explode: true
          schema:
            type: string
            description: |
              Initial action for a newly created `charge`.
              initial charge actions:
               * `create` - Create a new `charge` on the system. Don't take any further action.
               * `validate` - Evaluate whether `charge` information, including `order`, `payment_instrument` and `session` information, are valid and sufficient.
               * `authorise` - Request to hold value on the `payment_instrument` for the `order` amount.
               * `complete` - Request to complete charging `payment` for the `order` amount.
            enum:
              - create
              - validate
              - authorise
              - complete
              - purchase
      requestBody:
        $ref: '#/components/requestBodies/charge'
      responses:
        '200':
          description: The `charge` response provides the status of the most recent `charge` event as well as ledger balances and tokens for the `payment`, `order`, and `settlement` (if available).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_response'
        '201':
          description: The pending `charge` response provides the pending status of the most recent `charge` event
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_response'
        '202':
          description: The money error `charge` response provides error information about the most recent `charge` event which had a money error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_money_error_response'
        '203':
          description: The connector error `charge` response provides error information about the most recent `charge` event which had a connector error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_connector_error_response'
        '211':
          description: The `charge` error response provides error information and the status of the `charge` as well as balances for the `payment`, `order`, and `settlement` (if available) ledgers.  Also provided are the token references for the associated `payment`, `order`, `session`, and `entity` tokens..
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_data_error_response'
        '400':
          description: The request error `charge` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system Connected to /charge.  Please notify DMG via support@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /charge/search:
    get:
      tags:
        - Charge
      summary: Search a list of `charge` that requests money from a `payment_instrument` for an order
      description: Charges manage all of the payment events that occur during the lifecycle of being paid for an order, and also collect various types of information such as order, customer, payment_instrument, payer and session.
      parameters:
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/order_token_query'
      responses:
        '200':
          description: The `charge` response provides the status of the most recent `charge` event as well as ledger balances and tokens for the `payment`, `order`, and `settlement` (if available).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/search_charge_response'
        '400':
          description: The request error `charge` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system Connected to /charge.  Please notify DMG via support@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /charge/{charge_id}:
    get:
      tags:
        - Charge
      summary: Take the next action with a previously created `charge`
      parameters:
        - name: charge_id
          in: path
          description: Id of the charge whose status is being reported
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: 8d556338-468d-4d12-bdc6-7ccb5781026d
      responses:
        '200':
          description: The `charge` response provides the status of the most recent `charge` event as well as ledger balances and tokens for the `payment`, `order`, and `settlement` (if available).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_response'
        '201':
          description: The pending `charge` response provides the pending status of the most recent `charge` event
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_response'
        '202':
          description: The money error `charge` response provides error information about the most recent `charge` event which had a money error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_money_error_response'
        '203':
          description: The connector error `charge` response provides error information about the most recent `charge` event which had a connector error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_connector_error_response'
        '211':
          description: The `charge` error response provides error information and the status of the `charge` as well as balances for the `payment`, `order`, and `settlement` (if available) ledgers.  Also provided are the token references for the associated `payment`, `order`, `session`, and `entity` tokens..
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_data_error_response'
        '400':
          description: The request error `charge` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
    post:
      tags:
        - Charge
      summary: Take the next action with a previously created `charge`
      parameters:
        - name: charge_id
          in: path
          description: Id of the charge whose status is being reported
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: 8d556338-468d-4d12-bdc6-7ccb5781026d
        - name: action
          in: query
          description: The next action for a new `charge` that was previously created.
          required: true
          style: form
          explode: true
          schema:
            type: string
            description: |
              Next action for an existing `charge`.

              next charge actions:
               * `validate` - Evaluate whether /charge information, including /order, /payment and session information, are valid and sufficient for this validation_mode.
               * `fund` - Holds value (when possible) on the /payment for the order_total or if not provided, the charge_total, but doesn't charge payment_type(s) provided.
               * `complete` - Complete /charge, and charge /payment for the order_total or if not provided, the charge_total.
               * `cancel` - Cancels /charge in whole, cancels /order (which must not have been completed in whole or in part), cancels /payment, and releases corresponding funds holds on /payment, if any.  If /payment is already payment_status:completed, automatically refunds /payment. REQUIRES a charge_id from a previous call.
               * `refund` - Refund the /charge for the amount of the refund_amount, adjusts order_total and payment_amount accordingly.  Automatically refunds /payment for the refund_amount. REQUIRES a charge_id from a previous call.
               * `update` - Make changes to the data in `charge`, including `payment`, `order` or `session`, but without taking any money movement actions.
            enum:
              - validate
              - authorise
              - complete
              - cancel
              - refund
              - update
      requestBody:
        $ref: '#/components/requestBodies/charge_update'
      responses:
        '200':
          description: The `charge` response provides the status of the most recent `charge` event as well as ledger balances and tokens for the `payment`, `order`, and `settlement` (if available).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_response'
        '201':
          description: The pending `charge` response provides the pending status of the most recent `charge` event
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_response'
        '202':
          description: The money error `charge` response provides error information about the most recent `charge` event which had a money error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_money_error_response'
        '203':
          description: The connector error `charge` response provides error information about the most recent `charge` event which had a connector error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_connector_error_response'
        '211':
          description: The `charge` error response provides error information and the status of the `charge` as well as balances for the `payment`, `order`, and `settlement` (if available) ledgers.  Also provided are the token references for the associated `payment`, `order`, `session`, and `entity` tokens..
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_data_error_response'
        '400':
          description: The request error `charge` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /entity_token:
    post:
      tags:
        - Entity Token
      summary: Place an entity item in our vault, and get a token back
      description: Securely stores details for people, businesses and organizations, and returns an entity_token that you can use anywhere entity details is required.
      requestBody:
        $ref: '#/components/requestBodies/entity_tokenize'
      responses:
        '200':
          description: Returns an `entity_token` including details and status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/entity_search_response'
        '400':
          description: The request error `charge` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /entity_token/{entity_token}:
    get:
      tags:
        - Entity Token
      parameters:
        - name: entity_token
          in: path
          description: Id of the entity token
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: 8d556338-468d-4d12-bdc6-7ccb5781026d
      summary: get the details of a entity_token
      description: Returns an `entity_token` including details and status.
      responses:
        '200':
          description: Returns an `entity_token` including details and status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/entity_search_response'
        '400':
          description: The request error `checkout` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
    post:
      tags:
        - Entity Token
      parameters:
        - name: entity_token
          in: path
          description: Id of the entity token
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: 8d556338-468d-4d12-bdc6-7ccb5781026d
      summary: Update an entity item in our vault, and get a token back
      description: Securely stores details for people, businesses and organizations, and returns an entity_token that you can use anywhere entity details is required.
      requestBody:
        $ref: '#/components/requestBodies/entity_tokenize'
      responses:
        '200':
          description: Returns an `entity_token` including details and status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/entity_search_response'
        '400':
          description: The request error `charge` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /entity/search:
    post:
      tags:
        - Entity
      summary: Search for entities and return with details and any saved payment_instrument(s)
      requestBody:
        $ref: '#/components/requestBodies/entity_search'
      responses:
        '200':
          description: The `entity` search response provides the entity(ies) associated with this seller that match the request criteria .
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/entity_search_response'
        '400':
          description: The request error `charge` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /payment_instrument:
    post:
      tags:
        - Payment Instrument
      summary: Securely vault payment_details and get a payment_token back.
      description: Securely stores payment_details, and returns a payment_token.  NOTE this endpoint does not perform validation, only storage/vaulting.  Use /checkout?action = validate if you want these payment_details validated by a payment_service.
      requestBody:
        description: Request definition to tokenize `payment` details which are primarily the instrument and related details including payer (`entity`), the `payment_verification` used to validate the `payment` instrument and your_payment_details that you want vaulted with this `payment_token`.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_payment_instrument_request'
      responses:
        '200':
          description: Returns a `payment_token` including details, related details, payer `entity` and status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/payment_instrument_response'
        '400':
          description: The request error `checkout` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /payment_instrument/{payment_token}:
    get:
      tags:
        - Payment Instrument
      parameters:
        - name: payment_token
          in: path
          description: Id of the charge whose status is being reported
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: 8d556338-468d-4d12-bdc6-7ccb5781026d
      summary: get the details of a payment_token
      description: Returns a `payment_token` including details, related details, payer `entity` and status.
      responses:
        '200':
          description: Returns a `payment_token` including details, related details, payer `entity` and status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/payment_instrument_response'
        '400':
          description: The request error `checkout` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
    post:
      tags:
        - Payment Instrument
      parameters:
        - name: payment_token
          in: path
          description: Id of the charge whose status is being reported
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: 8d556338-468d-4d12-bdc6-7ccb5781026d
      summary: Update a payment instrument
      description: Securely updates payment_details for this payment_token
      requestBody:
        description: Request definition to tokenize `payment` details which are primarily the instrument and related details including payer (`entity`), the `payment_verification` used to validate the `payment` instrument and your_payment_details that you want vaulted with this `payment_token`.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_payment_instrument_request'
      responses:
        '200':
          description: Returns a `payment_token` including details, related details, payer `entity` and status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/payment_instrument_response'
        '400':
          description: The request error `checkout` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /order_token:
    post:
      tags:
        - Order Token
      summary: Securely vault order_details and get an order_token back.
      description: Securely stores order_details, and returns an order_token.  NOTE this endpoint does not perform validation, only storage/vaulting.  Use /checkout?action = validate if you want these order_details validated by the vault or a connected business system.
      requestBody:
        description: Request definition to tokenize `order` details and related details including customer (`entity`).
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_order_token_request'
      responses:
        '200':
          description: Returns an `order_token` including details, related details, customer `entity` and status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/order_response'
        '400':
          description: The request error `checkout` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /order_token/{order_token}:
    get:
      tags:
        - Order Token
      parameters:
        - name: order_token
          in: path
          description: A unique reference to an order_token
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: 8d556338-468d-4d12-bdc6-7ccb5781026d
      summary: Get the details of an order_token
      description: Provides details about the order_token
      responses:
        '200':
          description: Returns an `order_token` including details, related details, customer `entity` and status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/order_response'
        '400':
          description: The request error `checkout` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
    post:
      tags:
        - Order Token
      requestBody:
        description: Request definition to tokenize `order` details and related details including customer (`entity`).
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_order_token_request'
      parameters:
        - name: order_token
          in: path
          description: A unique reference to an order_token
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: 8d556338-468d-4d12-bdc6-7ccb5781026d
      summary: Update an order_token
      description: Securely updates order details
      responses:
        '200':
          description: Returns an `order_token` including details, related details, customer `entity` and status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/order_response'
        '400':
          description: The request error `checkout` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/charge_request_error_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
  /public_key:
    get:
      tags:
        - Public Key
      summary: Get public key
      description: Public key is required to be able to send us encrypted material.
      responses:
        '200':
          description: Retrieve public key for use submitting encrypted details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/public_key_response'
        '500':
          description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_error'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    charge:
      additionalProperties: false
      type: object
      properties:
        charge_id:
          type: string
          description: Charge ID generated by us for your durable reference to this 'charge'
          format: UUID
          readOnly: true
          example: b0f5732b-4b42-4984-a939-31da972a6080
        order:
          $ref: '#/components/schemas/order_request'
        payments:
          type: array
          items:
            $ref: '#/components/schemas/payment_request'
        session:
          type: object
        your_charge_reference:
          type: string
    charge_request:
      allOf:
        - $ref: '#/components/schemas/charge'
        - properties:
            order:
              $ref: '#/components/schemas/order_request'
            payments:
              type: array
              items:
                $ref: '#/components/schemas/payment_request'
            session:
              $ref: '#/components/schemas/session_request'
    charge_update:
      allOf:
        - $ref: '#/components/schemas/charge'
        - properties:
            action_amount:
              description: The amount you want applied to this requested action, for example the amount of a refund.  If blank the entire order amount will be applied to this requested action.
              allOf:
                - $ref: '#/components/schemas/amount'
            order:
              $ref: '#/components/schemas/order_update'
            payments:
              type: array
              items:
                $ref: '#/components/schemas/update_payment_request'
            session:
              $ref: '#/components/schemas/session_update'
    order_update:
      oneOf:
        - type: object
          properties:
            details_format:
              type: string
              enum:
                - details
                - encrypted
            order_details:
              $ref: '#/components/schemas/order'
        - type: object
          properties:
            details_format:
              type: string
              enum:
                - reference
            order_details:
              $ref: '#/components/schemas/reference'
    payment_instrument_update:
      type: object
      properties:
        details_format:
          type: string
          enum:
            - details
            - encrypted
        instrument_type:
          $ref: '#/components/schemas/payment_instrument_types'
        instrument_details:
          $ref: '#/components/schemas/payment_instruments'
    session_update:
      type: object
      properties:
        details_format:
          type: string
          enum:
            - details
            - encrypted
        session_type:
          $ref: '#/components/schemas/session_types'
        session_details:
          oneOf:
            - $ref: '#/components/schemas/sessions'
            - $ref: '#/components/schemas/reference'
    payment_request:
      additionalProperties: false
      type: object
      required:
        - payment_instrument
      properties:
        payment_instrument:
          $ref: '#/components/schemas/payment_instrument_request'
        payment_verification:
          $ref: '#/components/schemas/payment_verification_request'
        payment_service:
          $ref: '#/components/schemas/payment_service'
        payment_amount:
          $ref: '#/components/schemas/amount'
        your_charge_details:
          nullable: true
          type: array
          description: A set of additional details, in the form of key value pairs, that you want stored along with this charge.
          items:
            $ref: '#/components/schemas/charge_your_charge_details'
    update_payment_request:
      type: object
      required:
        - payment_instrument
        - ledger_id
      properties:
        payment_instrument:
          $ref: '#/components/schemas/payment_instrument_request'
        payment_verification:
          $ref: '#/components/schemas/payment_verification_request'
        payment_service:
          $ref: '#/components/schemas/payment_service'
        payment_amount:
          $ref: '#/components/schemas/amount'
        ledger_id:
          type: string
          description: This is the unique identifier for this specific ledger within this specific checkout
          format: UUID
    payment_response:
      type: object
      properties:
        payment_instrument:
          $ref: '#/components/schemas/payment_instrument_response'
        payment_service:
          $ref: '#/components/schemas/payment_service'
        ledger_id:
          type: string
          description: This is the unique identifier for this specific ledger within this specific checkout
          format: UUID
        ledger_name:
          type: string
          description: the name of this `ledger` within the `checkout`
        ledger_type:
          $ref: '#/components/schemas/dmg_ledgers'
    reference_order_request:
      type: object
      additionalProperties: false
      properties:
        details_format:
          type: string
          enum:
            - reference
        order_details:
          $ref: '#/components/schemas/reference'
    details_order_request:
      type: object
      additionalProperties: false
      properties:
        details_format:
          type: string
          enum:
            - details
            - encrypted
        order_details:
          $ref: '#/components/schemas/order_details'
    details_order_token_request:
      type: object
      additionalProperties: false
      properties:
        details_format:
          type: string
          enum:
            - details
            - encrypted
        order_details:
          type: object
          additionalProperties: false
          properties:
            order:
              $ref: '#/components/schemas/order_details'
    order_request:
      oneOf:
        - $ref: '#/components/schemas/reference_order_request'
        - $ref: '#/components/schemas/details_order_request'
    order_details:
      $ref: '#/components/schemas/charge_order_details_request'
    create_order_token_request:
      additionalProperties: false
      type: object
      properties:
        order_request:
          $ref: '#/components/schemas/details_order_token_request'
    create_payment_instrument_request:
      additionalProperties: false
      type: object
      properties:
        payment_instrument:
          $ref: '#/components/schemas/detail_payment_instrument_request'
        payment_verification:
          $ref: '#/components/schemas/payment_verification_request'
    payment_service:
      required:
        - details
        - format
        - type
      properties:
        details: {}
        format:
          description: Format of the details being submitted for related to a token, either `details` (unencrypted) or `encrypted`
        type:
          type: string
          enum:
            - volvopay
            - volvopay_br
            - acmepay
            - dmg_india
    detail_payment_instrument_request:
      additionalProperties: false
      type: object
      required:
        - details_format
        - instrument_details
        - instrument_type
      properties:
        details_format:
          type: string
          enum:
            - details
        instrument_type:
          $ref: '#/components/schemas/payment_instrument_types'
        instrument_details:
          $ref: '#/components/schemas/payment_instrument_details'
    reference_payment_instrument_request:
      additionalProperties: false
      type: object
      required:
        - details_format
        - instrument_details
      properties:
        details_format:
          type: string
          enum:
            - reference
        instrument_type:
          $ref: '#/components/schemas/payment_instrument_types'
        instrument_details:
          $ref: '#/components/schemas/reference'
    encrypted_payment_instrument_request:
      additionalProperties: false
      type: object
      required:
        - details_format
        - instrument_details
      properties:
        details_format:
          type: string
          enum:
            - encrypted
        instrument_type:
          $ref: '#/components/schemas/payment_instrument_types'
        instrument_details:
          $ref: '#/components/schemas/encrypted_instrument_details'
    payment_instrument_request:
      oneOf:
        - $ref: '#/components/schemas/detail_payment_instrument_request'
        - $ref: '#/components/schemas/reference_payment_instrument_request'
        - $ref: '#/components/schemas/encrypted_payment_instrument_request'
    payment_instrument_details:
      allOf:
        - $ref: '#/components/schemas/payment_instruments'
        - properties:
            payer:
              $ref: '#/components/schemas/entity_request'
    encrypted_instrument_details:
      properties:
        instrument:
          type: string
        payer:
          $ref: '#/components/schemas/entity_request'
    payment_verification_request:
      oneOf:
        - $ref: '#/components/schemas/detail_payment_verification_request'
        - $ref: '#/components/schemas/encrypted_payment_verification_request'
    detail_payment_verification_request:
      additionalProperties: false
      type: object
      properties:
        details_format:
          type: string
          enum:
            - details
        verification_type:
          $ref: '#/components/schemas/payment_verification_types'
        verification_details:
          $ref: '#/components/schemas/payment_verifications'
    encrypted_payment_verification_request:
      additionalProperties: false
      type: object
      properties:
        details_format:
          type: string
          enum:
            - encrypted
        verification_type:
          $ref: '#/components/schemas/payment_verification_types'
        verification_details:
          type: string
    payment_verification_types:
      type: string
      enum:
        - card
        - db_houseTransfer_instrument
    payment_instrument_types:
      type: string
      enum:
        - card
        - netbanking
        - wallet_india
        - upi
        - db_houseTransfer_instrument
    session_request:
      additionalProperties: false
      type: object
      properties:
        details_format:
          type: string
          enum:
            - details
            - encrypted
            - reference
        session_type:
          $ref: '#/components/schemas/session_types'
        session_details:
          oneOf:
            - $ref: '#/components/schemas/sessions'
            - $ref: '#/components/schemas/reference'
    search_charge_response:
      type: object
      properties:
        offset:
          type: number
        max_offset:
          type: number
        results:
          type: array
          items:
            $ref: '#/components/schemas/charge_response'
    charge_response:
      allOf:
        - $ref: '#/components/schemas/charge'
        - properties:
            order:
              $ref: '#/components/schemas/order_response'
            session:
              $ref: '#/components/schemas/session_response'
            payments:
              type: array
              items:
                $ref: '#/components/schemas/payment_response'
            status:
              $ref: '#/components/schemas/charge_status'
            event:
              $ref: '#/components/schemas/charge_event'
            summary_amounts:
              $ref: '#/components/schemas/charge_summary_amounts'
            psp_responses:
              type: array
              items:
                $ref: '#/components/schemas/razorpay_card_psp_response'
    charge_error_response:
      allOf:
        - $ref: '#/components/schemas/charge'
        - properties:
            order:
              $ref: '#/components/schemas/order_response'
            session:
              $ref: '#/components/schemas/session_response'
            payments:
              type: array
              items:
                $ref: '#/components/schemas/payment_response'
            status:
              $ref: '#/components/schemas/charge_status'
            event:
              $ref: '#/components/schemas/charge_event'
            summary_amounts:
              $ref: '#/components/schemas/charge_summary_amounts'
            psp_responses:
              type: array
              items:
                $ref: '#/components/schemas/razorpay_card_psp_error_response'
    razorpay_card_psp_response:
      properties:
        type:
          type: string
          enum:
            - razorpay_card_instrument
        details:
          $ref: '#/components/schemas/card_psp_response_details'
      allOf:
        - $ref: '#/components/schemas/psp_response'
    razorpay_card_psp_error_response:
      properties:
        type:
          type: string
          enum:
            - razorpay_card_instrument
        details:
          $ref: '#/components/schemas/card_psp_response_details'
      allOf:
        - $ref: '#/components/schemas/psp_error_response'
    psp_response:
      type: object
      properties:
        psp_id:
          type: string
          description: id assigned to this `psp` by us.
          format: uuid
        psp_name:
          $ref: '#/components/schemas/psp_names'
        type:
          type: string
          description: Type of psp_response, which is directly related to the type of payment.
        details:
          type: object
          description: Response details specific to this payment type (and psp)
          x-DMG-type: psp_response
        response_time:
          type: string
          description: The delta between when DMG sends a request to psp and receives the response
      description: Contains information relating to the last raw response we received from the payment service provider. Authorization and decline codes are returned here, as well as other non sensitive status and return values.  No payment_details will ever be returned.
    psp_error_response:
      type: object
      properties:
        psp_id:
          type: string
          description: id assigned to this `psp` by us.
          format: uuid
        psp_name:
          $ref: '#/components/schemas/psp_names'
        type:
          type: string
          description: Type of psp_response, which is directly related to the type of payment.
        details:
          type: object
          description: Response details specific to this payment type (and psp)
          x-DMG-type: psp_response
        response_time:
          type: string
          description: The delta between when DMG sends a request to psp and receives the response
        psp_error:
          $ref: '#/components/schemas/psp_error'
      description: Contains information relating to the last raw response we received from the payment service provider. Authorization and decline codes are returned here, as well as other non sensitive status and return values.  No payment_details will ever be returned.
    psp_error:
      required:
        - error_class
        - error_type
        - error_retryable
        - error_message
      type: object
      properties:
        error_class:
          type: number
        error_type:
          oneOf:
            - $ref: '#/components/schemas/money_error_types'
            - $ref: '#/components/schemas/connector_error_types'
            - $ref: '#/components/schemas/data_error_types'
        error_data:
          type: object
        error_retryable:
          type: boolean
        error_message:
          type: string
        http_code:
          type: number
    psp_response_details:
      type: object
      properties:
        charge_responses:
          type: object
          description: Responses related to the `charge` request
        payment_instrument_response:
          type: object
          description: Responses related to the `payment_instrument`
        payment_verification_response:
          type: object
          description: Responses related to the `payment_verification`
        raw_message:
          type: object
          description: this is the raw message (unaltered) sent back by the psp
        status_code:
          type: string
          description: Depending on the psp interface, this is a code sent back directly in the response (http,soap,xml e.go)
      description: Response from the PSP regarding the `charge`, `payment_instrument`, `payment_verification`, and `payment_service` details.
    three_dee_ess:
      type: object
      properties:
        acs_url:
          type: string
          description: URL of the Issuer's Access Control System (ACS) challenge page.
        threeds_trans_id:
          type: string
          description: the identifier assigned by the issuer for the 3DS
        threeds_version:
          type: string
          description: the version of 3DS being used
        token_payload:
          type: string
          description: this is the element that must be added to the JWT payload to be generated for the challenge
        url_type:
          type: string
          enum:
            - threeds
      description: the required elements from 3DS provider in order for the merchant to present the challenge to the customer
    card_psp_response_details:
      properties:
        charge_responses:
          $ref: '#/components/schemas/card_psp_response_details_charge_responses'
        payment_instrument_response:
          $ref: '#/components/schemas/card_instrument_response'
        payment_verification_response:
          $ref: '#/components/schemas/card_verification_response'
      allOf:
        - $ref: '#/components/schemas/psp_response_details'
      x-DMG-type: psp_response
    card_instrument_response:
      type: object
      properties:
        lost_stolen_card_flag:
          type: boolean
          description: This flag indicates if this card has been reported lost or stolen
        prepaid_details:
          $ref: '#/components/schemas/card_instrument_response_prepaid_details'
        international_card_flag:
          type: boolean
          description: This flag indicates if this transaction was made with an international card
    card_verification_response:
      type: object
      properties:
        address_verification_response:
          allOf:
            - $ref: '#/components/schemas/psp_response_element'
            - description: This is the response code regarding the verification of the address via the AVS.
        card_verification_response:
          allOf:
            - $ref: '#/components/schemas/psp_response_element'
            - description: This is the response code regarding the verification of the card verification code (CVC/CVV).
        digital_verification_response:
          allOf:
            - $ref: '#/components/schemas/psp_response_element'
            - description: This is the response code regarding the verification of the digital session (3DS1/2).
        physical_verification_response:
          allOf:
            - $ref: '#/components/schemas/psp_response_element'
            - description: This is the response code regarding the verification of the physical card (EMV, Track 1/2/3).
    psp_response_element:
      type: object
      properties:
        status_code:
          type: string
          description: The latest payment service provider specific code returned during the processing of the payment
          example: ERR-103
        status_message:
          type: string
          description: The latest payment service provider specific message (human readable) returned during the processing of the payment
          example: Card lost or stolen
    psp_names:
      type: string
      enum:
        - razorpay
    order_response:
      allOf:
        - $ref: '#/components/schemas/order'
        - properties:
            customer:
              $ref: '#/components/schemas/entity_response'
    payment_instrument_response:
      type: object
      properties:
        instrument_type:
          $ref: '#/components/schemas/payment_instrument_types'
        instrument_details:
          allOf:
            - $ref: '#/components/schemas/payment_instruments'
            - properties:
                payer:
                  $ref: '#/components/schemas/entity_response'
    session_response:
      type: object
      properties:
        session_type:
          $ref: '#/components/schemas/session_types'
        session_details:
          $ref: '#/components/schemas/sessions'
    charge_request_error_response:
      $ref: '#/components/schemas/request_error'
    charge_money_error_response:
      allOf:
        - $ref: '#/components/schemas/charge_error_response'
        - $ref: '#/components/schemas/money_error'
    charge_data_error_response:
      allOf:
        - $ref: '#/components/schemas/charge_error_response'
        - $ref: '#/components/schemas/data_error'
    charge_connector_error_response:
      allOf:
        - $ref: '#/components/schemas/charge_error_response'
        - $ref: '#/components/schemas/connector_error'
    charge_status:
      type: object
      properties:
        status:
          type: string
          description: |
            charge status:
             * `not_created` - a request has been sent to create the charge and our system failed to create the record due to a techincal issue.
             * `pending_creation` - a request has been sent to create the charge and our system is waiting on a response.
             * `created` - /charge is created, and information provided has been securely stored.  No further actions have been taken (validation, authorisation, completion, settlement, etc.). This is the first state of the /charge. created -> validated.
             * `pending_validation` - a request has been sent to validate the charge and our system is waiting on a response.
             * `validated` - /order, /payment, and session information provided has been validated, sufficiently for this /charge's validation.  This is the second, successful, state of the /charge. 
             * `not_validated` - Missing or incorrect information provided for /order, /payment, or session for this /charge's validation requirements. This state means that /charge?action=validate was attempted but failed.
             * `pending_authorisation` - a request has been sent to fund the charge and our system is waiting on a response.
             * `authorised` - Funds have been authorised and held on the payment_type(s).  Payment_amount(s) of those holds are AT LEAST EQUAL to the order_amount. This is the third, successful, state of the /charge.
             * `not_authorised` - All /payment information provided has been validated, but sufficient funds have NOT been held on the payment_instrument.  Amounts of those funds holds across all payment_instruments are LESS THAN EQUAL to the order_amount, and COULD BE ZERO.  The amount of the holds is found in payment_amount. This state means that /charge?action=authorise was attempted but failed or only partially held the requested amount of funds.
             * `pending_completion` - a request has been sent to partially or wholely complete the charge and our system is waiting on a response.
             * `completed` - /charge is complete, /order has been fulfilled, and session is closed.  payment_type(s) have been charged for the payment_amount of the order_total.  /settlement is pending.  This is the fourth, successful, state of the /charge. 
             * `not_completed` - There is missing information, or the order_total and payment_amount are out of balance due an exception or only partial capture, therefore the total payment doesn't equal the order total.  The charge_response identifies missing information and status for /order, /payment, session, or other items.  This state means that /charge?action=complete was attempted, and failed OR partially captured payment for the order.
             * `pending_settlement` - the settlement started, but one or more amounts are pending (could be a PSP holdback period on the deposit)
             * `settled` - /payment associated with this /charge has settled.  /payment is now part of a /settlement, with associated settlement_id.  Payment_amount and order_total are equal to the deposit plus fees in the /settlement. This is the fifth, successful, state of the /charge. It can be entered multiple times, depending on refunds and reversals.
             * `settled_out_of_balance` - settlement has been finalized, but one or more ledgers are out of balance
             * `reconciled` - This /charge has been settled, with payment_amount and order_total are equal, and both are past the point where changes can be made.  Meaning the /order can not be refunded (initiated by you), and the /payment cannot be reversed (initiated by the payer).  There are no pending payment actions (such as a refund or exception or reversal).  This is the final and permanent state of a successful /charge.
              * `reconciled_out_of_balance` - settlement has been finalized and no further disputes or changes expected, but one or more ledgers are out of balance
             * `pending_cancelation` - a request has been sent to cancel the charge and our system is waiting on a response. 
             * `canceled` - charge was canceled.  Order is canceled, and was never completed in whole or in part.  The funds for the payment have been released.
             * `not_canceled` - A previous charge id was requested to be canceled and the final disposition was a denied auth cancel or never received.  The authorization on the card will remain.
            * `pending_refund` - a request has been sent to partially or wholely refund the charge and our system is waiting on a response.  
             * `refunded` - charge was refunded in total or partially.  Part or all of the order has been returned, and the payment refunded to the customer.  
             * `not_refunded` - A previous charge id was requested to be refunded (aka cancel a capture) and the final disposition was a denied a return. The settled payment for the order is not reversed.
             * `disputed` - a dispute has been settled and funds have been debited from the client's account.
             * `pending_dispute` - a dispute has been opend for investigation. No funds have been moved at this time
             * `unsupported` - The most recent requested action isn't supported by one or more of the ledgers in the charge.  The unsupported ledger is either unable or has been configured not to support that action.  This is not an error condition.  Please refer to the event and balance postings for more details.
          enum:
            - created
            - pending_creation
            - not_created
            - validated
            - pending_validation
            - not_validated
            - authorised
            - pending_authorisation
            - not_authorised
            - completed
            - pending_completion
            - not_completed
            - settled
            - pending_settlement
            - settled_out_of_balance
            - reconciled
            - reconciled_out_of_balance
            - pending_cancelation
            - canceled
            - not_canceled
            - pending_refund
            - refunded
            - not_refunded
            - open_dispute
            - dispute_finalised
            - unsupported
    order:
      type: object
      additionalProperties: false
      properties:
        service_id:
          type: string
          description: Identifier created by us for to identify the selling merchant
          format: UUID
        order_amount:
          $ref: '#/components/schemas/amount'
        customer:
          type: object
        orchestration_id:
          type: string
          description: Identifier for the Orchestration and set of Flows that will be used to manage charging a payment_instrument for this order.
          format: UUID
        your_order_reference:
          type: string
          description: Your reference for this order
        order_id:
          type: string
          description: Our identifier assigned for this order
          format: UUID
          readOnly: true
        order_line_items:
          type: array
          items:
            oneOf:
              - required:
                  - details_format
                  - order_line_item_type
                  - order_line_item_details
                type: object
                properties:
                  details_format:
                    type: string
                    enum:
                      - details
                  order_line_item_type:
                    type: string
                    enum:
                      - product_line_item
                  order_line_item_details:
                    type: array
                    items:
                      $ref: '#/components/schemas/product_line_items'
    charge_order_details_request:
      type: object
      additionalProperties: false
      properties:
        service_id:
          type: string
          description: Identifier created by us for to identify the selling merchant
          format: UUID
        order_amount:
          $ref: '#/components/schemas/amount'
        customer:
          $ref: '#/components/schemas/entity_request'
        orchestration_id:
          type: string
          description: Identifier for the Orchestration and set of Flows that will be used to manage charging a payment_instrument for this order.
          format: UUID
        your_order_reference:
          type: string
          description: Your reference for this order
        order_id:
          type: string
          description: Our identifier assigned for this order
          format: UUID
          readOnly: true
        order_line_items:
          type: array
          items:
            oneOf:
              - required:
                  - details_format
                  - order_line_item_type
                  - order_line_item_details
                type: object
                properties:
                  details_format:
                    type: string
                    enum:
                      - details
                  order_line_item_type:
                    type: string
                    enum:
                      - product_line_item
                  order_line_item_details:
                    type: array
                    items:
                      $ref: '#/components/schemas/product_line_items'
    line_item:
      type: object
      properties:
        line_number:
          type: integer
          description: Your line number, which reflects what you have in your order system.
        quantity:
          type: number
          description: May contain whole numbers and decimals
        unit_price:
          $ref: '#/components/schemas/amount'
        line_total:
          $ref: '#/components/schemas/amount'
        your_line_item_identifier:
          type: string
        your_description:
          type: string
    payment_instruments:
      additionalProperties: false
      type: object
      properties:
        instrument_id:
          type: string
          description: Identifier assigned by us to this instrument
          format: UUID
          readOnly: true
        instrument:
          oneOf:
            - $ref: '#/components/schemas/card_instrument'
            - $ref: '#/components/schemas/netbanking_instrument'
            - $ref: '#/components/schemas/wallet_india_instrument'
            - $ref: '#/components/schemas/upi_instrument'
            - $ref: '#/components/schemas/db_houseTransfer_instrument'
        payer:
          type: object
        saved_for_later:
          type: boolean
          description: Determines whether or not this payment_instrument should be available for future use (including returned in search)
        your_instrument_reference:
          type: string
          description: Your reference to this `payment_instrument` which will be stored in the `payment_token`.
    payment_verifications:
      type: object
      additionalProperties: false
      properties:
        verification:
          oneOf:
            - $ref: '#/components/schemas/card_verification'
    sessions:
      additionalProperties: false
      type: object
      properties:
        ip_address:
          type: string
          description: ip address of the session
        start_timestamp:
          type: string
          description: Timestamp at which the `session` started
          format: date-time
        finish_timestamp:
          type: string
          description: Timestamp at which the `session` finished
          format: date-time
        your_session_reference:
          type: string
          description: Your reference to this `session`
        session_id:
          type: string
          description: Identifier assigned by us to this session
          format: UUID
          readOnly: true
        session:
          oneOf:
            - $ref: '#/components/schemas/web'
    session_types:
      type: string
      enum:
        - web
    web:
      properties:
        language:
          type: string
          description: this is the preferred language on the display that will override the default
        device_identifier:
          type: string
        browser:
          $ref: '#/components/schemas/web_session_browser'
        your_success_return_url:
          description: The url that a redirecting system should return your user to, after a successful interaction with their system
          allOf:
            - $ref: '#/components/schemas/url'
        your_failure_return_url:
          description: The url that a redirecting system should return your user to, after a failed interaction with their system
          allOf:
            - $ref: '#/components/schemas/url'
        redirect_system_urls:
          type: array
          items:
            $ref: '#/components/schemas/web_redirect_system_urls'
        cookie:
          type: string
        payment_frame_size:
          allOf:
            - $ref: '#/components/schemas/two_dimensions'
            - description: Size of the frame used to render your payment details form (use -1 for fullpage)
    web_session_browser:
      type: object
      properties:
        user_agent:
          type: string
        accept_header:
          type: string
        java_enabled:
          type: boolean
        java_script_enabled:
          type: boolean
        language:
          type: string
          description: the navigator.language value of the shopper browser (as defined in IETF BCP 47
        time_zone_offset:
          type: integer
          description: time difference between UTC and the shopper browser local time in minutes
    url:
      required:
        - address
      type: object
      properties:
        address:
          type: string
          description: Fully formed URI
        call_type:
          type: string
          description: Http verb to use
          enum:
            - post
            - get
            - put
            - patch
            - delete
        query_parameters:
          type: array
          items:
            $ref: '#/components/schemas/url_query_parameters'
        headers:
          type: string
          description: Header string
      description: URLs are for redirects (to a payment method) or returns (from a payment method)
    url_query_parameters:
      type: object
      properties:
        key:
          type: string
        value:
          type: string
    two_dimensions:
      required:
        - height
        - width
      type: object
      properties:
        unit:
          type: string
          default: pixel
          enum:
            - pixel
        width:
          type: number
          example: 640
        height:
          type: number
          example: 480
    amount:
      additionalProperties: false
      type: object
      properties:
        value:
          type: integer
        currency:
          $ref: '#/components/schemas/currency'
    reference:
      type: string
      description: A UUID reference to previously submitted details that are stored in our system.
      format: UUID
    entity:
      type: object
      additionalProperties: true
      properties:
        your_entity_reference:
          type: string
        entity_id:
          type: string
          description: Identifier assigned by us to this entity.
          format: UUID
          readOnly: true
        entity_type:
          type: string
          enum:
            - person
            - organization
        entity:
          oneOf:
            - $ref: '#/components/schemas/person'
            - $ref: '#/components/schemas/organization'
    reference_entity_request:
      additionalProperties: false
      required:
        - details_format
        - entity_details
      type: object
      properties:
        details_format:
          type: string
          enum:
            - reference
        entity_type:
          $ref: '#/components/schemas/entity_types'
        entity_details:
          $ref: '#/components/schemas/reference'
    details_entity_request:
      additionalProperties: false
      required:
        - details_format
        - entity_details
        - entity_type
      type: object
      properties:
        details_format:
          type: string
          enum:
            - details
        entity_type:
          $ref: '#/components/schemas/entity_types'
        entity_details:
          $ref: '#/components/schemas/entity'
    entity_request:
      oneOf:
        - $ref: '#/components/schemas/details_entity_request'
        - $ref: '#/components/schemas/reference_entity_request'
    entity_response:
      type: object
      properties:
        entity_type:
          $ref: '#/components/schemas/entity_types'
        entity_details:
          $ref: '#/components/schemas/entity'
    entity_types:
      type: string
      enum:
        - person
        - organization
    entity_id:
      type: string
      description: Identifier assigned by us to this entity.
      format: UUID
      example: 8dadcb06-6390-4de0-b869-823667ddc9eb
    entity_search:
      required:
        - search_term
      type: object
      properties:
        search_type:
          type: string
          enum:
            - phone_number
            - email
            - entity_id
        search_term:
          oneOf:
            - $ref: '#/components/schemas/phone_number_search'
            - $ref: '#/components/schemas/email_search'
            - $ref: '#/components/schemas/entity_id'
      description: Provide either a phone number (in e.164 format) an email, or an entity_id.
    entity_search_response:
      type: array
      items:
        $ref: '#/components/schemas/entity_search_response_inner'
    phone_number_search:
      required:
        - e164_number
      type: object
      properties:
        e164_number:
          pattern: ^\+?[1-9]\d{1,14}$
          type: string
          description: Phone number in e.164 format.
      example:
        e164_number: '+919876543210'
    email_search:
      required:
        - email
      type: object
      properties:
        email:
          type: string
          format: email
          example: customer.name@gmail.com
    organization:
      properties:
        digital_addresses:
          description: One or more digital addresses for this entity of various types (e.g. email, website, server, facebook).
          type: array
          items:
            properties:
              details:
                type: string
              type:
                type: string
                enum:
                  - email
                  - website
                  - server
                  - facebook
                  - twitter
                  - linkedin
                  - alipay
              your_digital_address_reference:
                description: Your reference to this digital address.
                type: string
            additionalProperties: false
        govt_ids:
          description: One or more government ids for this entity of various types (e.g. social_security, drivers_license).
          type: array
          items:
            properties:
              details:
                type: object
                properties:
                  dates:
                    type: array
                    items:
                      type: object
                      properties:
                        details:
                          type: string
                          format: date
                        type:
                          type: string
                          enum:
                            - birthday
                            - issuance
                            - incorporation
                            - expiration
                      additionalProperties: false
                  id_acronym:
                    type: string
                    enum:
                      - SSN
                      - EIN
                      - DL
                      - CPF
                      - CNPJ
                      - CUIT
                      - DNI
                      - CI
                      - RUT
                      - CC
                      - CURP
                  identifier:
                    description: The unique identifier assigned by the issuer to this id.
                    type: string
                  identifier_mask:
                    description: The last 4 digits of the identifier.
                    type: string
                  issuing_country:
                    description: ISO-3166 Alpha-2 Country Code
                    type: string
                    enum:
                      - AF
                      - AX
                      - AL
                      - DZ
                      - AS
                      - AD
                      - AO
                      - AI
                      - AQ
                      - AG
                      - AR
                      - AM
                      - AW
                      - AU
                      - AT
                      - AZ
                      - BS
                      - BH
                      - BD
                      - BB
                      - BY
                      - BE
                      - BZ
                      - BJ
                      - BM
                      - BT
                      - BO
                      - BQ
                      - BA
                      - BW
                      - BV
                      - BR
                      - IO
                      - BN
                      - BG
                      - BF
                      - BI
                      - KH
                      - CM
                      - CA
                      - CV
                      - KY
                      - CF
                      - TD
                      - CL
                      - CN
                      - CX
                      - CC
                      - CO
                      - KM
                      - CG
                      - CD
                      - CK
                      - CR
                      - CI
                      - HR
                      - CU
                      - CW
                      - CY
                      - CZ
                      - DK
                      - DJ
                      - DM
                      - DO
                      - EC
                      - EG
                      - SV
                      - GQ
                      - ER
                      - EE
                      - ET
                      - FK
                      - FO
                      - FJ
                      - FI
                      - FR
                      - GF
                      - PF
                      - TF
                      - GA
                      - GM
                      - GE
                      - DE
                      - GH
                      - GI
                      - GR
                      - GL
                      - GD
                      - GP
                      - GU
                      - GT
                      - GG
                      - GN
                      - GW
                      - GY
                      - HT
                      - HM
                      - VA
                      - HN
                      - HK
                      - HU
                      - IS
                      - IN
                      - ID
                      - IR
                      - IQ
                      - IE
                      - IM
                      - IL
                      - IT
                      - JM
                      - JP
                      - JE
                      - JO
                      - KZ
                      - KE
                      - KI
                      - KP
                      - KR
                      - KW
                      - KG
                      - LA
                      - LV
                      - LB
                      - LS
                      - LR
                      - LY
                      - LI
                      - LT
                      - LU
                      - MO
                      - MK
                      - MG
                      - MW
                      - MY
                      - MV
                      - ML
                      - MT
                      - MH
                      - MQ
                      - MR
                      - MU
                      - YT
                      - MX
                      - FM
                      - MD
                      - MC
                      - MN
                      - ME
                      - MS
                      - MA
                      - MZ
                      - MM
                      - NA
                      - NR
                      - NP
                      - NL
                      - NC
                      - NZ
                      - NI
                      - NE
                      - NG
                      - NU
                      - NF
                      - MP
                      - 'NO'
                      - OM
                      - PK
                      - PW
                      - PS
                      - PA
                      - PG
                      - PY
                      - PE
                      - PH
                      - PN
                      - PL
                      - PT
                      - PR
                      - QA
                      - RE
                      - RO
                      - RU
                      - RW
                      - BL
                      - SH
                      - KN
                      - LC
                      - MF
                      - PM
                      - VC
                      - WS
                      - SM
                      - ST
                      - SA
                      - SN
                      - RS
                      - SC
                      - SL
                      - SG
                      - SX
                      - SK
                      - SI
                      - SB
                      - SO
                      - ZA
                      - GS
                      - SS
                      - ES
                      - LK
                      - SD
                      - SR
                      - SJ
                      - SZ
                      - SE
                      - CH
                      - SY
                      - TW
                      - TJ
                      - TZ
                      - TH
                      - TL
                      - TG
                      - TK
                      - TO
                      - TT
                      - TN
                      - TR
                      - TM
                      - TC
                      - TV
                      - UG
                      - UA
                      - AE
                      - GB
                      - US
                      - UM
                      - UY
                      - UZ
                      - VU
                      - VE
                      - VN
                      - VG
                      - VI
                      - WF
                      - EH
                      - YE
                      - ZM
                      - ZW
                  issuing_organization:
                    type: string
                additionalProperties: false
              type:
                type: string
                enum:
                  - national
                  - tax
                  - state/region/province
                  - corporate_license
              your_govt_id_reference:
                description: Your reference to this govt_id
                type: string
            additionalProperties: false
        names:
          description: One or more names for this entity, of various types (e.g. full_name, last_name).
          type: array
          items:
            properties:
              details:
                description: Content of this `name` for this `name_type`
                type: string
              type:
                type: string
                enum:
                  - full_name
                  - name_suffix
                  - name_prefix
                  - legal_name
                  - marketing_name
                  - trade_name
            additionalProperties: false
        phone_numbers:
          description: One or more phone numbers for this entity of various types (e.g. mobile, main)
          type: array
          items:
            properties:
              details:
                description: Phone number content
                type: object
                properties:
                  country_code:
                    description: International country code (e.g. UK is 44), digits only
                    type: string
                  e164_number:
                    description: Phone number in e164 format.  This is the field used for search on phone numbers.
                    type: string
                    pattern: ^\+?[1-9]\d{1,14}$
                  formatted_number:
                    description: The formatted phone number, including separators and country code (optionally).
                    type: string
                  unformatted_number:
                    description: 'Deprecated - use e164 number instead: Just the numbers for the phone number, without separators and without country code.'
                    type: integer
                additionalProperties: false
              type:
                type: string
                enum:
                  - main
                  - support
                  - store
                  - office
              your_phone_number_reference:
                description: Your reference to this phone number.
                type: string
            additionalProperties: false
        physical_addresses:
          description: One or more physical addresses for this entity of various types (e.g. billing, shipping)
          type: array
          items:
            properties:
              details:
                type: object
                properties:
                  city:
                    type: string
                  country:
                    description: ISO-3166 Alpha-2 Country Code
                    type: string
                    enum:
                      - AF
                      - AX
                      - AL
                      - DZ
                      - AS
                      - AD
                      - AO
                      - AI
                      - AQ
                      - AG
                      - AR
                      - AM
                      - AW
                      - AU
                      - AT
                      - AZ
                      - BS
                      - BH
                      - BD
                      - BB
                      - BY
                      - BE
                      - BZ
                      - BJ
                      - BM
                      - BT
                      - BO
                      - BQ
                      - BA
                      - BW
                      - BV
                      - BR
                      - IO
                      - BN
                      - BG
                      - BF
                      - BI
                      - KH
                      - CM
                      - CA
                      - CV
                      - KY
                      - CF
                      - TD
                      - CL
                      - CN
                      - CX
                      - CC
                      - CO
                      - KM
                      - CG
                      - CD
                      - CK
                      - CR
                      - CI
                      - HR
                      - CU
                      - CW
                      - CY
                      - CZ
                      - DK
                      - DJ
                      - DM
                      - DO
                      - EC
                      - EG
                      - SV
                      - GQ
                      - ER
                      - EE
                      - ET
                      - FK
                      - FO
                      - FJ
                      - FI
                      - FR
                      - GF
                      - PF
                      - TF
                      - GA
                      - GM
                      - GE
                      - DE
                      - GH
                      - GI
                      - GR
                      - GL
                      - GD
                      - GP
                      - GU
                      - GT
                      - GG
                      - GN
                      - GW
                      - GY
                      - HT
                      - HM
                      - VA
                      - HN
                      - HK
                      - HU
                      - IS
                      - IN
                      - ID
                      - IR
                      - IQ
                      - IE
                      - IM
                      - IL
                      - IT
                      - JM
                      - JP
                      - JE
                      - JO
                      - KZ
                      - KE
                      - KI
                      - KP
                      - KR
                      - KW
                      - KG
                      - LA
                      - LV
                      - LB
                      - LS
                      - LR
                      - LY
                      - LI
                      - LT
                      - LU
                      - MO
                      - MK
                      - MG
                      - MW
                      - MY
                      - MV
                      - ML
                      - MT
                      - MH
                      - MQ
                      - MR
                      - MU
                      - YT
                      - MX
                      - FM
                      - MD
                      - MC
                      - MN
                      - ME
                      - MS
                      - MA
                      - MZ
                      - MM
                      - NA
                      - NR
                      - NP
                      - NL
                      - NC
                      - NZ
                      - NI
                      - NE
                      - NG
                      - NU
                      - NF
                      - MP
                      - 'NO'
                      - OM
                      - PK
                      - PW
                      - PS
                      - PA
                      - PG
                      - PY
                      - PE
                      - PH
                      - PN
                      - PL
                      - PT
                      - PR
                      - QA
                      - RE
                      - RO
                      - RU
                      - RW
                      - BL
                      - SH
                      - KN
                      - LC
                      - MF
                      - PM
                      - VC
                      - WS
                      - SM
                      - ST
                      - SA
                      - SN
                      - RS
                      - SC
                      - SL
                      - SG
                      - SX
                      - SK
                      - SI
                      - SB
                      - SO
                      - ZA
                      - GS
                      - SS
                      - ES
                      - LK
                      - SD
                      - SR
                      - SJ
                      - SZ
                      - SE
                      - CH
                      - SY
                      - TW
                      - TJ
                      - TZ
                      - TH
                      - TL
                      - TG
                      - TK
                      - TO
                      - TT
                      - TN
                      - TR
                      - TM
                      - TC
                      - TV
                      - UG
                      - UA
                      - AE
                      - GB
                      - US
                      - UM
                      - UY
                      - UZ
                      - VU
                      - VE
                      - VN
                      - VG
                      - VI
                      - WF
                      - EH
                      - YE
                      - ZM
                      - ZW
                  line_1:
                    type: string
                  line_2:
                    type: string
                  line_3:
                    type: string
                  postal_code:
                    type: string
                  state_region_province:
                    type: string
                additionalProperties: false
              type:
                type: string
                enum:
                  - home
                  - billing
                  - shipping
                  - office
                  - legal
                  - headquarters
                  - store
              your_physical_address_reference:
                description: Your reference to this physical address.
                type: string
            additionalProperties: false
      additionalProperties: false
    person:
      additionalProperties: false
      required:
        - email
        - name
        - phone_number
      type: object
      properties:
        name:
          $ref: '#/components/schemas/person_name'
        addresses:
          type: array
          items:
            $ref: '#/components/schemas/address'
        email:
          $ref: '#/components/schemas/email'
        phone_number:
          $ref: '#/components/schemas/phone_number'
    email:
      type: string
      description: An email address for this entity.
      format: email
    phone_number:
      type: object
      properties:
        type:
          type: string
          enum:
            - mobile
            - home
            - office
            - main
            - support
            - store
        details:
          $ref: '#/components/schemas/phone_number_details'
        your_phone_number_reference:
          type: string
          description: Your reference to this phone number.
    address:
      type: object
      properties:
        type:
          type: string
          enum:
            - billing
            - shipping
        details:
          $ref: '#/components/schemas/address_details'
    netbanking_instrument:
      required:
        - bank_code
      type: object
      properties:
        bank_code:
          type: string
        bank_name:
          type: string
    db_houseTransfer_instrument:
      required:
        - account_num
        - account_bsb
        - account_country
        - account_name
        - your_instrument_reference
      type: object
      properties:
        account_num:
          type: string
        account_bsb:
          type: string
        account_country:
          type: string
        account_name:
          type: string
        your_instrument_reference:
          type: string
    wallet_india_instrument:
      additionalProperties: false
      required:
        - wallet_india_name
      type: object
      properties:
        wallet_india_name:
          type: string
          enum:
            - mobikwik
            - payzapp
            - olamoney
            - airtelmoney
            - freecharge
            - jiomoney
            - phonepe
            - paypal
    upi_instrument:
      additionalProperties: false
      required:
        - vpa
      type: object
      properties:
        vpa:
          type: string
    card_instrument:
      additionalProperties: false
      required:
        - card_number
        - expiration_date
      properties:
        card_number:
          pattern: ^[0-9]{12,19}$
          type: string
          writeOnly: true
          example: '4242424242424242'
        expiration_date:
          pattern: ^(?:0[1-9]|1[0-2])/[0-9]{2}$
          type: string
          example: 12/25
        card_function:
          $ref: '#/components/schemas/card_functions'
        country:
          allOf:
            - $ref: '#/components/schemas/country'
            - readOnly: true
        brand:
          allOf:
            - $ref: '#/components/schemas/card_brands'
            - readOnly: true
        card_last_four:
          type: string
          readOnly: true
    card_verification:
      additionalProperties: false
      type: object
      properties:
        card_verification_code:
          pattern: ^[0-9]{3,4}$
          type: string
          description: Plaintext card verification code
          writeOnly: true
          example: '123'
    card_functions:
      type: string
      description: functional capability of card (credit, debit, pre-paid)
      readOnly: true
      enum:
        - credit
        - debit
        - prepaid
        - atm
        - eft
    card_brands:
      type: string
      description: The brand of the card, representing the network that it can be processed on.
      enum:
        - visa
        - mastercard
        - american_express
        - discover
        - china_union_pay
        - carte_bancaire
        - diners_club
        - jcb
        - uatp
        - interac
        - nyce
        - star
        - pulse
    country:
      type: string
      description: ISO-3166 Alpha-2 Country Code
      example: US
      enum:
        - AF
        - AX
        - AL
        - DZ
        - AS
        - AD
        - AO
        - AI
        - AQ
        - AG
        - AR
        - AM
        - AW
        - AU
        - AT
        - AZ
        - BS
        - BH
        - BD
        - BB
        - BY
        - BE
        - BZ
        - BJ
        - BM
        - BT
        - BO
        - BQ
        - BA
        - BW
        - BV
        - BR
        - IO
        - BN
        - BG
        - BF
        - BI
        - KH
        - CM
        - CA
        - CV
        - KY
        - CF
        - TD
        - CL
        - CN
        - CX
        - CC
        - CO
        - KM
        - CG
        - CD
        - CK
        - CR
        - CI
        - HR
        - CU
        - CW
        - CY
        - CZ
        - DK
        - DJ
        - DM
        - DO
        - EC
        - EG
        - SV
        - GQ
        - ER
        - EE
        - ET
        - FK
        - FO
        - FJ
        - FI
        - FR
        - GF
        - PF
        - TF
        - GA
        - GM
        - GE
        - DE
        - GH
        - GI
        - GR
        - GL
        - GD
        - GP
        - GU
        - GT
        - GG
        - GN
        - GW
        - GY
        - HT
        - HM
        - VA
        - HN
        - HK
        - HU
        - IS
        - IN
        - ID
        - IR
        - IQ
        - IE
        - IM
        - IL
        - IT
        - JM
        - JP
        - JE
        - JO
        - KZ
        - KE
        - KI
        - KP
        - KR
        - KW
        - KG
        - LA
        - LV
        - LB
        - LS
        - LR
        - LY
        - LI
        - LT
        - LU
        - MO
        - MK
        - MG
        - MW
        - MY
        - MV
        - ML
        - MT
        - MH
        - MQ
        - MR
        - MU
        - YT
        - MX
        - FM
        - MD
        - MC
        - MN
        - ME
        - MS
        - MA
        - MZ
        - MM
        - NA
        - NR
        - NP
        - NL
        - NC
        - NZ
        - NI
        - NE
        - NG
        - NU
        - NF
        - MP
        - OM
        - PK
        - PW
        - PS
        - PA
        - PG
        - PY
        - PE
        - PH
        - PN
        - PL
        - PT
        - PR
        - QA
        - RE
        - RO
        - RU
        - RW
        - BL
        - SH
        - KN
        - LC
        - MF
        - PM
        - VC
        - WS
        - SM
        - ST
        - SA
        - SN
        - RS
        - SC
        - SL
        - SG
        - SX
        - SK
        - SI
        - SB
        - SO
        - ZA
        - GS
        - SS
        - ES
        - LK
        - SD
        - SR
        - SJ
        - SZ
        - SE
        - CH
        - SY
        - TW
        - TJ
        - TZ
        - TH
        - TL
        - TG
        - TK
        - TO
        - TT
        - TN
        - TR
        - TM
        - TC
        - TV
        - UG
        - UA
        - AE
        - GB
        - US
        - UM
        - UY
        - UZ
        - VU
        - VE
        - VN
        - VG
        - VI
        - WF
        - EH
        - YE
        - ZM
        - ZW
    currency:
      additionalProperties: false
      type: object
      properties:
        name:
          type: string
          readOnly: true
          example: US Dollars
        currency_code:
          $ref: '#/components/schemas/currency_code'
        decimal_places:
          type: integer
          readOnly: true
          example: 2
        separator:
          type: string
          readOnly: true
          example: .
        symbol:
          type: string
          readOnly: true
          example: $
    currency_code:
      type: string
      example: USD
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BOV
        - BRL
        - BSD
        - BTN
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHE
        - CHF
        - CHW
        - CLF
        - CLP
        - CNY
        - COP
        - COU
        - CRC
        - CUC
        - CUP
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ERN
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HRK
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - IQD
        - IRR
        - ISK
        - JMD
        - JOD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KPW
        - KRW
        - KWD
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - LYD
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MRU
        - MUR
        - MVR
        - MWK
        - MXN
        - MXV
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - OMR
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SDG
        - SEK
        - SGD
        - SHP
        - SLL
        - SOS
        - SRD
        - SSP
        - STN
        - SVC
        - SYP
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - USN
        - UYI
        - UYU
        - UYW
        - UZS
        - VES
        - VND
        - VUV
        - WST
        - XAF
        - XAG
        - XAU
        - XBA
        - XBB
        - XBC
        - XBD
        - XCD
        - XDR
        - XOF
        - XPD
        - XPF
        - XPT
        - XSU
        - XTS
        - XUA
        - XXX
        - YER
        - ZAR
        - ZMW
        - ZWL
        - AUD6
    system_error:
      type: object
      properties:
        error_code:
          type: string
        error_message:
          type: string
        error_reference:
          type: string
      description: Error that occured internally to the platform.  Generally these errors need to be reported for resolution.
    connector_error_types:
      type: string
      description: |
        * `communications_failure` -  Connector did not receive a response or had a timeout failure from the connected system.
        * `external_system_error` - Connector received a 5XX response pertaining to configurations or system errors from the connected system .
        * `connection_error` - Connector received a communications or connection error response from the connected system.
      enum:
        - communications_failure
        - connection_error
        - external_system_error
    connector_error:
      type: object
      properties:
        connector_error_type:
          $ref: '#/components/schemas/connector_error_types'
        error_message:
          type: string
      description: Error that occured between a Connector and the system to which it's connected. There is no further action, other than to wait for retry and/or reconnection.
    money_error_types:
      type: string
      description: |
        * `amount_over_limit` -  The posting attempted to this ledger exceeded the upper balance limt.
        * `amount_under_limit` -  The posting attempted to this ledger was less than the lower balance limt.
        * `unmet_condition` - Transition to the next state for this ledger failed, due to a necessary condition not being met.
        * `declined_or_refused` - An external system declined or refused to allow this request.
        * `risk_or_fraud_warning` - This request has been identified as incurring risk, or potential fraud.
        * 'dispute' - the payment is being disputed and chargedback
      enum:
        - amount_over_limit
        - amount_under_limit
        - unmet_condition
        - declined_or_refused
        - risk_or_fraud_warning
        - dispute
    money_error:
      required:
        - error_retryable
      type: object
      properties:
        money_error_type:
          $ref: '#/components/schemas/money_error_types'
        error_retryable:
          type: boolean
          description: Some ledger errors can be retried without changing tokens (e.g. `FUNDED` errors).  This flag indicates whether a retry is permitted for this error.
        error_message:
          type: string
    data_error_types:
      type: string
      description: |
        * `external_verification_error` - Details were sent to an external system for verification, and failed to be verified.
        * `expired` - Details have expired, new details are required.
        * `disabled` - These details were disabled previously.  Either create a new token or re-enable this one.
      enum:
        - external_verification_error
        - expired
        - disabled
    error_field:
      type: object
      properties:
        field_name:
          type: string
          description: Name of the field within the named schema.
      description: The field_name and field_definition of the field that has generated an error.
    request_error:
      type: array
      description: Your request has an error(s), either because the request did not match the schema, the token and/or related details to the token did not meet a schema or format requirement, or the token violates a relationship constraint between the parent token and related child details.  This error response provides the nature of the error, and identifies which field in which request body needs to be resubmitted.
      items:
        $ref: '#/components/schemas/request_error_inner'
    request_error_types:
      type: string
      description: |
        * `bad_reference` -  The unique reference for a token, ledger, or charge is either missing or incorrect.
        * `bad_type` -  The `type` you provided for the `details` is either missing or incorrect.
        * `format_error` -  /charge could not parse the `details` in your request.  Could be due to an encryption issue if you encrypted the `details`.
        * `relationship_error` - Required parent/token `details` or child/related `details` are missing or have an error.
        * `schema_validation_error` - `details` submitted in the request did not comply with the schema.
      enum:
        - format_error
        - schema_validation_error
        - relationship_error
        - bad_reference
        - bad_type
    data_error:
      type: object
      description: Your data has an error(s), either because the token and/or related details did not meet a schema or format requirement, the token violates a relationship constraint between the parent token and related child details, some or all of the data has expired or has been disabled, or the token failed verification from an external system, in whole or in part.  This error response provides the nature of the error, and identifies which fields in which schemas need to be resubmitted.
      properties:
        data_error:
          type: array
          items:
            $ref: '#/components/schemas/data_error_inner'
    charge_events_postings:
      type: object
      properties:
        events:
          type: array
          items:
            $ref: '#/components/schemas/charge_event_postings'
    charge_events:
      type: object
      properties:
        charge_id:
          type: string
          format: UUID
        summary_amounts:
          $ref: '#/components/schemas/charge_summary_amounts'
        events:
          type: array
          items:
            $ref: '#/components/schemas/charge_event'
    charge_event:
      required:
        - event_number
        - resulting_amount
        - resulting_balance
        - source
        - status
      type: object
      properties:
        event_number:
          type: integer
          description: The sequence number of this event in the lifecycle of the `charge`
        action:
          $ref: '#/components/schemas/charge_actions'
        requested_balance:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: This is the amount of the order_total requested during an initial or secondary action. This is the desired balance of the ledger after an action is completed.
        requested_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: This is the incremental amount requested during a secondary action on a charge. This is the desired amount of increase or decrease to the ledger balance after an action is completed.
        resulting_balance:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: This is the resulting balance of the payment ledger when an initial or secondary action is completed.
        resulting_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: This is the resulting amount of the posting to the payment ledger that requested action through the connector.
        source:
          type: string
          description: The location where the action origined; either charge/Core api, an external connector, or manual intervention.
          enum:
            - api
            - connector
            - manual
        status:
          $ref: '#/components/schemas/charge_status'
    charge_event_error:
      allOf:
        - $ref: '#/components/schemas/charge_event'
    charge_event_pending:
      allOf:
        - $ref: '#/components/schemas/charge_event'
    charge_event_postings:
      properties:
        postings:
          type: array
          items:
            $ref: '#/components/schemas/event_posting'
      allOf:
        - $ref: '#/components/schemas/charge_event'
    charge_summary_amounts:
      type: object
      properties:
        original_order_total:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Original total amount of the `order` (EXcluding `order` amount updates due to changes or refunds)
        current_order_total:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Current total amount of the `order` (INcluding `order` amount updates due to changes or refunds)
        funded_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Current amount of authorisation being held on `payment`(s) for the same amount of the `order`
        canceled_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Amount that has been canceled from this charge (lowering both `order` and `payment`(s)).
        completed_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Amount of both `payment`(s) and `order` that have been successfully completed
        refunded_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Amount that has been refunded in the `charge` (lowering `order`, `settlement` and `payment`(s)).
        settled_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Amount of `payment`(s) that have been settled, into various `settlement` ledgers, for a previously completed `order`.
        disputed_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Amount of `payment`(s) that have been disputed for a previously settled `order`.
        reconciled_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Final amount that has been booked for `payment`(s), `settlement` ledgers, and `order`.
        reversed_amount:
          allOf:
            - $ref: '#/components/schemas/amount'
            - description: Amount of `payment`(s) that have been reversed for a previously completed `order`.
        out_of_balance_amounts:
          type: array
          description: Reflects the difference between the current balance of the `order`, `payment`, and `settlement` based on the `charge` status. Will be zero (0), or simply not present in the response, when the ledgers are in balance.
          items:
            $ref: '#/components/schemas/charge_summary_amounts_out_of_balance_amounts'
      description: The summary amounts for the `charge` give a snapshot of the amounts that have flowed through the `charge` from the `payment`(s) as the source through the `settlement` ledger(s) to the `order`.
      readOnly: true
    charge_actions:
      type: string
      enum:
        - create
        - validate
        - authorise
        - complete
        - cancel
        - refund
        - update
    event_posting:
      required:
        - posting_number
      type: object
      properties:
        posting_number:
          type: integer
          description: This is the index number of the posting in the ledger
        ledger_id:
          type: string
          description: This is the unique identifier for this specific ledger within this specific checkout
          format: UUID
        ledger_name:
          type: string
          description: the name of this `ledger` within the `checkout`
        ledger_type:
          $ref: '#/components/schemas/dmg_ledgers'
        money_elements:
          $ref: '#/components/schemas/event_posting_money_elements'
        data_elements:
          $ref: '#/components/schemas/event_posting_data_elements'
      description: A posting is a made to either a `payment`, `order` or `settlement` ledger, and is the result of an `event` occuring within the `checkout` that caused an `action` to effect the data and/or the money associated with this `ledger`.
    dmg_ledgers:
      type: string
      readOnly: true
      enum:
        - payment
        - order
        - settlement
        - virtual
    ledger_states:
      type: string
      description: |
        ledger_states:
          The states that a `ledger` goes through during the course of accounting for a money flow.
        * `created` - The `ledger` has been initialized, but there is no balance and also no `postings`.
        * `validated` - The details associated with this `ledger` have been verified to be correct and permitted, often based on an external system response.  The balance for this state represents the permitted amount of money flow for this ledger, which may be a maximum value.
        * `funded` - The amount that is held, or reserved, on this `ledger` after it has been validated.  Can be zero for `ledger`s that don't support a holding or reservation concept. 
        * `completed` - The amount that is has been requested or instructed on this `ledger` to be moved, or settled in the next state.  If the prior state funded balance is greater than zero, then the difference in amounts between this state and the funded state represents the remaining amount of hold or reservation.
        * `settled` - The amount that is has been moved to, from, or through this `ledger` after that amount was previously completed.  The difference in amounts between this state and the completed state represents the remaining amount of settlement that is pending, in process, or not yet started.
        * `reconciled` - The amount that is agreed to be final in this `ledger` after it has been settled.  Once reconciled, this amount may not change. All possible reversals, exceptions, refunds, disputes, and any other means by which the amount could change must have expired.  The difference in amounts between this state and the settled state represents the remaining amount that is could change based on policy or process related to the money movement (e.g. a refund or dispute window is still open).      
      enum:
        - created
        - validated
        - funded
        - completed
        - settled
        - reconciled
    exchange:
      type: object
      properties:
        exchange_rate:
          type: number
        exchanged_currency:
          $ref: '#/components/schemas/currency_1'
    currency_1:
      type: object
      properties:
        name:
          type: string
          readOnly: true
          example: US Dollars
        currency_code:
          $ref: '#/components/schemas/currency_code'
        decimal_places:
          type: integer
          readOnly: true
          example: 2
        separator:
          type: string
          readOnly: true
          example: .
        symbol:
          type: string
          readOnly: true
          example: $
    card_psp_response_details_charge_responses:
      type: object
      properties:
        authorization_id:
          type: string
          description: id or code assigned by the issuer for this authorization request
        acquirer_response_code:
          type: string
          description: the raw acquirer response code to the authorization request
        network_unique_id:
          type: string
          description: Global or domestic network id assigned to the request by the network that handled the request
    card_instrument_response_prepaid_details:
      type: object
      properties:
        prepaid_card_flag:
          type: boolean
          description: This flag indicates if this transaction was made with a pre-paid card
        prepaid_available_balance:
          $ref: '#/components/schemas/amount'
    company_name:
      type: object
      additionalProperties: false
      properties:
        legal:
          type: string
        trade:
          type: string
    person_name:
      type: object
      additionalProperties: false
      properties:
        first:
          type: string
        middle:
          type: string
        last:
          type: string
        suffix:
          type: string
        prefix:
          type: string
        full_name:
          type: string
    phone_number_details:
      type: object
      properties:
        country_code:
          type: string
          description: International country code (e.g. UK is 44)
        unformatted_number:
          pattern: ^\+?[1-9]\d{1,14}$
          type: string
          description: Phone number in e164 format.  This is the field used for search on phone numbers.
        formatted_number:
          type: string
          description: The formatted phone number, including separators and country code (optionally).
      description: Phone number details
    address_details:
      type: object
      properties:
        line_1:
          type: string
          example: 2100 Alamo Rd
        line_2:
          type: string
          example: Suite T
        line_3:
          type: string
          example: mailbox 123
        postal_code:
          type: string
          example: '75080'
        city:
          type: string
          example: Richardson
        state_region_province:
          type: string
          example: TX
        country:
          $ref: '#/components/schemas/country'
        your_address_reference:
          type: string
          description: Your reference to this address.
    request_error_inner:
      type: object
      properties:
        error_location:
          type: string
          description: Location in request where the error occurred.
        error_type:
          $ref: '#/components/schemas/request_error_types'
        error_element:
          type: string
          description: Name of the property, field, or other element that has an error.
        error_message:
          type: string
          description: Brief message to describe the nature of this request error.
    data_error_inner:
      type: object
      properties:
        schema_name:
          type: string
          description: Schema name is what was supplied in the type field, and must match a valid schema within the API.
        error_type:
          $ref: '#/components/schemas/data_error_types'
        error_field:
          $ref: '#/components/schemas/error_field'
        error_message:
          type: string
    charge_summary_amounts_out_of_balance_amounts:
      type: object
      properties:
        out_of_balance_amount:
          $ref: '#/components/schemas/amount'
        out_of_balance_state:
          $ref: '#/components/schemas/ledger_states'
    event_posting_money_elements:
      required:
        - posting_amount
        - posting_type
        - resulting_ledger_balance
        - timestamp
      type: object
      properties:
        posting_amount:
          $ref: '#/components/schemas/amount'
        posting_type:
          type: string
          enum:
            - credit
            - debit
        state:
          $ref: '#/components/schemas/ledger_states'
        resulting_ledger_balance:
          $ref: '#/components/schemas/amount'
        exchange:
          $ref: '#/components/schemas/exchange'
        timestamp:
          type: string
          description: The timestamp of when this event was initiated.
          format: date-time
    event_posting_data_elements:
      required:
        - best_by_date
        - result
        - source
      type: object
      properties:
        source:
          type: string
          description: The source of the `posting`, whether or not the /Checkout `api`, `coin` operations, or an external `connector`.
          enum:
            - api
            - coin
            - connector
        result:
          type: string
          description: Result of this operation.
          enum:
            - success
            - failure
            - pending
        best_by_date:
          type: string
          description: The date
          format: date
    charge_your_charge_details:
      additionalProperties: false
      type: object
      properties:
        key:
          type: string
        value:
          type: string
    web_redirect_system_urls:
      type: object
      properties:
        url_type:
          type: string
          description: The type of url being provided to/by the redirect system, such as origin, submit, restart, cancel, and others.
        url:
          $ref: '#/components/schemas/url'
        url_description:
          type: string
          description: The description of this URL if provided by the system
    entity_search_response_inner:
      type: object
      properties:
        entity:
          $ref: '#/components/schemas/entity'
        saved_payment_instruments:
          type: array
          items:
            type: object
            properties:
              instrument_type:
                type: string
                enum:
                  - card
                  - upi
              instrument:
                $ref: '#/components/schemas/payment_instruments'
    line_item_details_product:
      properties:
        line_number:
          description: Your line number, which reflects what you have in your order system.
          type: integer
        quantity:
          description: May contain whole numbers and decimals
          type: number
        price:
          $ref: '#/components/schemas/amount'
        line_item_total:
          $ref: '#/components/schemas/amount'
        your_line_item_identifier:
          type: string
        your_description:
          type: string
        your_product_id:
          type: string
        SKU:
          type: string
        serial_number:
          type: string
        manufacturer:
          type: string
        model:
          type: string
        description:
          type: string
    product_line_items:
      oneOf:
        - $ref: '#/components/schemas/line_item_details_product'
    public_key_response:
      type: object
      properties:
        public_key:
          description: RSA
          type: string
  responses:
    charge:
      description: The `charge` response provides the status of the most recent `charge` event as well as ledger balances and tokens for the `payment`, `order`, and `settlement` (if available).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/charge_response'
    charge_pending:
      description: The pending `charge` response provides the pending status of the most recent `charge` event
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/charge_response'
    charge_request_error:
      description: The request error `charge` response provides error information about the most recent api request which contained a schema error.  Please review the error fields to determine how to resolve this error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/charge_request_error_response'
    charge_connector_error:
      description: The connector error `charge` response provides error information about the most recent `charge` event which had a connector error.  Please review the error fields to determine how to resolve this error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/charge_connector_error_response'
    charge_money_error:
      description: The money error `charge` response provides error information about the most recent `charge` event which had a money error.  Please review the error fields to determine how to resolve this error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/charge_money_error_response'
    charge_data_error:
      description: The `charge` error response provides error information and the status of the `charge` as well as balances for the `payment`, `order`, and `settlement` (if available) ledgers.  Also provided are the token references for the associated `payment`, `order`, `session`, and `entity` tokens..
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/charge_data_error_response'
    system_error:
      description: An error occurred either within /charge or externally in a system connected to /charge.  Please notify DMG IT Support via itsupport@datameshgroup.com
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/system_error'
    entity_search:
      description: Entity search response, including details and saved payment_instrument(s)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/entity_search'
  parameters:
    charge_initial_action:
      name: action
      in: query
      description: The initial action for a new `charge`
      required: true
      style: form
      explode: true
      schema:
        type: string
        description: |
          Initial action for a newly created `charge`.
          initial charge actions:
           * `create` - Create a new `charge` on the system. Don't take any further action.
           * `validate` - Evaluate whether `charge` information, including `order`, `payment_instrument` and `session` information, are valid and sufficient.
           * `authorise` - Request to hold value on the `payment_instrument` for the `order` amount.
           * `complete` - Request to complete charging `payment` for the `order` amount.
        enum:
          - create
          - validate
          - authorise
          - complete
    charge_next_action:
      name: action
      in: query
      description: The next action for a new `charge` that was previously created.
      required: true
      style: form
      explode: true
      schema:
        type: string
        description: |
          Next action for an existing `charge`.

          next charge actions:
           * `validate` - Evaluate whether /charge information, including /order, /payment and session information, are valid and sufficient for this validation_mode.
           * `fund` - Holds value (when possible) on the /payment for the order_total or if not provided, the charge_total, but doesn't charge payment_type(s) provided.
           * `complete` - Complete /charge, and charge /payment for the order_total or if not provided, the charge_total.
           * `cancel` - Cancels /charge in whole, cancels /order (which must not have been completed in whole or in part), cancels /payment, and releases corresponding funds holds on /payment, if any.  If /payment is already payment_status:completed, automatically refunds /payment. REQUIRES a charge_id from a previous call.
           * `refund` - Refund the /charge for the amount of the refund_amount, adjusts order_total and payment_amount accordingly.  Automatically refunds /payment for the refund_amount. REQUIRES a charge_id from a previous call.
           * `update` - Make changes to the data in `charge`, including `payment`, `order` or `session`, but without taking any money movement actions.
        enum:
          - validate
          - authorise
          - complete
          - cancel
          - refund
          - update
    order_token_query:
      name: order_token
      in: query
      description: A unique reference to an order_token
      schema:
        type: string
    limit:
      name: limit
      in: query
      description: The number of items to return in the response. RECOMMENDED input or default will be used.
      schema:
        type: integer
        format: int32
        minimum: 1
        maximum: 100
        default: 20
    offset:
      name: offset
      in: query
      description: The number of items to skip before returning the results. RECOMMENDED input or default will be used.
      schema:
        type: integer
        minimum: 0
        default: 0
  requestBodies:
    charge:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/charge_request'
      required: true
    charge_update:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/charge_update'
      required: true
    entity_search:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/entity_search'
      required: true
    entity_tokenize:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/entity'
      required: true