{
  "openapi": "3.0.1",
  "info": {
    "title": "Order Payments",
    "version": "9.1.20.0",
    "description": "Create and administer order payments.",
    "x-introduced": "9.1.0.0"
  },
  "servers": [
    {
      "url": "https://{hostname}:{port}/rest/admin/v2",
      "variables": {
        "port": {
          "default": "443",
          "enum": [
            "443",
            "8000"
          ]
        },
        "hostname": {
          "default": "localhost",
          "enum": [
            "localhost",
            "test.hcl.com"
          ]
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Order Payments",
      "description": "Provide RESTful services to manage order payments."
    }
  ],
  "paths": {
    "/order-payments/create": {
      "post": {
        "tags": [
          "Order Payments"
        ],
        "summary": "Create an order payment instruction.",
        "description": "Create an order payment instruction.",
        "operationId": "OrderPayment-createOrderPayment",
        "parameters": [
          {
            "name": "storeId",
            "in": "query",
            "description": "The unique numeric ID for identifying the store.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "description": "Request body.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderPaymentCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The requested resource has been created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPaymentInstructionCreateResponse"
                }
              }
            },
            "links": {
              "getOrderPaymentById": {
                "operationRef": "#/paths~1~1order-payments~1{id}/get",
                "parameters": {
                  "id": "$response.body#/id",
                  "storeId": "$request.query.storeId"
                },
                "description": "The `id`&`storeId` value used in the request body can be used as the `id`,`storeId`parameter in `GET /order-payments/{id}`.\n"
              },
              "deleteOrderPayment": {
                "operationRef": "#/paths~1order-payments~1{id}/delete",
                "parameters": {
                  "id": "$response.body#/id",
                  "storeId": "$request.query.storeId",
                  "orderId": "$request.body#/orderId  "
                },
                "description": "The `id`,`orderId`,`storeId` value used in the request body can be used as the `id`,`orderId`,`storeId` parameter in `DELETE /order-payments/{id}`.\n"
              },
              "updateOrderPayment": {
                "operationRef": "#/paths~1order-payments~1{id}~1update/post",
                "parameters": {
                  "id": "$request.body#/orderId",
                  "storeId": "$request.query.storeId"
                },
                "description": "The `id`,`storeId` value used in the request body can be used as the `id`,`storeId` parameter in `PATCH /order-payments/{id}/update`.\n"
              }
            }
          },
          "400": {
            "description": "Bad request. The request could not be understood by the server due to malformed syntax.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. The user session is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "403": {
            "description": "The user is not authorized to perform the specified request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. For details, see the server log files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        },
        "x-codegen-request-body-name": "body"
      }
    },
    "/order-payments/{id}/update": {
      "post": {
        "tags": [
          "Order Payments"
        ],
        "summary": "Update an order payment instruction.",
        "description": "Update an order payment instruction.",
        "operationId": "OrderPayment-updateOrderPayment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique numeric ID for identifying the order item.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "storeId",
            "in": "query",
            "description": "The unique numeric ID for identifying the store.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "description": "Request body.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderPaymentUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The request has been completed successfully.",
            "content": {}
          },
          "400": {
            "description": "Bad request. The request could not be understood by the server due to malformed syntax.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. The user session is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "403": {
            "description": "The user is not authorized to perform the specified request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found.",
            "content": {}
          },
          "500": {
            "description": "Internal server error. For details, see the server log files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        },
        "x-codegen-request-body-name": "body"
      }
    },
    "/order-payments/{id}": {
      "get": {
        "tags": [
          "Order Payments"
        ],
        "description": "Get an order payment instruction.",
        "operationId": "getOrderPaymentById",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique numeric ID for identifying the order payment instruction.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "storeId",
            "in": "query",
            "description": "The unique numeric ID for identifying the store.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "description": "The comma-separated set of properties to be returned. If no properties are specified, all properties are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "expand",
            "in": "query",
            "description": "The comma-separated set of related resources referenced in the links to be returned. If no related resources are specified, no related resources are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "The comma-separated set of properties which controls the order of the items being listed, prefixed by either (-) to sort by descending order, or optionally (+) to sort by ascending order. For example, sort=name,-d which means, order the items based on the name value in ascending order, then by the id value in descending order.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The order payment instruction.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPayment"
                }
              }
            }
          },
          "400": {
            "description": "There was a client error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "404": {
            "description": "The resource was not found.",
            "content": {}
          },
          "500": {
            "description": "There was a server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Order Payments"
        ],
        "summary": "Delete an order payment instruction.",
        "description": "Delete an order payment instruction.",
        "operationId": "OrderPayment-deleteOrderPayment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique numeric ID for identifying the order payment instruction.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "storeId",
            "in": "query",
            "description": "The unique numeric ID for identifying the store.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "orderId",
            "in": "query",
            "description": "The unique numeric ID for identifying the order.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The requested resource has been deleted.",
            "content": {}
          },
          "400": {
            "description": "Bad request. The request could not be understood by the server due to malformed syntax.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. The user session is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "403": {
            "description": "The user is not authorized to perform the specified request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. For details, see the server log files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      }
    },
    "/order-payments": {
      "get": {
        "tags": [
          "Order Payments"
        ],
        "description": "Get a collection of order payment instructions.",
        "operationId": "getOrderPayments",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The unique numeric ID for identifying the order payment instruction.",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "The total amount of the payment instruction.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "paymentMethod",
            "in": "query",
            "description": "The payment method of the payment instruction. for example, Visa, MasterCard, GiftCertificate.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "policyId",
            "in": "query",
            "description": "The payment policy ID of the payment method.",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "canceled",
            "in": "query",
            "description": "The flag indicates whether this payment instruction has been marked for deletion. 0 not marked for deletion. 1 marked for deletion.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "backendPaymentInstructionId",
            "in": "query",
            "description": "The associated backend payment instruction in the payments subsystem.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deprecated",
            "in": "query",
            "description": "This flag indicates whether this instruction has been deprecated. canceled instructions should not be deleted.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "dirty",
            "in": "query",
            "description": "This flag indicates if this Payment Instruction needs to be edited before it can be used again.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "humanEditable",
            "in": "query",
            "description": "If this payment instruction can have its amount changed by a customer request, this information is copied from the configuration when the payment instruction is created.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "maxAmount",
            "in": "query",
            "description": "The maximum amount that can be used from this payment instruction(if editable, this threshold cannot be crossed), this information is copied from the configuration when the payment instruction is created.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "minAmount",
            "in": "query",
            "description": "The minimum amount that can be used from this payment instruction (if editable, this threshold cannot be crossed), this information is copied from the configuration when the payment instruction is created.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "description": "The rank of the priority against other types of payment instructions, this information is copied from the configuration when the payment instruction is created.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "sequenceNumber",
            "in": "query",
            "description": "The rank of the payment instruction against the other payment instructions in the EDPOrder.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "paymentRule",
            "in": "query",
            "description": "The name of the rule configuration of the associated payment method, this information is copied from the configuration when the payment instruction is created.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paymentSystem",
            "in": "query",
            "description": "The payment system that is to be used to process payment actions related to this payment instruction. for example, VisaNet, PaymentTech. This information is copied from the configuration when the payment instruction is created.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pending",
            "in": "query",
            "description": "This flag indicates, If a background payment thread is still working on this payment instruction, If the flag is true, the payment instruction cannot be used.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "refundAllowed",
            "in": "query",
            "description": "This flag indicates, If a Refund can be executed against an order that uses this payment instruction, If the flag is false, refunds are not allowed for the order, this information is copied from the configuration when the payment instruction is created.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "systemEditable",
            "in": "query",
            "description": "This flag indicates, If this payment instruction can have its amount changed by the system without checking with the customer, this information is copied from the configuration when the payment instruction is created.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "paymentConfigurationGroupId",
            "in": "query",
            "description": "The payment configuration group used by this payment instruction.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "field1",
            "in": "query",
            "description": "Customizable field 1.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "field2",
            "in": "query",
            "description": "Customizable field 2.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "field3",
            "in": "query",
            "description": "Customizable field 3.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "The position within the resulting dataset where the query begins returning item records. If the offset is \"5\", the records that returned begin with the sixth record that matches the query parameters. If the offset is \"0\", the records that are returned begin with the first record that matches the query parameters.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "The maximum number of records to return.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "description": "The comma-separated set of properties to be returned. If no properties are specified, all properties are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "expand",
            "in": "query",
            "description": "The comma-separated set of related resources referenced in the links to be returned. If no related resources are specified, no related resources are returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "The comma-separated set of properties which controls the order of the items being listed, prefixed by either (-) to sort by descending order, or optionally (+) to sort by ascending order. For example, sort=name,-d which means, order the items based on the name value in ascending order, then by the id value in descending order.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A collection of order payment instructions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPaymentCollection"
                }
              }
            }
          },
          "400": {
            "description": "There was a client error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "There was a server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Link": {
        "type": "object",
        "properties": {
          "href": {
            "type": "string",
            "description": "The URL of the link.",
            "format": "uri"
          }
        },
        "description": "Links to related resources."
      },
      "Error": {
        "type": "object",
        "properties": {
          "errorCode": {
            "type": "string",
            "description": "The error message code."
          },
          "errorMessage": {
            "type": "string",
            "description": "The error message."
          },
          "errorKey": {
            "type": "string",
            "description": "The error message key."
          },
          "errorParameters": {
            "type": "array",
            "description": "The arguments used to construct the error message.",
            "items": {
              "type": "object",
              "properties": {}
            }
          },
          "errorLevel": {
            "type": "string",
            "description": "The error level."
          },
          "errorHref": {
            "type": "string",
            "description": "The error hypertext reference."
          }
        },
        "description": "The error message item model."
      },
      "ErrorResponseContainer": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "The request identifier."
          },
          "errors": {
            "type": "array",
            "description": "The errors.",
            "items": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The error message model."
      },
      "OrderPaymentUpdate": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "integer",
            "description": "The unique numeric ID for identifying the order ID.",
            "format": "int64"
          },
          "userId": {
            "type": "integer",
            "description": "The unique numeric ID for identifying the user.",
            "format": "int32"
          },
          "billingAddressId": {
            "type": "integer",
            "description": "The unique numeric ID for identifying the customer's billing address.",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "description": "The total amount of the payment instruction."
          },
          "paymentMethod": {
            "type": "string",
            "description": "The payment method of the payment instruction. for example, Visa, MasterCard, GiftCertificate."
          },
          "paymentMethodId": {
            "type": "string",
            "description": "The payment method ID of the payment instruction."
          }
        },
        "description": "The order payment instruction."
      },
      "OrderPaymentCreate": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "integer",
            "description": "The unique numeric ID for identifying the order ID.",
            "format": "int64"
          },
          "userId": {
            "type": "integer",
            "description": "The unique numeric ID for identifying the user.",
            "format": "int32"
          },
          "billingAddressId": {
            "type": "integer",
            "description": "The unique numeric ID for identifying the customer's billing address.",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "description": "The total amount of the payment instruction."
          },
          "paymentMethod": {
            "type": "string",
            "description": "The payment method of the payment instruction. for example, Visa, MasterCard, GiftCertificate."
          },
          "paymentMethodId": {
            "type": "string",
            "description": "The payment method ID of the payment instruction."
          },
          "ccBrand": {
            "type": "string",
            "description": "The credit card brand for payment. for example, Visa, MasterCard."
          },
          "ccCvc": {
            "type": "string",
            "description": "The card verification number of the credit card."
          },
          "expiryMonth": {
            "type": "string",
            "description": "The expiry month of the payment method."
          },
          "expiryYear": {
            "type": "string",
            "description": "The expiry year of the payment method."
          },
          "account": {
            "type": "string",
            "description": "The account number for different payment method (credit Card number, checking account, gift certificate number, etc) an empty string means the payment instruction does not contain account numbers."
          }
        },
        "description": "The order payment instruction."
      },
      "OrderPayment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The unique numeric ID for identifying the order payment instruction.",
            "format": "int64"
          },
          "amount": {
            "type": "number",
            "description": "The total amount of the payment instruction."
          },
          "paymentMethod": {
            "type": "string",
            "description": "The payment method of the payment instruction. for example, Visa, MasterCard, GiftCertificate."
          },
          "policyId": {
            "type": "integer",
            "description": "The payment policy ID of the payment method.",
            "format": "int64"
          },
          "canceled": {
            "type": "boolean",
            "description": "The flag indicates whether this payment instruction has been marked for deletion. 0 not marked for deletion. 1 marked for deletion."
          },
          "backendPaymentInstructionId": {
            "type": "string",
            "description": "The associated backend payment instruction in the payments subsystem."
          },
          "deprecated": {
            "type": "boolean",
            "description": "This flag indicates whether this instruction has been deprecated. canceled instructions should not be deleted."
          },
          "dirty": {
            "type": "boolean",
            "description": "This flag indicates if this Payment Instruction needs to be edited before it can be used again."
          },
          "humanEditable": {
            "type": "boolean",
            "description": "If this payment instruction can have its amount changed by a customer request, this information is copied from the configuration when the payment instruction is created."
          },
          "maxAmount": {
            "type": "number",
            "description": "The maximum amount that can be used from this payment instruction(if editable, this threshold cannot be crossed), this information is copied from the configuration when the payment instruction is created."
          },
          "minAmount": {
            "type": "number",
            "description": "The minimum amount that can be used from this payment instruction (if editable, this threshold cannot be crossed), this information is copied from the configuration when the payment instruction is created."
          },
          "priority": {
            "type": "integer",
            "description": "The rank of the priority against other types of payment instructions, this information is copied from the configuration when the payment instruction is created.",
            "format": "int32"
          },
          "sequenceNumber": {
            "type": "integer",
            "description": "The rank of the payment instruction against the other payment instructions in the EDPOrder.",
            "format": "int32"
          },
          "paymentRule": {
            "type": "string",
            "description": "The name of the rule configuration of the associated payment method, this information is copied from the configuration when the payment instruction is created."
          },
          "paymentSystem": {
            "type": "string",
            "description": "The payment system that is to be used to process payment actions related to this payment instruction. for example, VisaNet, PaymentTech. This information is copied from the configuration when the payment instruction is created."
          },
          "pending": {
            "type": "boolean",
            "description": "This flag indicates, If a background payment thread is still working on this payment instruction, If the flag is true, the payment instruction cannot be used."
          },
          "refundAllowed": {
            "type": "boolean",
            "description": "This flag indicates, If a Refund can be executed against an order that uses this payment instruction, If the flag is false, refunds are not allowed for the order, this information is copied from the configuration when the payment instruction is created."
          },
          "systemEditable": {
            "type": "boolean",
            "description": "This flag indicates, If this payment instruction can have its amount changed by the system without checking with the customer, this information is copied from the configuration when the payment instruction is created."
          },
          "paymentConfigurationGroupId": {
            "type": "string",
            "description": "The payment configuration group used by this payment instruction."
          },
          "field1": {
            "type": "integer",
            "description": "Customizable field 1.",
            "format": "int32"
          },
          "field2": {
            "type": "string",
            "description": "Customizable field 2."
          },
          "field3": {
            "type": "string",
            "description": "Customizable field 3."
          },
          "links": {
            "type": "object",
            "properties": {
              "self": {
                "type": "object",
                "properties": {
                  "href": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "OrderPaymentInstructionCreateResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The unique numeric ID for identifying the order payment instruction.",
            "format": "int64"
          }
        },
        "description": "A response of create order payment instructions."
      },
      "OrderPaymentCollection": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "description": "The total number of items.",
            "format": "int64"
          },
          "href": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "description": "The items.",
            "items": {
              "$ref": "#/components/schemas/OrderPayment"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "basicAuth": []
    }
  ]
}
