{
  "openapi": "3.0.0",
  "info": {
    "title": "x-gateway-external-api",
    "contact": {}
  },
  "servers": [
    {
      "url": "https://api.xgateway.tech/api/v2"
    }
  ],
  "paths": {
    "/gateway8": {
      "post": {
        "operationId": "CreateAndActivateDepositInvoice",
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSuccessResponse_CreateInvoiceResponse_"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "data": {
                        "threeDSURL": "https://example.com",
                        "message": "Invoice has been successfully activated. 3DS verification is required."
                      },
                      "success": true
                    }
                  },
                  "Example 2": {
                    "value": {
                      "data": {
                        "threeDSURL": null,
                        "message": "The invoice has been successfully finalized."
                      },
                      "success": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Database violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "bad_request",
                          "message": "Card details are invalid. Please check and try again."
                        }
                      ],
                      "success": false
                    }
                  },
                  "Example 2": {
                    "value": {
                      "errors": [
                        {
                          "code": "db_violation",
                          "message": "The request failed because it violated a database constraint."
                        }
                      ],
                      "success": false
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppAuthenticationErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "unauthorized",
                          "message": "You do not have permission to access this resource."
                        }
                      ],
                      "success": false
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "not_found",
                          "message": "The Account could not be found"
                        }
                      ],
                      "success": false
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppValidationErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_type",
                          "expected": "string",
                          "received": "undefined",
                          "path": [
                            "body",
                            "accountId"
                          ],
                          "message": "Required"
                        }
                      ],
                      "success": false
                    }
                  },
                  "Example 2": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_type",
                          "expected": "string",
                          "received": "undefined",
                          "path": [
                            "card",
                            "cardNumber"
                          ],
                          "message": "Required"
                        }
                      ],
                      "success": false
                    }
                  },
                  "Example 3": {
                    "value": {
                      "errors": [
                        {
                          "code": "too_small",
                          "minimum": 3,
                          "type": "string",
                          "inclusive": true,
                          "exact": false,
                          "message": "String must contain at least 3 character(s)",
                          "path": [
                            "card",
                            "cardSecurityCode"
                          ]
                        }
                      ],
                      "success": false
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "internal_server_error",
                          "message": "Something went wrong on our end. We're working on fixing it."
                        }
                      ],
                      "success": false
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Creates and activates a Gateway8 invoice for card payment processing.\r\n\r\nThis API creates an invoice and immediately activates it with the provided payment details.\r\nIf 3DS verification is required, a 3DS URL will be returned for customer authentication.\r\n\r\nAccess to this endpoint requires a valid API key. The API key is sent in the `x-api-key` header on requests.",
        "summary": "Create and activate a Gateway8 invoice with card payment details.",
        "tags": [
          "Gateway8"
        ],
        "security": [
          {
            "api_key": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "description": "- The input data for creating a Gateway8 invoice.\r\n\r\n__Params__:\r\n- __accountId__ - The account ID associated with the payment.\r\n- __amount__ - The amount.\r\n- __baseCurrency__ - The base currency.\r\n- __customerId__ - The customer ID in your system.\r\n- __applicationId__ - The associated application ID in your system.\r\n- __orderId__ - The associated order ID in your system.\r\n- __invoiceStrategy__ - The invoice strategy. \"floating\" || \"fixed\"\r\n- __redirectUrl__ - The URL to which the customer will be redirected after successful 3dsec verification. Must be a full URL including the protocol (e.g., https://yourdomain.com/path).\r\n- __customerEmail__ -  The customer email address.\r\n- __customerFirstName__ -  The customer first name.\r\n- __customerLastName__ -  The customer last name.\r\n- __customerPhone__ -  The customer phone number.\r\n- __customerDateOfBirth__ -  The customer birth date.\r\n- __userIp__ -  The customer IP address.\r\n- __billingAddress__ -  Full billing address for payment verification.\r\n- __billingAddress.addressLine1__ - Line 1 of the address (e.g., Number, street, etc).\r\n- __billingAddress.addressLine2__ - Line 2 of the address (e.g., Suite, apt).\r\n- __billingAddress.city__ - City name.\r\n- __billingAddress.countryCode__ - \u0421ountry code.\r\n- __billingAddress.postalCode__ - Postal code.\r\n- __billingAddress.state__ - State code.\r\n- __card__ -  Card payment details.\r\n- __card.cardholderName__ - The name on the card.\r\n- __card.cardNumber__ - The card number.\r\n- __card.cardSecurityCode__ - The CVV/CVC code (3-4 digits).\r\n- __card.expiryMonth__ - The card expiry month in MM format (01-12).\r\n- __card.expiryYear__ - The card expiry year in YYYY format.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvoiceGateway8Input",
                "description": "- The input data for creating a Gateway8 invoice.\r\n\r\n__Params__:\r\n- __accountId__ - The account ID associated with the payment.\r\n- __amount__ - The amount.\r\n- __baseCurrency__ - The base currency.\r\n- __customerId__ - The customer ID in your system.\r\n- __applicationId__ - The associated application ID in your system.\r\n- __orderId__ - The associated order ID in your system.\r\n- __invoiceStrategy__ - The invoice strategy. \"floating\" || \"fixed\"\r\n- __redirectUrl__ - The URL to which the customer will be redirected after successful 3dsec verification. Must be a full URL including the protocol (e.g., https://yourdomain.com/path).\r\n- __customerEmail__ -  The customer email address.\r\n- __customerFirstName__ -  The customer first name.\r\n- __customerLastName__ -  The customer last name.\r\n- __customerPhone__ -  The customer phone number.\r\n- __customerDateOfBirth__ -  The customer birth date.\r\n- __userIp__ -  The customer IP address.\r\n- __billingAddress__ -  Full billing address for payment verification.\r\n- __billingAddress.addressLine1__ - Line 1 of the address (e.g., Number, street, etc).\r\n- __billingAddress.addressLine2__ - Line 2 of the address (e.g., Suite, apt).\r\n- __billingAddress.city__ - City name.\r\n- __billingAddress.countryCode__ - \u0421ountry code.\r\n- __billingAddress.postalCode__ - Postal code.\r\n- __billingAddress.state__ - State code.\r\n- __card__ -  Card payment details.\r\n- __card.cardholderName__ - The name on the card.\r\n- __card.cardNumber__ - The card number.\r\n- __card.cardSecurityCode__ - The CVV/CVC code (3-4 digits).\r\n- __card.expiryMonth__ - The card expiry month in MM format (01-12).\r\n- __card.expiryYear__ - The card expiry year in YYYY format."
              },
              "example": {
                "amount": 100,
                "baseCurrency": "EUR",
                "accountId": "b5b1db5e-0751-4d55-83f8-b7c462ae029e",
                "customerId": "ff36a7a5-08fd-418a-a150-f6f2d36676a8",
                "customerEmail": "johndoe@gmail.com",
                "customerFirstName": "John",
                "customerLastName": "Doe",
                "customerPhone": "49 15123456789",
                "customerDateOfBirth": "2000-02-10",
                "userIp": "217.138.202.40",
                "billingAddress": {
                  "addressLine1": "Hlavni mesto Praha 11 22",
                  "city": "Prague",
                  "countryCode": "CZ",
                  "postalCode": "15000",
                  "state": "Praha, Hlavni mesto"
                },
                "card": {
                  "cardNumber": "4000 0000 0000 0002",
                  "cardholderName": "John Doe",
                  "expiryMonth": "12",
                  "expiryYear": "2028",
                  "cardSecurityCode": "444"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AppClientErrorResponseCode": {
        "type": "string",
        "enum": [
          "bad_request",
          "db_violation",
          "unauthorized",
          "payment_required",
          "forbidden",
          "not_found",
          "method_not_allowed",
          "not_acceptable",
          "proxy_authentication_required",
          "request_timeout",
          "conflict",
          "db_unique_violation",
          "gone",
          "length_required",
          "precondition_failed",
          "payload_too_large",
          "uri_too_long",
          "unsupported_media_type",
          "range_not_satisfiable",
          "expectation_failed",
          "misdirected_request",
          "unprocessable_content",
          "db_non_null_violation",
          "locked",
          "failed_dependency",
          "upgrade_required",
          "precondition_required",
          "too_many_requests",
          "request_header_fields_too_large",
          "unavailable_for_legal_reasons"
        ],
        "nullable": false,
        "description": "The AppClientErrorResponseCode object contains all client error response codes."
      },
      "AppServerErrorResponseCode": {
        "type": "string",
        "enum": [
          "internal_server_error",
          "not_implemented",
          "bad_gateway",
          "service_unavailable",
          "gateway_timeout",
          "http_version_not_supported",
          "variant_also_negotiates",
          "insufficient_storage",
          "loop_detected",
          "not_extended",
          "network_authentication_required"
        ],
        "nullable": false,
        "description": "The AppServerErrorResponseCode object contains all server error response codes."
      },
      "IAppError": {
        "description": "The IAppError interface represents an application error message.",
        "properties": {
          "code": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppClientErrorResponseCode"
              },
              {
                "$ref": "#/components/schemas/AppServerErrorResponseCode"
              }
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppErrorResponse": {
        "description": "The AppErrorResponse object contains general information about the error message.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": false
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/IAppError"
            },
            "type": "array"
          }
        },
        "required": [
          "success",
          "errors"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppAuthenticationErrorResponse": {
        "description": "The AppAuthenticationErrorResponse object contains general information about the authentication\r\nerror.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": false
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/IAppError"
            },
            "type": "array",
            "default": [
              {
                "code": "unauthorized",
                "message": "You do not have permission to access this resource."
              }
            ]
          }
        },
        "required": [
          "success",
          "errors"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppValidationErrorResponse": {
        "description": "The AppValidationErrorResponse object contains general information about the validation error.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": false
          },
          "errors": {
            "items": {},
            "type": "array"
          }
        },
        "required": [
          "success",
          "errors"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "InvoiceStrategy": {
        "description": "Represents the possible strategies of an invoice.",
        "enum": [
          "floating",
          "fixed"
        ],
        "type": "string"
      },
      "CreateInvoiceResponse": {
        "properties": {
          "threeDSURL": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "threeDSURL",
          "message"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppSuccessResponse_CreateInvoiceResponse_": {
        "description": "The AppSuccessResponse object contains general information about the success execution.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": true
          },
          "data": {
            "$ref": "#/components/schemas/CreateInvoiceResponse"
          }
        },
        "required": [
          "success",
          "data"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "FiatCurrency": {
        "type": "string",
        "enum": [
          "EUR",
          "GBP",
          "AZN",
          "BDT",
          "INR",
          "JPY",
          "PKR",
          "RUB",
          "TRY",
          "UZS",
          "AUD",
          "BRL",
          "CAD",
          "CHF",
          "CZK",
          "DKK",
          "KES",
          "NOK",
          "NZD",
          "SEK",
          "USD"
        ],
        "description": "Represents all fiat currencies in the payment processing system.\r\n\r\nCurrencies:\r\n- `AZN` - Azerbaijani Manat\r\n- `BDT` - Bangladeshi Taka\r\n- `EUR` - Euro\r\n- `GBP` - Pound Sterling\r\n- `INR` - Indian Rupee\r\n- `JPY` - Japanese Yen\r\n- `KES` - Kenyan Shilling\r\n- `PKR` - Pakistani Rupee\r\n- `RUB` - Russian Ruble\r\n- `TRY` - Turkish Lira\r\n- `USD` - United States Dollar\r\n- `UZS` - Uzbekistani Som."
      },
      "CreateInvoiceGateway8Input": {
        "properties": {
          "accountId": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "baseCurrency": {
            "$ref": "#/components/schemas/FiatCurrency"
          },
          "customerId": {
            "type": "string"
          },
          "invoiceStrategy": {
            "$ref": "#/components/schemas/InvoiceStrategy"
          },
          "orderId": {
            "type": "string"
          },
          "applicationId": {
            "type": "string"
          },
          "redirectUrl": {
            "type": "string"
          }
        },
        "required": [
          "accountId",
          "amount",
          "baseCurrency",
          "customerId"
        ],
        "type": "object",
        "additionalProperties": {}
      }
    },
    "securitySchemes": {
      "api_key": {
        "in": "header",
        "name": "x-api-key",
        "type": "apiKey"
      }
    }
  }
}