{
  "openapi": "3.1.0",
  "info": {
    "title": "Whish Pay",
    "version": "1.4.3",
    "description": "Collect payments via Whish balance, track status, and issue refunds."
  },
  "servers": [
    {
      "url": "https://api.whish.money/itel-service/api",
      "description": "Production"
    },
    {
      "url": "https://api.sandbox.whish.money/itel-service/api",
      "description": "Sandbox"
    }
  ],
  "components": {
    "securitySchemes": {
      "channelAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "channel"
      },
      "secretAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "secret"
      },
      "websiteUrlAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "websiteUrl"
      },
      "UserAgentAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "User-Agent"
      }
    }
  },
  "security": [
    {
      "channelAuth": [],
      "secretAuth": [],
      "websiteUrlAuth": [],
      "UserAgentAuth": []
    }
  ],
  "paths": {
    "/payment/account/balance": {
      "get": {
        "summary": "Get balance",
        "responses": {
          "200": {
            "description": "Standard response envelope.",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "code": null,
                  "dialog": null,
                  "data": {
                    "balance": 10439.0
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/payment/whish": {
      "post": {
        "summary": "Post payment",
        "responses": {
          "200": {
            "description": "Standard response envelope.",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "code": null,
                  "dialog": null,
                  "data": {
                    "collectUrl": "https://whish.money/pay/8nQS2mL"
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "amount": "1",
                "currency": "USD",
                "invoice": "Order #1",
                "externalId": 1,
                "successCallbackUrl": "https://example.com/success",
                "failureCallbackUrl": "https://example.com/failure",
                "successRedirectUrl": "https://example.com/thanks",
                "failureRedirectUrl": "https://example.com/error"
              }
            }
          }
        }
      }
    },
    "/payment/collect/status": {
      "post": {
        "summary": "Get status",
        "responses": {
          "200": {
            "description": "Standard response envelope.",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "code": null,
                  "dialog": null,
                  "data": {
                    "collectStatus": "success",
                    "payerPhoneNumber": "96170902894"
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "currency": "USD",
                "externalId": 1
              }
            }
          }
        }
      }
    },
    "/payment/whish/refund": {
      "post": {
        "summary": "Post refund",
        "responses": {
          "200": {
            "description": "Standard response envelope.",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "code": null,
                  "dialog": null,
                  "data": null
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "currency": "USD",
                "externalId": 1,
                "refundReason": "Customer canceled order"
              }
            }
          }
        }
      }
    }
  }
}