{
  "openapi": "3.0.1",
  "info": {
    "title": "PayKidz (Child Support) API Specifications",
    "version": "1.0.0",
    "description": "API to manage and track miscellaneous payment transactions.\n\nAuthentication:\n1. Obtain a JWT access token from the TPE Auth server using the TPE Auth API documented at https://civitek.github.io/open-api-docs/tpe-auth.html.\n2. Call the appropriate token endpoint, supplying your client credentials.\n3. Use the returned access token in the Authorization header for all secured PayNow API calls as: Authorization: Bearer <token>.\n\n"
  },
  "externalDocs": {
		"description": "TPE Auth Server API Documentation",
		"url": "https://civitek.github.io/open-api-docs/tpe-auth.html"
	},
  "servers": [
    {
      "url": "https:testapi.civikestpayment.com",
      "description": "Generated server url"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  
  "paths": {
    "/payment/ivr": {
      "post": {
        "tags": [
          "Payment Service"
        ],
        "summary": "Initiate IVR Payment Transaction",
        "description": "This method is used to initiate child support payments via our payment processing service. It will accept a payment request that contains the type of payment, payment amount and any other identifying data. A new payment transaction will be initiated in the system with a unique Order Id. The method will return the Order Id.",
        "operationId": "ivrPayment",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IVRRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/IVRResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CustomerIdentity": {
        "type": "object",
        "properties": {
          "identityTypeId": {
            "type": "integer",
            "description": "Valid values: 1=SSN, 2=Passport, 4=Alien Registration Number for Identity One; 0=Other, 3=Driver’s License for Identity Two",
            "format": "int32",
            "example": 1
          },
          "value": {
            "type": "string"
          },
          "countryCode": {
            "type": "string",
            "description": "Country code",
            "example": "US"
          },
          "region": {
            "type": "string",
            "description": "Region/state code",
            "example": "CA"
          }
        }
      },
      "IVRCustomer": {
        "required": [
          "firstName",
          "lastName",
          "phone"
        ],
        "type": "object",
        "properties": {
          "firstName": {
            "type": "string",
            "description": "First Name of the customer making the payment. Optional."
          },
          "lastName": {
            "type": "string",
            "description": "Last Name of the customer making the payment. Optional."
          },
          "middleName": {
            "type": "string",
            "description": "Middle Name of the customer making the payment. Optional."
          },
          "phone": {
            "type": "string",
            "description": "Phone number of the customer making the payment. Optional."
          },
          "email": {
            "type": "string",
            "description": "Email of the customer making the payment. Optional."
          },
          "identities": {
            "type": "array",
            "description": "For payments greater than or equal to $3000.00 additional information is required. Submit two types with pertinent details.",
            "items": {
              "$ref": "#/components/schemas/CustomerIdentity"
            }
          }
        }
      },
      "IVRRequest": {
        "required": [
          "amount",
          "caseNumber",
          "customer",
          "firstName",
          "lastName",
          "ssn",
          "stateCode"
        ],
        "type": "object",
        "properties": {
          "stateCode": {
            "type": "string",
            "description": "State code is required (e.g., FL)."
          },
          "ssn": {
            "type": "string",
            "description": "SSN is requried."
          },
          "caseNumber": {
            "type": "string",
            "description": "Case or Account Number is required."
          },
          "firstName": {
            "type": "string",
            "description": "First name of the non-custodial parent is required."
          },
          "lastName": {
            "type": "string",
            "description": "Last name of the non-custodial parent is required."
          },
          "amount": {
            "minimum": 1,
            "exclusiveMinimum": false,
            "type": "number",
            "description": "Child Support Payment Amount. Rquired."
          },
          "customer": {
            "$ref": "#/components/schemas/IVRCustomer"
          }
        }
      },
      "IVRResponse": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "integer",
            "description": "A unique identifier for the payment transaction. It is generated by Civitek and returned to the partner who initiated the payment.",
            "format": "int64"
          },
          "status": {
            "type": "string",
            "description": "Indicates the success or failure in initiating a payment transaction and creating the OrderId.",
            "example": "success",
            "enum": [
              "success",
              "failed"
            ]
          },
          "errorMessage": {
            "type": "string",
            "description": "Text describing the error returned if payment transaction could not be initiated. This will be null if the status is success."
          },
          "amount": {
            "type": "number",
            "description": "Child support payment amount received in the IVR Request."
          },
          "feeAmount": {
            "type": "number",
            "description": "Amount charged as a fee for processing the payment."
          },
          "totalAmount": {
            "type": "number",
            "description": "Total amount charged for the payment, including the child support payment amount and fee amount."
          },
          "caseNumber": {
            "type": "string",
            "description": "Case number (Identifier) for the case for which the child support payment is being made. It is passed in the IVR Request."
          }
        }
      }
    },
		"securitySchemes": {
			"BearerAuth": {
				"type": "http",
				"scheme": "bearer",
				"bearerFormat": "JWT",
				"description": "Use the JWT access token issued by the TPE Auth server. Obtain a token via the TPE Auth API (see https://civitek.github.io/open-api-docs/tpe-auth.html) then include it as: Authorization: Bearer <token>"
			}
		}
  }
}