{
  "openapi": "3.0.0",
  "info": {
    "title": "x-gateway-external-api",
    "contact": {}
  },
  "servers": [
    {
      "url": "https://api.xgateway.tech/api/v2"
    }
  ],
  "paths": {
    "/invoices": {
      "post": {
        "operationId": "CreateDepositInvoiceAsync",
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSuccessResponse_string_"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "data": "https://checkout.xgateway.tech/ff36a7a5-08fd-418a-a150-f6f2d36676a8",
                      "success": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Database violation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "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
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "forbidden",
                          "message": "The customer has KYC status HARD_KYC_FAILED"
                        }
                      ],
                      "success": false
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppValidationErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_string",
                          "message": "Expected unsigned numeric string, received invalid value",
                          "validation": "regex",
                          "path": [
                            "body",
                            "amount"
                          ]
                        }
                      ],
                      "success": false
                    }
                  },
                  "Example 2": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_type",
                          "expected": "string",
                          "received": "undefined",
                          "path": [
                            "card",
                            "cardNumber"
                          ],
                          "message": "Required"
                        }
                      ],
                      "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 an invoice using a fixed or floating exchange rate strategy.\r\nThe invoice is generated based on the provided parameters including amount, base currency, customer ID, order ID (optional).\r\n\r\nThis API creates an invoice and returns a checkout link, that should be served to a customer.\r\n\r\nIf `paymentCurrency` is provided and all required activation parameters for a specific payment are included\r\n(`customerFirstName`, `customerLastName`, `customerEmail`, `customerCountry`, `customerPhone`, `customerAccount`), the invoice is instantly activated.\r\n\r\nA base currency in this end point is the currency a customer will typically see on the merchant cashier page.\r\nExample: A customer wants to deposit 10 EUR of ETH. In this case the base currency is EUR.\r\n\r\nA payment currency is the currency that is actually deposited by the customer and available for settlement by the corresponding merchant.\r\nExample: A customer wants to deposit 10 EUR of ETH. In this case the payment currency is ETH.\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 an invoice for the customer for a specified currency and optional order id.",
        "tags": [
          "Invoice"
        ],
        "security": [
          {
            "api_key": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "description": "- The input data for creating an invoice.\r\n\r\n__Params__:\r\n- __amount__ - The amount. Must be greater than 0.\r\n- __applicationId__ - The associated application ID in your system.\r\n- __baseCurrency__ - The base currency.\r\n- __customerId__ - The customer ID in the your system.\r\n- __orderId__ - The associated order ID in the your system.\r\n- __invoiceStrategy__ - The invoice strategy. \"floating\" || \"fixed\"\r\n- __displayCurrencies__ - The list of currencies to display to the customer.\r\n- __customerAccount__ - The Customer Account number in payment system.\r\n- __customerCountry__ - The ISO 3166-1 alpha-2 country name.\r\n- __customerEmail__ -  The email address.\r\n- __customerFirstName__ - The first name.\r\n- __customerLastName__ - The last name.\r\n- __customerPhone__ - The phone number.\r\n- __customerDateOfBirth__ - The birth date.\r\n- __paymentCurrency__ - The currency in which the payment will be made.\r\n- __paymentMethod__ - The specific payment method code \"gateway0\" || \"gateway4_intent\"\r\n- __redirectUrl__ - The URL to which the customer will be redirected after completing checkout.\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__ -  2-character ISO-3166-1 country code.\r\n- __billingAddress.postalCode__ - Postal code.\r\n- __billingAddress.state__ - State code.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvoiceV2Input",
                "description": "- The input data for creating an invoice.\r\n\r\n__Params__:\r\n- __amount__ - The amount. Must be greater than 0.\r\n- __applicationId__ - The associated application ID in your system.\r\n- __baseCurrency__ - The base currency.\r\n- __customerId__ - The customer ID in the your system.\r\n- __orderId__ - The associated order ID in the your system.\r\n- __invoiceStrategy__ - The invoice strategy. \"floating\" || \"fixed\"\r\n- __displayCurrencies__ - The list of currencies to display to the customer.\r\n- __customerAccount__ - The Customer Account number in payment system.\r\n- __customerCountry__ - The ISO 3166-1 alpha-2 country name.\r\n- __customerEmail__ -  The email address.\r\n- __customerFirstName__ - The first name.\r\n- __customerLastName__ - The last name.\r\n- __customerPhone__ - The phone number.\r\n- __customerDateOfBirth__ - The birth date.\r\n- __paymentCurrency__ - The currency in which the payment will be made.\r\n- __paymentMethod__ - The specific payment method code \"gateway0\" || \"gateway4_intent\"\r\n- __redirectUrl__ - The URL to which the customer will be redirected after completing checkout.\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__ -  2-character ISO-3166-1 country code.\r\n- __billingAddress.postalCode__ - Postal code.\r\n- __billingAddress.state__ - State code."
              },
              "example": {
                "amount": 0.1,
                "applicationId": "ff36a7a5-08fd-418a-a150-f6f2d36676a8",
                "baseCurrency": "BNB",
                "customerAccount": "2004169722",
                "customerCountry": "AU",
                "customerEmail": "johndoe@gmail.com",
                "customerFirstName": "John",
                "customerId": "ff36a7a5-08fd-418a-a150-f6f2d36676a8",
                "customerLastName": "Doe",
                "customerPhone": "79111234567",
                "customerDateOfBirth": "2000-02-10",
                "orderId": "ff36a7a5-08fd-418a-a150-f6f2d36676a8",
                "invoiceStrategy": "floating",
                "displayCurrencies": "BNB",
                "paymentCurrency": "BNB",
                "paymentMethod": "gateway0",
                "redirectUrl": "https://example.com/redirect",
                "billingAddress": {
                  "addressLine1": "Hlavni mesto Praha 11 22",
                  "city": "Prague",
                  "countryCode": "CZ",
                  "postalCode": "15000",
                  "state": "Praha, Hlavni mesto"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AppSuccessResponse_string_": {
        "description": "The AppSuccessResponse object contains general information about the success execution.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": true
          },
          "data": {
            "type": "string"
          }
        },
        "required": [
          "success",
          "data"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "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
      },
      "Currency": {
        "type": "string",
        "enum": [
          "USDC",
          "USDT",
          "BNB",
          "bUSDT",
          "BTC",
          "ETH",
          "eUSDC",
          "eUSDT",
          "FTN",
          "POL",
          "pUSDC",
          "SOL",
          "sUSDT",
          "TRX",
          "tUSDC",
          "tUSDT",
          "wpUSDC",
          "wpUSDT",
          "EUR",
          "GBP",
          "AZN",
          "BDT",
          "INR",
          "JPY",
          "PKR",
          "RUB",
          "TRY",
          "UZS",
          "AUD",
          "BRL",
          "CAD",
          "CHF",
          "CZK",
          "DKK",
          "KES",
          "NOK",
          "NZD",
          "SEK",
          "USD"
        ],
        "description": "Represents all currencies in the payment processing system.\r\n\r\nUsed to specify the currency of accounts, exchange rates, and transactions in the payment\r\nprocessing system.\r\n\r\nIt provides a controlled and standardized list of supported currencies for all transactions and\r\nbalances in the payment processing system.\r\n\r\nNew currencies can be added to the payment processing system as additional members.\r\n\r\nSupported cryptocurrencies:\r\n- `BNB` - Binance Coin\r\n- `bUSDT` - Tether (pegged to USD), issued on BNB Smart Chain network (BEP20 token)\r\n- `BTC` - Bitcoin\r\n- `ETH` - Ether\r\n- `eUSDC` - USD Coin (pegged to USD), issued on Ethereum network (ERC20 token)\r\n- `eUSDT` - Tether (pegged to USD), issued on Ethereum network (ERC20 token)\r\n- `FTN` - Fasttoken\r\n- `POL` - POL\r\n- `pUSDC` - USD Coin (pegged to USD), issued on Polygon network (ERC20 token)\r\n- `SOL` - SOL\r\n- `sUSDT` - Tether (pegged to USD), issued on Solana network (SPL token)\r\n- `TRX` - Tronix (native coin), issued on Tron network\r\n- `tUSDC` - USD Coin (pegged to USD), issued on Tron network (TRC20 token)\r\n- `tUSDT` - Tether (pegged to USD), issued on Tron network (TRC20 token)\r\n- `wpUSDC` - wrapped USD Coin (pegged to USD), issued on Polygon network (ERC20 token)\r\n- `wpUSDT` - wrapped Tether (pegged to USD), issued on Polygon network (ERC20 token).\r\n\r\nSupported fiat currencies:\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."
      },
      "InvoiceStrategy": {
        "description": "Represents the possible strategies of an invoice.",
        "enum": [
          "floating",
          "fixed"
        ],
        "type": "string"
      },
      "CreateInvoiceV2Input": {
        "properties": {
          "accountId": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "applicationId": {
            "type": "string"
          },
          "baseCurrency": {
            "$ref": "#/components/schemas/Currency"
          },
          "customerAccount": {
            "type": "string"
          },
          "customerCountry": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string"
          },
          "customerFirstName": {
            "type": "string"
          },
          "customerId": {
            "type": "string"
          },
          "customerLastName": {
            "type": "string"
          },
          "customerPhone": {
            "type": "string"
          },
          "customerDateOfBirth": {
            "type": "string"
          },
          "displayCurrencies": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Currency"
              },
              {
                "items": {
                  "$ref": "#/components/schemas/Currency"
                },
                "type": "array"
              }
            ]
          },
          "invoiceStrategy": {
            "$ref": "#/components/schemas/InvoiceStrategy"
          },
          "locale": {
            "type": "string"
          },
          "orderId": {
            "type": "string"
          },
          "paymentCurrency": {
            "$ref": "#/components/schemas/Currency"
          },
          "paymentMethod": {
            "type": "string"
          },
          "redirectUrl": {
            "type": "string"
          },
          "billingAddress": {
            "properties": {
              "state": {
                "type": "string"
              },
              "postalCode": {
                "type": "string"
              },
              "countryCode": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "addressLine2": {
                "type": "string"
              },
              "addressLine1": {
                "type": "string"
              }
            },
            "required": [
              "state",
              "postalCode",
              "countryCode",
              "city",
              "addressLine1"
            ],
            "type": "object"
          }
        },
        "required": [
          "amount",
          "baseCurrency",
          "customerId"
        ],
        "type": "object",
        "additionalProperties": {}
      }
    },
    "securitySchemes": {
      "api_key": {
        "in": "header",
        "name": "x-api-key",
        "type": "apiKey"
      }
    }
  }
}