{
  "openapi": "3.0.0",
  "info": {
    "title": "Dojo PCI API",
    "version": "2023-11-12",
    "description": "# Introduction\nThe Dojo PCI API is RESTful. It returns HTTP response codes to indicate errors. It also\naccepts and returns JSON in the HTTP body.\n\n## Base URLs\nUse the following base URL when making requests to the API:  https://pci-api.dojo.tech/ (TBD)\n\n## Authentication\nThe Dojo PCI API uses [Basic HTTP auth](https://en.wikipedia.org/wiki/Basic_access_authentication). You can generate API keys in [Developer Portal](https://developer.dojo.tech).\nSecret keys for the test environment have the prefix `sk_sandbox_` and for production have the prefix `sk_prod_`.\nYou must include your secret API key in the header of all requests, for example:\n\n```curl\ncurl\n  --header 'content-type: application/json' \\\n  --header 'Authorization: Basic sk_prod_your_key' \\\n...\n```\n\nAPI requests without authentication will fail.\n\n## HTTP Responses\n\nThe API returns standard HTTP response codes [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6) on each request to indicate the success or otherwise of API requests. HTTP status codes summary are listed below:\n* `200 OK`—The request was successful.\n* `201 Created`—The request was successful, and a new resource was created as a result.\n* `204 No Content`—The request was successful, but there is no content to send.\n* `400 Bad Request`—Bad request, probably due to a syntax error.\n* `401 Unauthorized`—Authentication required.\n* `403 Forbidden`—The API key doesn't have permissions.\n* `404 Not Found`—The resource doesn't exist.\n* `405 Method Not Allowed`—The request method is known by the server but isn't supported by the target resource.\n* `409 Conflict`—The request couldn't be completed because it conflicted with another request or the server's configuration.\n* `500`, `502`, `503`, `504` `Server Errors`—An error occurred with our API.\n\n## Errors\n\nDojo follows the error response format proposed in [RFC 7807](https://tools.ietf.org/html/rfc7807) also known as Problem Details for HTTP APIs. All errors are returned in the form of JSON.\n\n### Error Schema\n\nIn case of an error, the response object contains the following fields:\n* `errors` [object]—A human-readable explanation of errors.\n* `type` [string]—\nA URI reference RFC 3986 that identifies the problem type.\n* `title` [string]—A short, human-readable summary of the error.\n* `status` [integer]—The HTTP status code.\n* `detail` [string]—A human-readable message giving more details about the error. Not always present.\n* `traceId` [string]—The unique identifier of the failing request.\nThe following example shows a possible error response:\n\n```json\n{\n    \"errors\": {\n        \"Reference\": [\n            \"The Reference field is required.\"\n        ]\n    },\n    \"type\": \"https://tools.ietf.org/html/rfc7231#section-6.5.1\",\n    \"title\": \"One or more validation errors occurred.\",\n    \"status\": 400,\n    \"traceId\": \"00-a405f077df056a498323ffbcec05923f-aa63e6f4dbbc734a-01\",\n}\n```\n\n## Versioning\n\nDojo APIs use the yyyy-mm-dd API version-naming scheme. You have to pass the version as the `version` header in all API calls, for example:\n\n``` curl\ncurl\n  --header 'content-type: application/json' \\\n  --header 'Authorization: Basic sk_prod_your_key' \\\n  --header 'version: 2023-11-12' \\\n```",
    "termsOfService": "https://dojo.tech/legal/",
    "contact": {
      "name": "Dojo Developer Experience Team"
    }
  },
  "servers": [
    {
      "url": "https://pci-api.dojo.tech/"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "SetupIntents",
      "description": "Creates a payment intent to tokenize card details for later payments."
    }
  ],
  "paths": {
    "/setup-intents": {
      "post": {
        "tags": [
          "SetupIntents"
        ],
        "operationId": "SetupIntents_Create",
        "requestBody": {
          "x-name": "request",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSetupIntentRequest"
              }
            }
          },
          "required": true,
          "x-position": 1
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetupIntentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2022-04-07",
            "description": "The API version with format `yyyy-mm-dd`. The Current version is `2022-04-07`.\nToday's date will always give you the latest version. "
          }
        ],
        "summary": "Tokenize payment card details.",
        "description": "Tokenizes payment card details."
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "in": "header",
        "type": "apiKey",
        "name": "Authorization"
      }
    },
    "schemas": {
      "CreateSetupIntentRequest": {
        "type": "object",
        "description": "The setup intent request object.",
        "additionalProperties": false,
        "title": "CreateSetupIntentRequest",
        "required": [
          "reference"
        ],
        "properties": {
          "cardNumber": {
            "type": "string",
            "description": "A card number (or PAN) in clear text to be tokenized.",
            "nullable": true
          },
          "expiryDate": {
            "type": "string",
            "description": "The expiry date of the card in the format 'MM/YY'.\n",
            "nullable": true
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "A unique identifier for the payment. For example, `Order 236`."
          },
          "description": {
            "type": "string",
            "maxLength": 4096,
            "description": "Description of the setup intent.",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "A set of key-value pairs that you can use to store additional information.",
            "nullable": true
          }
        }
      },
      "SetupIntentStatus": {
        "type": "string",
        "description": "Current status of the setup intent.",
        "x-enumNames": [
          "Created",
          "Authorized",
          "Canceled",
          "Completed",
          "Expired",
          "CardExpired",
          "Closed"
        ],
        "enum": [
          "Created",
          "Authorized",
          "Canceled",
          "Completed",
          "Expired",
          "CardExpired",
          "Closed"
        ]
      },
      "SetupIntentResponse": {
        "type": "object",
        "title": "SetupIntentResponse",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "nullable": true,
            "description": "The unique identifier for the setup intent."
          },
          "status": {
            "$ref": "#/components/schemas/SetupIntentStatus"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Created time stamp of the setup intent request."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Updated time stamp of the setup intent request."
          },
          "reference": {
            "type": "string",
            "description": "A unique identifier for the payment. For example, `Order 236`.",
            "nullable": true
          },
          "description": {
            "type": "string",
            "description": "Description of the setup intent.",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "A set of key-value pairs that you can use to store additional information.",
            "nullable": true
          }
        }
      },
      "ProblemDetails": {
        "type": "object",
        "title": "ProblemDetails",
        "description": "",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true,
            "description": "Card scheme for example: `Visa`, `Mastercard`, etc.\n"
          },
          "title": {
            "type": "string",
            "nullable": true,
            "description": "A short, human-readable summary of the error.\n"
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "The [HTTP status code](#section/Introduction/HTTP-Responses)."
          },
          "detail": {
            "type": "string",
            "nullable": true,
            "description": "A human-readable message giving more details about the error. This field is optional, so it's not always present. "
          },
          "traceId": {
            "type": "string",
            "nullable": true,
            "description": "The unique identifier of the failing request. This should be used to track the source of the error.\n"
          },
          "errors": {
            "type": "object",
            "nullable": true,
            "description": "A human-readable explanation of errors.",
            "additionalProperties": {}
          }
        }
      }
    }
  },
  "x-generator": "NSwag v13.12.1.0 (NJsonSchema v10.4.6.0 (Newtonsoft.Json v12.0.0.0))",
  "x-tagGroup": [
    {
      "name": "PCI API",
      "tags": [
        "Tokenization",
        "Payments",
        "PCI"
      ]
    }
  ]
}