{
  "openapi": "3.0.1",
  "info": {
    "title": "Jupay",
    "description": "Jupay Api document \r\n\r\n\r\n Authorization： \r\n\r\n Put your merchant secret key in HTTP header like: Authorization: Bearer \\<secret key\\>"
  },
  "paths": {
    "/api/balance": {
      "get": {
        "tags": [
          "Balance"
        ],
        "summary": "Ger Merchant Balance",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceHandleResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceHandleResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceHandleResult"
                }
              }
            }
          },
          "400": {
            "description": "Method Exception or Validation fail"
          },
          "401": {
            "description": "Check your merchant API secret key"
          }
        }
      }
    },
    "/api/orders/deposit/utrcode": {
      "post": {
        "tags": [
          "DepositOrders"
        ],
        "summary": "Submit UTR code for order",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepositUtr"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/DepositUtr"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/DepositUtr"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositOrderHandleDataOrderHandleResult"
                }
              }
            }
          },
          "404": {
            "description": "order not found"
          },
          "400": {
            "description": "Validation fail"
          },
          "401": {
            "description": "Check your merchant API secret key"
          }
        }
      }
    },
    "/api/orders/deposit": {
      "post": {
        "tags": [
          "DepositOrders"
        ],
        "summary": "Create Deposit Order",
        "description": "Data signature (required only if we enable it for your merchant):\r\n--\r\nIf data signature validation is enabled for your merchant , you must compute data signature string and put in dataSignature field,\r\nthe dataSignature sould generation by following procedure:\r\n```\r\nBase64(\r\n    HMACSHA256(\r\n        UTF8(\r\n            \"{orderId},{channel},{amount:0.0000}\"\r\n        ),\r\n        UTF8(\r\n            \"{your merchant data signature key}\"\r\n        )\r\n    )\r\n)\r\n```\r\nfor example, if your reqeust data is \r\n```json\r\n{\r\n    \"orderId\":\"001001010\",\r\n    \"channel\":111,\r\n    \"amount\":100,\r\n    \"notifyUrl\":\"https://domin.to.your.site/orderupdate/001001010\"\r\n}\r\n```\r\nthen the string you sould compute for signature is \"001001010,111,100.0000\"\r\n\r\nOrder Process Notification:\r\n--\r\nIf order complete and [NotifyUrl] have value, you can get auto notification\r\n\r\n    Media type: application/json; charset=utf-8\r\n    \r\n    POST / {{NotifyUrl}}\r\n    {\r\n       \"systemOrderId\": integer($int64),\r\n       \"orderId\": string,\r\n       \"amount\": number($double),\r\n       \"actualAmount\": number($double),\r\n       \"status\": OrderNotifyStatus integer($int32),\r\n                 Enum:\r\n                      Success - 0\r\n                      Failure - 1\r\n       \"orderStatus\": DepositOrderStatus integer($int32),\r\n                 Enum:\r\n                      Success        - 10\r\n                      ManualSuccess  - 11\r\n                      AmountNotMatch - 20\r\n                      Expired - 99\r\n       \"closeTime\": \tstring($date-time),\r\n       \"utrCode\": string,\r\n       \"remark\": string,\r\n       \"dataSignature\": string\r\n    }\r\n \r\n* If don't get a successful status code (200), will automatically retry 3 times\r\n* DataSignature generation by following procedure\r\n```\r\nBase64(\r\n    HMACSHA256(\r\n        UTF8(\r\n            \"{orderId},{utrCode},{amount:0.0000},{actualAmount:0.0000},{(int)status},{(int)orderStatus},{UnixTimeMilliseconds(closeTime)}\"\r\n        ),\r\n        UTF8(\r\n            \"{your merchant data signature key}\"\r\n        )\r\n    )\r\n)\r\n```",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DepositOrderRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/DepositOrderRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/DepositOrderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositOrderHandleDataOrderHandleResult"
                }
              }
            }
          },
          "400": {
            "description": "Method Exception or Validation fail"
          },
          "401": {
            "description": "Check your merchant API secret key"
          }
        }
      },
      "get": {
        "tags": [
          "DepositOrders"
        ],
        "summary": "Query Order information",
        "parameters": [
          {
            "name": "orderId",
            "in": "query",
            "description": "Order Id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositOrderHandleDataOrderHandleResult"
                }
              }
            }
          },
          "400": {
            "description": "Method Exception or Validation fail"
          },
          "401": {
            "description": "Check your merchant API secret key"
          }
        }
      }
    },
    "/api/orders/withdraw": {
      "post": {
        "tags": [
          "WithdrawOrders"
        ],
        "summary": "Create Withdraw Order",
        "description": "Data signature (required only if we enable it for your merchant):\r\n--\r\nIf data signature validation is enabled for your merchant , you must compute data signature string and put in dataSignature field,\r\nthe dataSignature sould generation by following procedure:\r\n```\r\nBase64(\r\n    HMACSHA256(\r\n        UTF8(\r\n            \"{orderId},{bankCode},{bankAccount},{amount:0.0000}\"\r\n        ),\r\n        UTF8(\"{your merchant data signature key}\")\r\n    )\r\n)\r\n```\r\nfor example, if your reqeust data is \r\n```json\r\n{\r\n    \"orderId\": \"001001010\",\r\n    \"amount\": 100.22,\r\n    \"notifyUrl\": \"https://domin.to.your.site/orderupdate/001001010\",\r\n    \"bankAccount\": \"2222222222\",\r\n    \"bankName\": \"ICICI Bank Ltd\",\r\n    \"bankSubName\": \"Bangalore M G Road\",\r\n    \"bankCode\": \"ICIC0000002\",\r\n    \"bankAccountName\": \"Dayita Jha\"\r\n}\r\n```\r\nthen the string you sould compute for signature is \"001001010,ICIC0000002,2222222222,100.2200\"\r\n\r\nOrder Process Notification:\r\n--\r\nIf order complete and [NotifyUrl] have value, you can get auto notification\r\n\r\n    Media type: application/json; charset=utf-8\r\n    \r\n    POST / {{NotifyUrl}}\r\n    {\r\n       \"systemOrderId\": integer($int64),\r\n       \"orderId\": string,\r\n       \"amount\": number($double),\r\n       \"actualAmount\": number($double),\r\n       \"status\": OrderNotifyStatus integer($int32),\r\n                 Enum:\r\n                      Success - 0\r\n                      Failure - 1\r\n       \"orderStatus\": WithdrawOrderStatus integer($int32),\r\n                 Enum:\r\n                      Done           - 10\r\n                      ManualDone     - 11\r\n                      SettlementDone - 12\r\n                      Reject         - 20\r\n       \"closeTime\": \tstring($date-time),\r\n       \"utrCode\": string,\r\n       \"remark\": string,\r\n       \"dataSignature\": string\r\n    }\r\n \r\n* If don't get a successful status code (200), will automatically retry 3 times\r\n* DataSignature generation by following procedure\r\n```\r\nBase64(\r\n    HMACSHA256(\r\n        UTF8(\r\n            \"{orderId},,{amount:0.0000},{actualAmount:0.0000},{(int)status},{(int)orderStatus},{UnixTimeMilliseconds(closeTime)}\"\r\n        ),\r\n        UTF8(\r\n            \"{your merchant data signature key}\"\r\n        )\r\n    )\r\n)\r\n```\r\n(note the double ,)",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WithdrawOrderRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/WithdrawOrderRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/WithdrawOrderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderHandleDataOrderHandleResult"
                }
              }
            }
          },
          "400": {
            "description": "Method Exception or Validation fail"
          },
          "401": {
            "description": "Check your merchant API secret key"
          }
        }
      },
      "get": {
        "tags": [
          "WithdrawOrders"
        ],
        "summary": "Query Order information",
        "parameters": [
          {
            "name": "orderId",
            "in": "query",
            "description": "Order Id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderHandleDataOrderHandleResult"
                }
              }
            }
          },
          "400": {
            "description": "Method Exception or Validation fail"
          },
          "401": {
            "description": "Check your merchant API secret key"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BalanceHandleData": {
        "type": "object",
        "properties": {
          "balance": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "BalanceHandleResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "error": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true,
            "readOnly": true
          },
          "data": {
            "$ref": "#/components/schemas/BalanceHandleData"
          }
        },
        "additionalProperties": false
      },
      "DepositOrderHandleData": {
        "type": "object",
        "properties": {
          "systemOrderId": {
            "type": "integer",
            "format": "int64"
          },
          "orderId": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "actualAmount": {
            "type": "number",
            "format": "double"
          },
          "fee": {
            "type": "number",
            "format": "double"
          },
          "returnUrl": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "description": "See DepositOrderStatus or WithdrawOrderStatus in Schemas",
            "format": "int32"
          },
          "utrCode": {
            "type": "string",
            "description": "Always null when create order, only for query order response",
            "nullable": true
          },
          "remark": {
            "type": "string",
            "nullable": true
          },
          "upiAccount": {
            "type": "string",
            "nullable": true
          },
          "qrCode": {
            "type": "string",
            "nullable": true
          },
          "bankName": {
            "type": "string",
            "nullable": true
          },
          "bankCode": {
            "type": "string",
            "nullable": true
          },
          "bankAccount": {
            "type": "string",
            "nullable": true
          },
          "bankAccountName": {
            "type": "string",
            "nullable": true
          },
          "bankRemark": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DepositOrderHandleDataOrderHandleResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "error": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true,
            "readOnly": true
          },
          "data": {
            "$ref": "#/components/schemas/DepositOrderHandleData"
          }
        },
        "additionalProperties": false
      },
      "DepositOrderRequest": {
        "required": [
          "orderId"
        ],
        "type": "object",
        "properties": {
          "orderId": {
            "maxLength": 200,
            "minLength": 1,
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "notifyUrl": {
            "type": "string",
            "nullable": true
          },
          "dataSignature": {
            "type": "string",
            "nullable": true
          },
          "channel": {
            "type": "integer",
            "format": "int64"
          },
          "userBackUrl": {
            "maxLength": 2048,
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DepositOrderStatus": {
        "enum": [
          1,
          10,
          11,
          20,
          99,
          999
        ],
        "type": "integer",
        "description": "<p>Members:</p><ul><li><i>UnPaid</i> - 1</ li ><li><i>Success</i> - 10</ li ><li><i>ManualSuccess</i> - 11</ li ><li><i>AmountNotMatch</i> - 20</ li ><li><i>Expired</i> - 99</ li ><li><i>CreateFailed</i> - 999</ li ></ul>",
        "format": "int32"
      },
      "DepositUtr": {
        "required": [
          "orderId",
          "utrCode"
        ],
        "type": "object",
        "properties": {
          "orderId": {
            "minLength": 1,
            "type": "string"
          },
          "utrCode": {
            "maxLength": 12,
            "minLength": 12,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "OrderHandleData": {
        "type": "object",
        "properties": {
          "systemOrderId": {
            "type": "integer",
            "format": "int64"
          },
          "orderId": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "actualAmount": {
            "type": "number",
            "format": "double"
          },
          "fee": {
            "type": "number",
            "format": "double"
          },
          "returnUrl": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "description": "See DepositOrderStatus or WithdrawOrderStatus in Schemas",
            "format": "int32"
          },
          "utrCode": {
            "type": "string",
            "description": "Always null when create order, only for query order response",
            "nullable": true
          },
          "remark": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OrderHandleDataOrderHandleResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "error": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true,
            "readOnly": true
          },
          "data": {
            "$ref": "#/components/schemas/OrderHandleData"
          }
        },
        "additionalProperties": false
      },
      "WithdrawOrderRequest": {
        "required": [
          "bankAccount",
          "bankAccountName",
          "orderId"
        ],
        "type": "object",
        "properties": {
          "orderId": {
            "maxLength": 200,
            "minLength": 1,
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "notifyUrl": {
            "type": "string",
            "nullable": true
          },
          "dataSignature": {
            "type": "string",
            "nullable": true
          },
          "channel": {
            "type": "integer",
            "description": "Chennel (if not send, default use 1)",
            "format": "int64",
            "nullable": true
          },
          "bankAccount": {
            "maxLength": 200,
            "minLength": 1,
            "type": "string",
            "description": "Bank account or UPI vpa"
          },
          "bankName": {
            "maxLength": 200,
            "type": "string",
            "description": "If use bank account this column is required",
            "nullable": true
          },
          "bankSubName": {
            "maxLength": 200,
            "type": "string",
            "nullable": true
          },
          "bankCode": {
            "type": "string",
            "description": "If India, this column is IFSC Code",
            "nullable": true
          },
          "bankAccountName": {
            "maxLength": 200,
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "WithdrawOrderStatus": {
        "enum": [
          1,
          2,
          10,
          11,
          12,
          20,
          999
        ],
        "type": "integer",
        "description": "<p>Members:</p><ul><li><i>Pending</i> - 1</ li ><li><i>Processing</i> - 2</ li ><li><i>Done</i> - 10</ li ><li><i>ManualDone</i> - 11</ li ><li><i>SettlementDone</i> - 12</ li ><li><i>Reject</i> - 20</ li ><li><i>CreateFailed</i> - 999</ li ></ul>",
        "format": "int32"
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "description": "Put your merchant secret key in HTTP header like: Authorization: Bearer \\<secret key\\> \r\n\r\n\r\n Please enter your merchant secret key",
        "scheme": "Bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ]
    }
  ]
}