{
	"openapi": "3.0.0",
	"components": {
		"examples": {},
		"headers": {},
		"parameters": {},
		"requestBodies": {},
		"responses": {},
		"schemas": {
			"CurrencyType": {
				"type": "string",
				"enum": [
					"stablecoin",
					"fiat",
					"token"
				]
			},
			"CurrencyInfo": {
				"properties": {
					"ticker": {
						"type": "string"
					},
					"fullName": {
						"type": "string"
					},
					"network": {
						"type": "string"
					},
					"contractAddress": {
						"type": "string",
						"nullable": true
					},
					"type": {
						"$ref": "#/components/schemas/CurrencyType"
					},
					"icon": {
						"type": "string"
					},
					"iconDark": {
						"type": "string"
					},
					"internalTicker": {
						"type": "string"
					}
				},
				"required": [
					"ticker",
					"fullName",
					"network",
					"contractAddress",
					"type",
					"icon",
					"iconDark",
					"internalTicker"
				],
				"type": "object",
				"additionalProperties": false
			},
			"CountryInfo": {
				"properties": {
					"code": {
						"type": "string"
					},
					"name": {
						"type": "string"
					}
				},
				"required": [
					"code",
					"name"
				],
				"type": "object",
				"additionalProperties": false
			},
			"PublicMerchantInfo": {
				"properties": {
					"id": {
						"type": "string"
					},
					"email": {
						"type": "string"
					},
					"merchantName": {
						"type": "string",
						"nullable": true
					},
					"directorName": {
						"type": "string",
						"nullable": true
					},
					"website": {
						"type": "string",
						"nullable": true
					},
					"logo": {
						"type": "string",
						"nullable": true
					},
					"whitelabeling": {
						"type": "boolean"
					}
				},
				"required": [
					"id",
					"email",
					"merchantName",
					"directorName",
					"website",
					"logo",
					"whitelabeling"
				],
				"type": "object",
				"additionalProperties": false
			},
			"InvoiceType": {
				"type": "string",
				"enum": [
					"b2b",
					"b2c"
				]
			},
			"InvoiceStatus": {
				"type": "string",
				"enum": [
					"pending",
					"processing",
					"completed",
					"refund_processing",
					"failed",
					"expired",
					"refunded",
					"aml_check",
					"aml_block"
				]
			},
			"PublicCreatedInvoiceResponse": {
				"properties": {
					"created_at": {
						"type": "string",
						"format": "date-time"
					},
					"updated_at": {
						"type": "string",
						"format": "date-time"
					},
					"expires_at": {
						"type": "string",
						"format": "date-time",
						"nullable": true
					},
					"invoice_url": {
						"type": "string"
					},
					"id": {
						"type": "string"
					},
					"api_source": {
						"type": "string",
						"enum": [
							"billions",
							"cryptomus",
							null
						],
						"nullable": true
					},
					"type": {
						"$ref": "#/components/schemas/InvoiceType"
					},
					"status": {
						"$ref": "#/components/schemas/InvoiceStatus"
					},
					"merchant_id": {
						"type": "string"
					},
					"settlement_currency": {
						"type": "string",
						"nullable": true
					},
					"currency": {
						"type": "string",
						"nullable": true
					},
					"convert_currency": {
						"type": "string",
						"nullable": true
					},
					"amount": {
						"type": "string"
					},
					"final_amount": {
						"type": "string"
					},
					"merchant_fee": {
						"type": "string"
					},
					"network_and_other_fees": {
						"type": "string"
					},
					"merchant_receive_amount": {
						"type": "string"
					},
					"paid_amount": {
						"type": "string"
					},
					"callback_url": {
						"type": "string",
						"nullable": true
					},
					"success_url": {
						"type": "string",
						"nullable": true
					},
					"return_url": {
						"type": "string",
						"nullable": true
					},
					"order_no": {
						"type": "string",
						"nullable": true
					},
					"description": {
						"type": "string",
						"nullable": true
					}
				},
				"required": [
					"created_at",
					"updated_at",
					"expires_at",
					"invoice_url",
					"id",
					"api_source",
					"type",
					"status",
					"merchant_id",
					"settlement_currency",
					"currency",
					"convert_currency",
					"amount",
					"final_amount",
					"merchant_fee",
					"network_and_other_fees",
					"merchant_receive_amount",
					"paid_amount",
					"callback_url",
					"success_url",
					"return_url",
					"order_no",
					"description"
				],
				"type": "object",
				"additionalProperties": false
			},
			"PublicCreateInvoiceBody": {
				"properties": {
					"idempotencyKey": {
						"type": "string"
					},
					"currency": {
						"type": "string"
					},
					"amount": {
						"anyOf": [
							{
								"type": "number",
								"format": "double"
							},
							{
								"type": "string"
							}
						]
					},
					"type": {
						"$ref": "#/components/schemas/InvoiceType"
					},
					"order_no": {
						"type": "string"
					},
					"description": {
						"type": "string"
					},
					"autoconvert": {
						"type": "string"
					},
					"callbackUrl": {
						"type": "string"
					},
					"success_url": {
						"type": "string"
					},
					"return_url": {
						"type": "string"
					},
					"expiresAt": {
						"type": "string"
					}
				},
				"required": [
					"currency",
					"amount"
				],
				"type": "object",
				"additionalProperties": false
			},
			"CalculatedInvoiceFeeResult": {
				"properties": {
					"amount": {
						"type": "number",
						"format": "double"
					},
					"finalPrice": {
						"type": "number",
						"format": "double"
					},
					"fee": {
						"type": "number",
						"format": "double"
					},
					"summaryFee": {
						"type": "number",
						"format": "double"
					},
					"merchantReceiveAmount": {
						"type": "number",
						"format": "double"
					}
				},
				"required": [
					"amount",
					"finalPrice",
					"fee",
					"merchantReceiveAmount"
				],
				"type": "object",
				"additionalProperties": false
			},
			"PublicEstimateInvoiceFeesBody": {
				"properties": {
					"currency": {
						"type": "string"
					},
					"amount": {
						"anyOf": [
							{
								"type": "number",
								"format": "double"
							},
							{
								"type": "string"
							}
						]
					},
					"type": {
						"$ref": "#/components/schemas/InvoiceType"
					},
					"order_no": {
						"type": "string"
					},
					"description": {
						"type": "string"
					},
					"autoconvert": {
						"type": "string"
					}
				},
				"required": [
					"currency",
					"amount"
				],
				"type": "object",
				"additionalProperties": false
			},
			"PublicWithdrawalRequest": {
				"properties": {
					"id": {
						"type": "string"
					},
					"currency": {
						"type": "string"
					},
					"amount": {
						"type": "string"
					},
					"withdrawal_method_id": {
						"type": "number",
						"format": "double"
					},
					"status": {
						"type": "string"
					},
					"payout_processor_status": {
						"type": "string",
						"nullable": true
					},
					"payout_processor_tx_id": {
						"type": "string",
						"nullable": true
					},
					"created_at": {
						"type": "string",
						"format": "date-time"
					},
					"updated_at": {
						"type": "string",
						"format": "date-time"
					}
				},
				"required": [
					"id",
					"currency",
					"amount",
					"withdrawal_method_id",
					"status",
					"payout_processor_status",
					"payout_processor_tx_id",
					"created_at",
					"updated_at"
				],
				"type": "object",
				"additionalProperties": false
			},
			"CreateMerchantWithdrawalInput": {
				"properties": {
					"currency": {
						"type": "string"
					},
					"amount": {
						"anyOf": [
							{
								"type": "number",
								"format": "double"
							},
							{
								"type": "string"
							}
						]
					},
					"withdrawalMethodId": {
						"type": "number",
						"format": "double"
					}
				},
				"required": [
					"currency",
					"amount",
					"withdrawalMethodId"
				],
				"type": "object",
				"additionalProperties": false
			},
			"PublicRefundRequest": {
				"properties": {
					"id": {
						"type": "string"
					},
					"invoice_id": {
						"type": "string"
					},
					"type": {
						"type": "string"
					},
					"currency": {
						"type": "string"
					},
					"amount": {
						"type": "string"
					},
					"to_address": {
						"type": "string",
						"nullable": true
					},
					"withdraw_to_same_address": {
						"type": "boolean"
					},
					"status": {
						"type": "string"
					},
					"payout_processor_status": {
						"type": "string",
						"nullable": true
					},
					"payout_processor_tx_id": {
						"type": "string",
						"nullable": true
					},
					"created_at": {
						"type": "string",
						"format": "date-time"
					},
					"updated_at": {
						"type": "string",
						"format": "date-time"
					}
				},
				"required": [
					"id",
					"invoice_id",
					"type",
					"currency",
					"amount",
					"to_address",
					"withdraw_to_same_address",
					"status",
					"payout_processor_status",
					"payout_processor_tx_id",
					"created_at",
					"updated_at"
				],
				"type": "object",
				"additionalProperties": false
			},
			"CreateMerchantCryptoRefundInput": {
				"properties": {
					"invoiceId": {
						"type": "string"
					},
					"reason": {
						"type": "string"
					},
					"address": {
						"type": "string"
					},
					"withdrawToSameAddress": {
						"type": "boolean"
					}
				},
				"required": [
					"invoiceId"
				],
				"type": "object",
				"additionalProperties": false
			},
			"CreateMerchantFiatRefundInput": {
				"properties": {
					"invoiceId": {
						"type": "string"
					},
					"reason": {
						"type": "string"
					}
				},
				"required": [
					"invoiceId"
				],
				"type": "object",
				"additionalProperties": false
			}
		},
		"securitySchemes": {
			"ApiKeyAuth": {
				"type": "apiKey",
				"in": "header",
				"name": "x-api-key",
				"description": "Merchant API key"
			},
			"BearerAuth": {
				"type": "http",
				"in": "header",
				"scheme": "bearer",
				"bearerFormat": "JWT",
				"name": "Authorization",
				"description": "JWT Token or Bearer Token"
			}
		}
	},
	"info": {
		"title": "billions-backend",
		"version": "1.0.0",
		"license": {
			"name": "ISC"
		},
		"contact": {}
	},
	"paths": {
		"/public/v1/version": {
			"get": {
				"operationId": "GetVersion",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"type": "string"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [],
				"parameters": []
			}
		},
		"/public/v1/currencies": {
			"get": {
				"operationId": "Currencies",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"items": {
										"$ref": "#/components/schemas/CurrencyInfo"
									},
									"type": "array"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [],
				"parameters": []
			}
		},
		"/public/v1/countries": {
			"get": {
				"operationId": "Countries",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"items": {
										"$ref": "#/components/schemas/CountryInfo"
									},
									"type": "array"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [],
				"parameters": []
			}
		},
		"/public/v1/me": {
			"get": {
				"operationId": "Me",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PublicMerchantInfo"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": []
			}
		},
		"/public/v1/invoices/create": {
			"post": {
				"operationId": "CreateInvoice",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PublicCreatedInvoiceResponse"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/PublicCreateInvoiceBody"
							}
						}
					}
				}
			}
		},
		"/public/v1/invoices/estimateFees": {
			"post": {
				"operationId": "EstimateFees",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/CalculatedInvoiceFeeResult"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/PublicEstimateInvoiceFeesBody"
							}
						}
					}
				}
			}
		},
		"/public/v1/invoices/{id}": {
			"get": {
				"operationId": "GetInvoice",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PublicCreatedInvoiceResponse"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "id",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				]
			}
		},
		"/public/v1/invoices/byOrder/{order_no}": {
			"get": {
				"operationId": "GetInvoicesByOrderId",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"items": {
										"$ref": "#/components/schemas/PublicCreatedInvoiceResponse"
									},
									"type": "array"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [
					{
						"in": "path",
						"name": "order_no",
						"required": true,
						"schema": {
							"type": "string"
						}
					}
				]
			}
		},
		"/public/v1/withdrawals/create": {
			"post": {
				"operationId": "CreateWithdrawal",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"properties": {
										"request": {
											"$ref": "#/components/schemas/PublicWithdrawalRequest"
										}
									},
									"required": [
										"request"
									],
									"type": "object"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/CreateMerchantWithdrawalInput"
							}
						}
					}
				}
			}
		},
		"/public/v1/refunds/refundCrypto": {
			"post": {
				"operationId": "RefundCrypto",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"properties": {
										"request": {
											"$ref": "#/components/schemas/PublicRefundRequest"
										}
									},
									"required": [
										"request"
									],
									"type": "object"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/CreateMerchantCryptoRefundInput"
							}
						}
					}
				}
			}
		},
		"/public/v1/refunds/refundFiat": {
			"post": {
				"operationId": "RefundFiat",
				"responses": {
					"200": {
						"description": "Ok",
						"content": {
							"application/json": {
								"schema": {
									"properties": {
										"request": {
											"$ref": "#/components/schemas/PublicRefundRequest"
										}
									},
									"required": [
										"request"
									],
									"type": "object"
								}
							}
						}
					}
				},
				"tags": [
					"Public API"
				],
				"security": [
					{
						"ApiKeyAuth": []
					}
				],
				"parameters": [],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/CreateMerchantFiatRefundInput"
							}
						}
					}
				}
			}
		}
	},
	"servers": [
		{
			"url": "/"
		}
	]
}