{
	"openapi": "3.0.1",
	"info": {
		"title": "PayNow 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/createOrder": {
			"post": {
				"tags": [
					"PayNow Service"
				],
				"summary": "Initiate IVR Payment Transaction",
				"description": "Use this method to initiate a new payment order for downstream processing with our payment processor.\nCreates an order (payment transaction) with the provided itemKey, transactionAmount, itemSku, and any additional identifying data. Returns an orderId that uniquely identifies the initiated payment.",
				"operationId": "createOrder",
				"requestBody": {
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/OrderRequest"
							}
						}
					},
					"required": true
				},
				"responses": {
					"200": {
						"description": "OK",
						"content": {
							"*/*": {
								"schema": {
									"$ref": "#/components/schemas/OrderResponse"
								}
							}
						}
					}
				},
				"security": [ { "BearerAuth": [] } ]
			}
		}
	},
	"components": {
		"schemas": {
			"OrderRequest": {
				"description": "The model of data items included in a Order Request.",
				"required": [
					"itemKey",
					"itemSku",
					"transactionAmount"
				],
				"type": "object",
				"properties": {
					"itemKey": {
						"type": "string",
						"description": "This is a unique identifier for the partner who is facilitating the payment and the product for which the payment is being made. This is generated by Civitek."
					},
					"transactionAmount": {
						"minimum": 1,
						"exclusiveMinimum": false,
						"type": "number",
						"description": "This is the payment amount."
					},
					"itemSku": {
						"type": "string",
						"description": "This is used to pass in any identifying data for the product for which the payment is being made e.g. Citation Number for a Traffic Fine payment."
					},
					"email": {
						"type": "string",
						"description": "Email of the customer making the payment. Optional."
					},
					"phone": {
						"type": "string",
						"description": "Phone number of the customer making the payment. Optional."
					},
					"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."
					},
					"company": {
						"type": "string",
						"description": "Name of the company if the customer making the payment is a business. Optional"
					},
					"attributes": {
						"type": "array",
						"description": "List of any additional data collected relating to the payment. Optional.",
						"items": {
							"$ref": "#/components/schemas/AttributeValue"
						}
					},
					"customerIdentities": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/CustomerIdentity"
						}
					}
				}
			},
			"OrderResponse": {
				"type": "object",
				"description": "The model of data items included in a Order Response.",
				"properties": {
					"orderId": {
						"type": "integer",
						"format": "int64",
						"description": "This is a unique identifier for the payment transaction. It is generated by Civitek and returned to the partner who initiated the payment."
					},
					"status": {
						"type": "string",
						"description": "This indicates the success or failure of creating an OrderId for the payment transaction.",
						"example": "success",
						"enum": [
							"success",
							"failed"
						]
					},
					"errorMessage": {
						"type": "string",
						"description": "This is an error message returned in case the OrderId could not be created. This will be null if the OrderId was created successfully."
					},
					"amount": {
						"type": "number",
						"description": "This is the payment amount that was passed in the Order Request."
					},
					"feeAmount": {
						"type": "number",
						"description": "This is the fee amount that is charged for processing the payment."
					},
					"totalAmount": {
						"type": "number",
						"description": "This is the total amount that is charged for the payment, including the fee amount."
					},
					"itemSku": {
						"type": "string",
						"description": "This is the SKU of the item for which the payment is being made. It is passed in the Order Request."
					}
				}
			},
			"AttributeValue": {
				"type": "object",
				"properties": {
					"attribute": {
						"type": "string",
						"description": "This is the name of the attribute being passed in."
					},
					"value": {
						"type": "string",
						"description": "This is the value of the attribute being passed in."
					}
				}
			},
			"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"
					}
				}
			}
		},
		"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>"
			}
		}
	}
}
