{
  "openapi": "3.1.0",
  "info": {
    "title": "Whish Pay QR",
    "version": "1.0.0",
    "description": "Generate a Whish Pay payment session returning a QR payload and six-digit code the customer scans or enters to pay from their Whish balance."
  },
  "servers": [
    {
      "url": "https://partner.api.sbx.whish.money/itel-service/api",
      "description": "Sandbox"
    },
    {
      "url": "https://api.whish.money/itel-service/api",
      "description": "Production"
    }
  ],
  "components": {
    "securitySchemes": {
      "channelAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "channel"
      },
      "secretAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "secret"
      },
      "websiteUrlAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "websiteUrl"
      }
    }
  },
  "security": [
    {
      "channelAuth": [],
      "secretAuth": [],
      "websiteUrlAuth": []
    }
  ],
  "paths": {
    "/payment/account/balance": {
      "get": {
        "summary": "Get account balance",
        "responses": {
          "200": {
            "description": "Standard response envelope.",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "code": null,
                  "dialog": null,
                  "actions": null,
                  "extra": null,
                  "data": {
                    "balance": 10439.0
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "User-Agent",
            "in": "header",
            "required": true,
            "description": "Identifies your application. Format: `AppName/version (website; contact-email)`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/payment/whish/session": {
      "post": {
        "summary": "Create a payment session",
        "description": "The `externalId` must be UNIQUE for every new transaction. It is a String, and it is the idempotency key: re-sending a value that was already used does NOT create a second transaction, it replays the original result. Only reuse the same `externalId` when you are deliberately retrying the very same transaction (for example after a timeout), and mint a new one for every genuinely new transaction. Here, reusing an externalId returns the existing active session rather than creating a new one.",
        "responses": {
          "200": {
            "description": "Standard response envelope.",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "code": null,
                  "dialog": null,
                  "actions": null,
                  "extra": null,
                  "retrieved": false,
                  "data": {
                    "session_id": 123456789,
                    "code": "583921",
                    "qr_payload": "https://api.sandbox.whish.money/pay/AbC123xY",
                    "expiry_time": "2026-06-30T12:10:00Z",
                    "status": "pending"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "User-Agent",
            "in": "header",
            "required": true,
            "description": "Identifies your application. Format: `AppName/version (website; contact-email)`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "amount": 10.0,
                "currency": "USD",
                "externalId": "ORDER-2026-0001",
                "invoice": "INV-2026-0001",
                "callbackUrl": "https://merchant.example/api/whish/payment-success?orderId=ORDER-2026-0001",
                "expiry": 10
              }
            }
          }
        }
      }
    },
    "/payment/collect/status": {
      "post": {
        "summary": "Get payment status",
        "responses": {
          "200": {
            "description": "Standard response envelope.",
            "content": {
              "application/json": {
                "example": {
                  "status": true,
                  "code": null,
                  "dialog": null,
                  "actions": null,
                  "extra": null,
                  "data": {
                    "collectStatus": "success",
                    "payerPhoneNumber": "96170123456"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "User-Agent",
            "in": "header",
            "required": true,
            "description": "Identifies your application. Format: `AppName/version (website; contact-email)`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "currency": "USD",
                "externalId": "ORDER-2026-0001"
              }
            }
          }
        }
      }
    }
  }
}