---
agentTools:
  projectIndex: https://onebrick.readme.io/llms.txt
---

# Generate Open VA

Generate an Open Virtual Account that customers can reuse for flexible payment amounts.

## Request Parameters

| Key Parameters    | Data Type | Description                                                                                          |
| :---------------- | :-------- | :--------------------------------------------------------------------------------------------------- |
| publicAccessToken | String    | One time access-token generated using the auth token API                                             |
| bankShortCode     | String    | Institution short code of the bank                                                                   |
| referenceId       | String    | Unique ID that is being generated by the client to track each VA generation (maximum 255 characters) |
| displayName       | String    | The display name that will be shown in the user's payment platform (maximum 24 characters)           |

## Response Parameters

| Key parameters | Data type | Description                                                                                          |
| :------------- | :-------- | :--------------------------------------------------------------------------------------------------- |
| id             | String    | Unique ID generated by Brick                                                                         |
| bankShortCode  | String    | Institution short code of the bank                                                                   |
| referenceId    | String    | Unique ID that is being generated by the client to track each VA generation (maximum 255 characters) |
| displayName    | String    | The display name that will be shown in the user's payment platform (maximum 24 characters)           |
| accountNo      | String    | Virtual Account Numbers that can be used for the payments                                            |

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Payment v2",
    "version": "2"
  },
  "servers": [
    {
      "url": "https://sandbox.onebrick.io/v2/payments/gs"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "publicAccessToken",
        "x-default": "Bearer"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/va/open": {
      "post": {
        "summary": "Generate Open VA",
        "description": "Generate an Open Virtual Account that customers can reuse for flexible payment amounts.",
        "operationId": "generate-open-va",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "bankShortCode",
                  "referenceId",
                  "displayName"
                ],
                "properties": {
                  "bankShortCode": {
                    "type": "string",
                    "description": "Institution short code of the bank",
                    "default": "MANDIRI"
                  },
                  "referenceId": {
                    "type": "string",
                    "description": "Unique ID that is being generated by the client to track each VA generation (maximum 255 characters)",
                    "default": "test-VA-1"
                  },
                  "displayName": {
                    "type": "string",
                    "description": "The display name that will be shown in the user's payment platform (maximum 24 characters)",
                    "default": "PRODONLY"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"status\": 200,\n    \"data\": {\n\t\t\t\t\"message\": \"We have successfully generated the open VA\",\n        \"id\": \"OP_SA123212SDS123123SAD11222\",\n        \"referenceId\": \"BRICK1234\",\n\t\t\t\t\"bankShortCode\": \"MANDIRI\",\n        \"accountNo\": \"130432138889902\",\n        \"displayName\": \"BRICK\"\n    },\n    \"metaData\": {\n        \"source\": \"API\",\n        \"entity\": \"Payment\"\n    },\n    \"error\": null\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 200,
                      "default": 0
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "We have successfully generated the open VA"
                        },
                        "id": {
                          "type": "string",
                          "example": "OP_SA123212SDS123123SAD11222"
                        },
                        "referenceId": {
                          "type": "string",
                          "example": "BRICK1234"
                        },
                        "bankShortCode": {
                          "type": "string",
                          "example": "MANDIRI"
                        },
                        "accountNo": {
                          "type": "string",
                          "example": "130432138889902"
                        },
                        "displayName": {
                          "type": "string",
                          "example": "BRICK"
                        }
                      }
                    },
                    "metaData": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "example": "API"
                        },
                        "entity": {
                          "type": "string",
                          "example": "Payment"
                        }
                      }
                    },
                    "error": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "bankShortCode not supported": {
                    "value": "{\n    \"status\": 400,\n    \"error\": {\n        \"code\": \"Incorrect_format_of_parameters_in_request\",\n        \"message\": \"Please use Bank Code that we support in the request query\",\n        \"action\": \"Please revisit our API doc to see our supported Bank Code\",\n        \"reason\": \"Bank Code is not supported\"\n    },\n    \"metadata\": {\n        \"source\": \"API\",\n        \"entity\": \"Payment\"\n    },\n    \"data\": null\n}"
                  },
                  "referenceId used": {
                    "value": "{\n    \"status\": 400,\n    \"error\": {\n        \"code\": \"invalid_parameters_in_request\",\n        \"message\": \"Please make sure your External key (reference id) has never been used before\",\n        \"action\": \"Please make sure to always use unique reference ID in the parameter\",\n        \"reason\": \"Your external id (referenceId) has already been taken\"\n    },\n    \"metadata\": {\n        \"source\": \"API\",\n        \"entity\": \"Payment\"\n    },\n    \"data\": null\n}"
                  },
                  "bankShortCode do not use suffixNo": {
                    "value": "{\n    \"status\": 400,\n    \"error\": {\n        \"code\": \"invalid_parameters_in_request\",\n        \"message\": \"Please do not customize the suffix number for this Bank Code\",\n        \"action\": \"Please use the suffix number given without customization\",\n        \"reason\": \"Suffix number customization is not supported for this Bank Code\"\n    },\n    \"metadata\": {\n        \"source\": \"API\",\n        \"entity\": \"Payment\"\n    },\n    \"data\": null\n}"
                  }
                },
                "schema": {
                  "oneOf": [
                    {
                      "title": "bankShortCode not supported",
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "integer",
                          "example": 400,
                          "default": 0
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "example": "Incorrect_format_of_parameters_in_request"
                            },
                            "message": {
                              "type": "string",
                              "example": "Please use Bank Code that we support in the request query"
                            },
                            "action": {
                              "type": "string",
                              "example": "Please revisit our API doc to see our supported Bank Code"
                            },
                            "reason": {
                              "type": "string",
                              "example": "Bank Code is not supported"
                            }
                          }
                        },
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string",
                              "example": "API"
                            },
                            "entity": {
                              "type": "string",
                              "example": "Payment"
                            }
                          }
                        },
                        "data": {}
                      }
                    },
                    {
                      "title": "referenceId used",
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "integer",
                          "example": 400,
                          "default": 0
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "example": "invalid_parameters_in_request"
                            },
                            "message": {
                              "type": "string",
                              "example": "Please make sure your External key (reference id) has never been used before"
                            },
                            "action": {
                              "type": "string",
                              "example": "Please make sure to always use unique reference ID in the parameter"
                            },
                            "reason": {
                              "type": "string",
                              "example": "Your external id (referenceId) has already been taken"
                            }
                          }
                        },
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string",
                              "example": "API"
                            },
                            "entity": {
                              "type": "string",
                              "example": "Payment"
                            }
                          }
                        },
                        "data": {}
                      }
                    },
                    {
                      "title": "bankShortCode do not use suffixNo",
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "integer",
                          "example": 400,
                          "default": 0
                        },
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "example": "invalid_parameters_in_request"
                            },
                            "message": {
                              "type": "string",
                              "example": "Please do not customize the suffix number for this Bank Code"
                            },
                            "action": {
                              "type": "string",
                              "example": "Please use the suffix number given without customization"
                            },
                            "reason": {
                              "type": "string",
                              "example": "Suffix number customization is not supported for this Bank Code"
                            }
                          }
                        },
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string",
                              "example": "API"
                            },
                            "entity": {
                              "type": "string",
                              "example": "Payment"
                            }
                          }
                        },
                        "data": {}
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "examples": {
                  "Invalid token": {
                    "value": "{\n    \"status\": 401,\n    \"error\": {\n        \"code\": \"invalid_parameters_in_headers\",\n        \"message\": \"Please use valid Public_access_token in headers\",\n        \"action\": \"Please generate valid public access token via /v2/payments/auth/token APIs or contact to Brick sales team\",\n        \"reason\": \"Invalid public_access_token in headers\"\n    },\n    \"metadata\": {\n        \"source\": \"API\",\n        \"entity\": \"Payment\"\n    },\n    \"data\": null\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "integer",
                      "example": 401,
                      "default": 0
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "example": "invalid_parameters_in_headers"
                        },
                        "message": {
                          "type": "string",
                          "example": "Please use valid Public_access_token in headers"
                        },
                        "action": {
                          "type": "string",
                          "example": "Please generate valid public access token via /v2/payments/auth/token APIs or contact to Brick sales team"
                        },
                        "reason": {
                          "type": "string",
                          "example": "Invalid public_access_token in headers"
                        }
                      }
                    },
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "example": "API"
                        },
                        "entity": {
                          "type": "string",
                          "example": "Payment"
                        }
                      }
                    },
                    "data": {}
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "62aa98669833aa0028c5a455:62aaa48d0af2ca001c529403"
}
```