openapi: 3.0.0
servers:
  - url: "https://app.payku.cl/"
    description: Production
  - url: "https://des.payku.cl/"
    description: Sandbox
info:
  description: |
    Do you need to see the documentation for the other countries?: <a href="https://docs.payku.com/index-cl-en-v1.html">Chile</a> | <a href="https://docs.payku.com/index-pe-en-v1.html">Perú</a> | Venezuela

    Select the language of the documentation: <a href="https://docs.payku.com/index-ve-es-v1.html">ES</a> | EN

    <div style="
    background: #2F39D1;
    width:100%;
    height:6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    ">
    <strong style="color: #fff">New: You can do live tests of our API</strong>
    <a style="
    margin-top:0.7rem;
    background: #fff;
    border: 1px solid rgb(50, 50, 159);
    color: rgb(50, 50, 159);
    font-weight: normal;
    margin-left: 0.5em;
    width:20%;
    padding: 4px 8px;
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
    text-align: center"
    href="https://testing-apirest.payku.cl/"
    target="_blanck" rel=”noopener noreferrer”
    onMouseOver="this.style.color='#000', this.style.background='#DBDBDB'"
    onMouseOut="this.style.color='#2F39D1', this.style.background='#fff'"
     >
    Tests
      </a>
    </div>

    # Introduction
    Welcome to the Payku API. You can use our API to access the different
    Payku endpoints, where you can generate and manage payments through different
    methods and get information from them.

    The API is organized around REST. It has predictable URLs and resource-oriented,
    and uses HTTP response codes to indicate the result of the call. All API
    responses return objects JSON, including errors.

    User should look for a 200 result code. If received any result code other
    than 200, the request, or the response is invalid, which means that the fields
    did not pass the checks of validation from payku. We use features included in
    the HTTP protocol, such as authentication, which are supported by the most HTTP
    clients.

    **Important — How to tell if an operation failed**

    Do not rely only on the HTTP status code (for example, 200). In our API, many
    error responses also return HTTP 200. This is intentional and part of how the
    API is designed.

    Always read the JSON response body and check the `status` field:
    - If `status` is `"success"`, the operation completed successfully.
    - If `status` is `"failed"`, there was an error (for example, invalid data or a
      rejected operation). Also check the error message included in the same response.

    # Authentication
    Payku uses Token Based Authentication over HTTPS for authentication. To have
    access to our API, access your account in the section of Integration you will
    find the option of integration and API tokens. The request Unauthenticated or
    incorrect will return an Invalid token response.

    # API Security
    Each request is required to have included in the header:
      - Authorization: Bearer **TOKEN-PÚBLICO**

    # Signature
    In the case of the third-party payments (payout) API, an additional layer of security was added
    through of a signature that is sent in the request header, to obtain said signature
    is necessary the following:

    The Request Path must be concatenated in url format along with all the request
    parameters, which must be ordered alphabetically by key, such that key = value.
    Therefore, if the client email value is "example@domain.com" the correct format
    would be "example%40domain.com" and then concatenated with the character '&'.

    Once the character sets are ordered and concatenated, the hash is calculated
    using the HMAC function with encryption type sha256, and the private token.

    **Note:** If an element of the data has as value an object or array, it is excluded from the data. This function is in the PHP and Javascript example.

    ### PHP Example
    API Endpoint:
    ```php
    $request_path = urlencode('/api/suclient');
    ```
    Sorting the parameters:
    ```php
    $data = [
      'email' => 'support@youwebsite.cl',
      'name' => 'Joe Doe',
      'phone' => '923122312',
      'address' => 'Moneda 101',
      'country' => 'Chile',
      'region' => 'Metropolitana',
      'city' => 'Santiago',
      'postal_code' => '850000',
      'additional_parameters' => [
        'parameter_1' => 'example',
        'parameter_2' => 'example 2',
      ]
    ];
    ksort($data);
    ```
    Transformation of the parameters to url format:
    ```php
        $contador = 0;
        $concatenar = null;

        if (!empty($data) && !is_null($data)) {
            foreach ($data as $key => $val) {
                if(gettype($val)!='array' && gettype($val)!='object'){
                    if ($contador>0) {
                        $concatenar .= '&';
                    }
                    $concatenar .= $key . '=' . urlencode($val);
                    $contador++;
                }
            }
        };
    ```
    Concatenation of the parameters in url format with the API endpoint:
    ```php
    $concat = $request_path.'&'.$concatenar;
    ```
    Sign:
    ```php
    $sign = hash_hmac('sha256', $concat, 'fe551abcef62fcf002dc598922e68f0a');
    ```

    ### JavaScript Example
    Import CryptoJS dependency:
    ```javascript
    const CryptoJS = require("crypto-js");
    ```
    API Endpoint:
    ```javascript
    const requestPath = encodeURIComponent('/api/suclient');
    ```
    Sorting the parameters:
    ```javascript
    const data = {
      email: "support@youwebsite.cl",
      name: "Joe Doe",
      phone: "923122312",
      address: "Moneda 101",
      country: "Chile",
      region: "Metropolitana",
      city: "Santiago",
      postal_code: "850000"
    };
    const orderedData = {};
    Object.keys(data).sort().forEach(function(key) {
      orderedData[key] = data[key];
      if (typeof orderedData[key] === 'object') {
            delete orderedData[key];
      }
    });
    ```
    Transformation of the parameters to url format:
    ```javascript
    const arrayConcat = new URLSearchParams(orderedData).toString();
    ```
    Concatenation of the parameters in url format with the API endpoint:
    ```javascript
    const concat = requestPath + "&" + arrayConcat;
    ```
    Sign:
    ```javascript
    const sign = CryptoJS.HmacSHA256(concat, "fe551abcef62fcf002dc598922e68f0a").toString();
    ```

    The result of the signature obtained for both examples is:

    ```javascript
    "d891663698d31aa8b68babe96ac6497f5a0d874024368102998d5b79a4d12c36"
    ```

    # Errors
    Payku uses conventional HTTP responses to indicate the success or failure of a request.
    In general, codes in the 2xx range indicate success, codes in the 4xx range indicate
    an error that failed due to the information provided (ex: a required parameter was
    skipped, a payment failed, etc.), and codes in the 5xx range indicate an error with
    Payku servers (these are rare).

    ## Error codes
    <div class="errorContent">
    <table>
      <tbody>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">400</strong>
            <p class="psmall">Bad Request</p>
          </td>
          <td class="errorDescription">There is a problem with your request</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">401</strong>
            <p class="psmall">Unauthorized</p>
          </td>
          <td class="errorDescription">Your token is incorrect or signature is incorrect</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">403</strong>
            <p class="psmall">Forbidden</p>
          </td>
          <td class="errorDescription">You do not have permission to view this page</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">404</strong>
            <p class="psmall">Not Found</p>
          </td>
          <td class="errorDescription">The specified resource was not found</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">405</strong>
            <p class="psmall">Method Not Allowed</p>
          </td>
          <td class="errorDescription">You tried to enter a resource with an invalid method</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">406</strong>
            <p class="psmall">Not Acceptable</p>
          </td>
          <td class="errorDescription">You requested a format other than JSON</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">410</strong>
            <p class="psmall">Gone</p>
          </td>
          <td class="errorDescription">The requested resource was removed from our servers</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">422</strong>
            <p class="psmall">Unprocessable Entity</p>
          </td>
          <td class="errorDescription">We cannot process your request, please review it.</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">429</strong>
            <p class="psmall">Too Many Requests</p>
          </td>
          <td class="errorDescription">You are requesting a lot of resources! Stop!</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">500</strong>
            <p class="psmall">Internal Server Error</p>
          </td>
          <td class="errorDescription">We had a problem with our server. Please try again later.</td>
        </tr>
        <tr>
          <td style="text-align: right"><strong class="errorTitle">503</strong>
            <p class="psmall">Service Unavailable</p>
          </td>
          <td class="errorDescription">We are offline for maintenance. Please try again later.</td>
        </tr>
      </tbody>
    </table>
    </div>

    # API access
    If you have a payku account, you can access the REST API through the following endpoints:

    <div class="content">
      <table class="center smallTable">
        <thead>
          <tr>
            <th style="text-align:center;"><strong>Site</strong></th>
            <th style="text-align:center;"><strong>BASE URL FOR REST ENDPOINT</strong></th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><strong>Production</strong></td>
            <td align="center"><a href="https://app.payku.cl/api">https://app.payku.cl/</a></td>
          </tr>
          <tr>
            <td><strong>Sandbox</strong></td>
            <td><a href="https://des.payku.cl/api">https://des.payku.cl/</a></td>
          </tr>
        </tbody>
      </table>
    </div>

    - **Production**: provides direct access to generate actual transactions.
    - **Sandbox**: allows you to test your integration without affecting the actual data.

  version: "2.1.01"
  title: payku API
  termsOfService: "https://payku.com/legal/"
  contact:
    email: contacto@payku.com
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
  license:
    name: Apache 2.0
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
  x-logo:
    url: "https://records.payku.com/public/img/payku2020_2.svg"
tags:
  - name: Banks
    description: |
      Allows viewing the list of associated banks.
  - name: Methods of payment
    description: |
      Allows viewing the list of payment methods used by Payku.

x-tagGroups:
  - name: ''
    tags:
      - Transaction
      - Wallet
  - name: Tools
    tags:
      - Banks
      - Methods of payment

paths:
  /api/transaction:
    post:
      tags:
        - Transaction
      summary: Create
      description: |
        This method allows you to create a payment order and returns the **URL** and **TOKEN** that identify the transaction.

        Additional parameters:

        1. **additional_parameters** = Allows you to send additional information that will be recorded with the transaction:

          **IMPORTANT additional_parameters.gateway:**
          - Allows specifying the final payment method
          - **<span style="color: red">REQUIRED</span>** for merchants using the On-Site method
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRegisterResponse"
        "400":
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error400"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl -X POST \
            https://BASE-URL/api/transaction \
            -H 'Accept: application/json, text/plain, */*' \
            -H 'Authorization: Bearer TOKEN-PUBLIC' \
            -H 'Content-Type: application/json' \
            -H 'Host: BASE-URL' \
            -d '{
              "email": "payer@domain.com",
              "order": "order-commerce-999",
              "subject": "description of the order",
              "amount": 100,
              "currency": "VES",
              "payment": 17,
              "urlreturn": "https://youwebsite.com/return/client/order-commerce-999",
              "urlnotify": "https://youwebsite.com/callback/commerce/order-commerce-999",
              "additional_parameters": {
                "gateway":"GATEWAY_CODE"
              }
            }'
        - lang: "PHP"
          source: |
            $client = new \GuzzleHttp\Client();
            $body = $client->request('POST', 'https://BASE_URL/api/transaction', [
              'json' => [
                'email' => 'payer@domain.com',
                'order' => 'order-commerce-999',
                'subject' => 'description of the order',
                'amount' => 100,
                'currency' => 'VES',
                'payment' => 17,
                'urlreturn' => 'https://youwebsite.com/return/client/order-commerce-999',
                'urlnotify' => 'https://youwebsite.com/callback/commerce/order-commerce-999',
                'additional_parameters' => [
                  'gateway' => 'GATEWAY_CODE'
                ]
              ],
              'headers' => [
                'Authorization' => 'Bearer TOKEN_PUBLIC'
              ]
            ])->getBody();
            $response = json_decode($body);
        - lang: "JS"
          source: |
            const data = {
              "email": "payer@domain.com",
              "order": "order-commerce-999",
              "subject": "description of the order",
              "amount": 100,
              "currency": "VES",
              "payment": 17,
              "urlreturn": "https://youwebsite.com/return/client/order-commerce-999",
              "urlnotify": "https://youwebsite.com/callback/commerce/order-commerce-999",
              "additional_parameters": {
                "gateway": "GATEWAY_CODE"
              }
            };
            const request = async (data) => {
              const response = await fetch('https://BASE_URL/api/transaction', {
                method: 'POST',
                headers: {
                  'Content-Type': 'application/json',
                  'Authorization': 'Bearer TOKEN_PUBLIC'
                },
                body: JSON.stringify(data)
              });
              const result = await response.json();
              console.log(result)
            }
            request(data);
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
                  description: Payer's email
                  type: string
                  format: email
                  example: "payer@domain.com"
                  minLength: 20
                  maxLength: 100
                  nullable: false
                  required: true
                order:
                  pattern: "^[a-zA-Z0-9- ]{1,40}$"
                  description: Merchant's order
                  type: string
                  format: uuid
                  example: "order-commerce-999"
                  minLength: 20
                  maxLength: 40
                  nullable: false
                  required: true
                subject:
                  pattern: "^[a-zA-Z0-9 ]{1,200}$"
                  description: Order description
                  type: string
                  format: text
                  example: description of the order
                  minLength: 1
                  maxLength: 200
                  nullable: false
                  required: true
                amount:
                  pattern: "^[0-9]+$"
                  description: Order amount
                  type: integer
                  format: int32
                  example: 100
                  minValue: 1
                  maxValue: 4294967295
                currency:
                  pattern: "ISO 4217"
                  description: VES
                  type: string
                  format: currency
                  example: "VES"
                  minLength: 3
                  maxLength: 3
                  nullable: false
                  required: true
                payment:
                  pattern: "^[0-9]{1,2}$"
                  description: 17
                  type: integer
                  format: int32
                  example: 17
                  minValue: 1
                  maxValue: 99
                urlreturn:
                  pattern: "^https:\\/\\/([\\w\\-]+\\.)+[\\w\\-]+(\\/[\\w\\-\\.\\/?%&=]*)?$"
                  description: Merchant return URL where the payer will be redirected after the transaction result is obtained.
                  type: string
                  format: uri
                  example: https://youwebsite.com/return/client/order-commerce-999
                  minLength: 1
                  maxLength: 255
                urlnotify:
                  pattern: "^https:\\/\\/([\\w\\-]+\\.)+[\\w\\-]+(\\/[\\w\\-\\.\\/?%&=]*)?$"
                  description: |
                    Merchant callback URL where the payment result will be notified.

                    **Note:** Once the client completes the payment process, the callback URL (urlnotify) will be notified with the result of the banking operation.

                    **Example of a successful response:**
                    ```json
                    {
                      "transaction_id": "991...",
                      "payment_key": "trx...",
                      "transaction_key": "991...",
                      "verification_key": "8b3...",
                      "order": "199...",
                      "status": "success"
                    }
                    ```

                    **Example of a failed response:**
                    ```json
                    {
                      "transaction_id": "991...",
                      "payment_key": "trx3...",
                      "transaction_key": "991...",
                      "verification_key": "8b3e...",
                      "order": "199...",
                      "status": "failed"
                    }
                    ```
                  type: string
                  format: uri
                additional_parameters:
                  description: |
                    Additional merchant parameters.
                  type: object
                  properties:
                    gateway:
                      description: |
                        Select the desired payment method:

                        | Code | Method | Description | On-Site |
                        |------|--------|-------------|---------|
                        | VZLAVECAP2C | Mobile Payment (P2C) | PagoMóvil (Most popular) | YES |
                        | BMIGVECAP2C | Mobile Payment (P2C) | PagoMóvil (Most popular) | |
                        | BMIGVECAC2P | Mobile Payment (C2P) | BancAmiga (Instant payment) | |
                        | BAMRVECAC2P | Mobile Payment (C2P) | Mercantil (Instant payment) | |
                        | UNIOVECAP2C | Banesco | BotónPago (Bank transfer) | |
                        | VZLAVECABIO | Cards | BDV BioPago (Debit and Credit) | |

                        Note: For methods marked as "On-Site: YES", the response will include additional information:

                        ```json
                        {
                          "status": "register",
                          "id": "trx...",
                          "url": "https://[BASE_URL]/api/validonsite",
                          "account_service": {
                            "bank_method": "PA...",
                            "bank_number": "04...",
                            "bank_document": "J-...",
                            "bank_name": "Ban...",
                            "bank_nameshort": "Ve...",
                            "bank_code": "01...",
                            "bank_linkqr": "htt..."
                          },
                          "attributes_request": {
                            "transaction": "trx...",
                            "payer": {
                              "phone_number": "required",
                              "payment_reference": "required",
                              "id_number": "required",
                              "bank_code": "required",
                              "payment_date": "optional"
                            }
                          }
                        }
                        ```

                        Key fields in the On-Site response:
                        - status: Initial transaction status
                        - id: Unique transaction identifier
                        - url: URL to complete the payment, e.g. `/api/validonsite`
                        - account_service: Bank info to be shown in the payment form
                        - attributes_request: Required data to complete the payment
                      type: string
                      example: "CODE"
              required:
                - email
                - order
                - subject
                - amount
                - currency
                - payment
                - urlnotify

  /api/validonsite:
    post:
      tags:
        - Transaction
      summary: Confirm On-Site
      description: |
        This method allows the payment to be confirmed on the merchant's website by sending payer information for verification. The result of the transaction will be reported via the [urlnotify] callback.

      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transaction:
                    type: string
                    description: Unique transaction identifier
                    example: "trx24..."
                  status:
                    type: string
                    description: Transaction status
                    example: "register"
                  message:
                    type: string
                    description: Descriptive status message
                    example: "payment received and pending verification"
                  gateway:
                    type: object
                    description: Payment gateway information
                    properties:
                      status:
                        type: string
                        description: Gateway status
                        example: "successful"
                required:
                  - transaction
                  - status
                  - message
                  - gateway
              example:
                transaction: "trx24..."
                status: "register"
                message: "payment received and pending verification"
                gateway:
                  status: "successful"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  transaction:
                    type: string
                    description: Unique transaction identifier
                    example: "trx24..."
                  status:
                    type: string
                    description: Transaction status
                    example: "failed"
                  message_error:
                    type: string
                    description: Descriptive error message
                    example: "charge already used or consumed"
                required:
                  - transaction
                  - status
                  - message_error
              example:
                transaction: "trx24..."
                status: "failed"
                message_error: "charge already used or consumed"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl -X POST \
            'https://BASE_URL/api/validonsite' \
            -H 'Accept: application/json, text/plain, */*' \
            -H 'Authorization: Bearer TOKEN-PUBLIC' \
            -H 'Content-Type: application/json' \
            -H 'Host: BASE-URL' \
            -d '{
              "transaction": "trx2...",
              "payer": {
                "phone_number": "04129874563",
                "payment_reference": "12345600",
                "id_number": "V12987456",
                "bank_code": "0102",
                "payment_date": "2026-08-25"
              }
            }'
        - lang: "PHP"
          source: |
            $client = new \GuzzleHttp\Client();
            $body = $client->request('POST', 'https://BASE_URL/api/validonsite', [
              'json' => [
                'transaction' => 'trx2...',
                'payer' => [
                  'phone_number' => '04129874563',
                  'payment_reference' => '12345600',
                  'id_number' => 'V12987456',
                  'bank_code' => '0102',
                  'payment_date' => '2026-08-25'
                ]
              ],
              'headers' => [
                'Authorization' => 'Bearer TOKEN_PUBLICO'
              ]
            ])->getBody();
            $response = json_decode($body);
        - lang: "JS"
          source: |
            const data = {
              "transaction": "trx2...",
              "payer": {
                "phone_number": "04129874563",
                "payment_reference": "12345600",
                "id_number": "V12987456",
                "bank_code": "0102",
                "payment_date": "2026-08-25"
              }
            };
            const request = async (data) => {
              const response = await fetch('https://BASE_URL/api/validonsite', {
                method: 'POST',
                headers: {
                  'Content-Type': 'application/json',
                  'Authorization': 'Bearer TOKEN_PUBLICO'
                },
                body: JSON.stringify(data)
              });
              const result = await response.json();
              console.log(result)
            }
            request(data);
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - transaction
                - payer
              properties:
                transaction:
                  type: string
                  description: Unique transaction identifier
                  example: "trx24..."
                payer:
                  type: object
                  description: Payer information
                  required:
                    - phone_number
                    - payment_reference
                    - id_number
                    - bank_code
                  properties:
                    phone_number:
                      type: string
                      description: Payer's phone number
                      example: "04129874563"
                    payment_reference:
                        type: string
                        description: Payment reference issued by the banking entity
                        example: "12345600"
                    id_number:
                      type: string
                      description: Payer's ID number
                      example: "V12987456"
                    bank_code:
                      type: string
                      description: Payer's bank code
                      example: "0102"
                    payment_date:
                      type: string
                      description: Payment date (optional)
                      example: "2026-08-25"
  /api/transaction/{id}:
    get:
      tags:
        - Transaction
      summary: "Get"
      description: "This method allows you to obtain the information of a transaction"
      operationId: getTransactionById
      parameters:
        - name: id
          in: path
          description: |
            Unique transaction identifier
            - id: Identifier of the transaction (Transaction/POST)
          required: true
          schema:
            type: string
            pattern: " maximum 40 characters"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IdentifierResponse"
        "400":
          description: Request failed.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error400get"
        "404":
          description: Identifier does not exist.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error404"

  /api/transaction?success=true:
    get:
      tags:
        - Transaction
      summary: List
      description: |
        This method allows you to retrieve information about transactions made on Payku. It supports pagination with a maximum of 4000 records per page.

        | Parameter  | Description | Example |
        |------------|-------------|---------|
        | date_init  | Start date for the transaction search. If not specified, the current date is used. | date_init=2025-01-01 |
        | date_end   | End date for the transaction search. If not specified, the current date is used. | date_end=2025-12-31 |
        | success    | Filters successful transactions. | success=true |
        | pending    | Filters pending transactions. | pending=true |
        | rejected   | Filters rejected transactions. | rejected=true |
        | page       | Page number for pagination. | page=1 |
        | per_page   | Number of records per page (max 4000). | per_page=100 |

        **Example of full URL:**
        ```
        https://[BASE_URL]/api/transaction?date_init=2025-01-01&date_end=2025-12-31&success=true&page=1&per_page=100
        ```
      operationId: getTransactionList
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IdentifierResponse"
        "400":
          description: Request error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error400get"
        "404":
          description: Identifier does not exist.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error404"

  /api/wallet/payout:
    post:
      operationId: payout
      tags:
        - Wallet
      summary: Make payments to third parties from my wallet
      description: |
        This method allows you to create a payment order to a third party using funds from your **Payku** virtual wallet.

        **Note:** For testing purposes (Development environment only), specific amounts will be processed automatically:
        <br>
        &bull;  Amounts 1000, 2000, 3000: Will be marked as **approved** automatically.
        <br>
        &bull;  Amounts 1500, 2500, 3500: Will be marked as **rejected** automatically.
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WalletResponseThird"
        "400":
          description: Request error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error400"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl -X POST \
            https://BASE-URL/api/wallet/payout \
            -H 'Accept: application/json, text/plain, */*' \
            -H 'Authorization: Bearer PUBLIC-TOKEN' \
            -H 'Sign: SHA256-REQUEST-PATH-VALUE-PRIVATE-TOKEN'  \
            -H 'Content-Type: application/json' \
            -H 'Host: BASE-URL' \
            -d '{
              "email": "payer@domain.com",
              "phone": "04149876543",
              "subject": "payOut description 9876",
              "currency": "VES",
              "order": "9876",
              "amount": 1000,
              "accountbank_name": "Jhon Doe",
              "accountbank_rut": "V23654789",
              "accountbank_sbif": "0102",
              "accountbank_type": "1",
              "accountbank_num": "04149876543",
              "url_notify": "https://youwebsite.com/urlnotify?orderClient=9876",
              "additional_parameters": {
                "custom_parameter_1": "keyValue",
                "custom_parameter_2": "SpecificValue2",
                "external_reference": "REF-777"
              }
            }'
        - lang: "PHP"
          source: |
            $client = new \GuzzleHttp\Client();
            $body = $client->request('POST', 'https://BASE_URL/api/wallet/payout', [
              'json' => [
                'email' => 'payer@domain.com',
                'phone' => '04149876543',
                'subject' => 'payOut description 9876',
                'currency' => 'VES',
                'order' => '9876',
                'amount' => 1000,
                'accountbank_name' => 'Jhon Doe',
                'accountbank_rut' => 'V23654789',
                'accountbank_sbif' => '0102',
                'accountbank_type' => '1',
                'accountbank_num' => '04149876543',
                'url_notify' => 'https://youwebsite.com/urlnotify?orderClient=9876',
                'additional_parameters' => [
                  'custom_parameter_1' => 'keyValue',
                  'custom_parameter_2' => 'SpecificValue2',
                  'external_reference' => 'REF-777'
                ]
              ],
              'headers' => [
                'Authorization' => 'Bearer PUBLIC_TOKEN',
                'Sign' => 'SHA256-REQUEST-PATH-VALUE-PRIVATE-TOKEN'
              ]
            ])->getBody();
            $response = json_decode($body);
        - lang: "JS"
          source: |
            const data = {
              "email": "payer@domain.com",
              "phone": "04149876543",
              "subject": "payOut description 9876",
              "currency": "VES",
              "order": "9876",
              "amount": 1000,
              "accountbank_name": "Jhon Doe",
              "accountbank_rut": "V23654789",
              "accountbank_sbif": "0102",
              "accountbank_type": "1",
              "accountbank_num": "04149876543",
              "url_notify": "https://youwebsite.com/urlnotify?orderClient=9876",
              "additional_parameters": {
                "custom_parameter_1": "keyValue",
                "custom_parameter_2": "SpecificValue2",
                "external_reference": "REF-777"
              }
            };
            const request = async (data) => {
              const response = await fetch('https://BASE_URL/api/wallet/payout', {
                method: 'POST',
                headers: {
                  'Content-Type': 'application/json',
                  'Authorization': 'Bearer PUBLIC_TOKEN',
                  'Sign': 'SHA256-REQUEST-PATH-VALUE-PRIVATE-TOKEN'
                },
                body: JSON.stringify(data)
              });
              const result = await response.json();
              console.log(result)
            }
            request(data);
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  pattern: "max 50 characters"
                  description: User's email
                  type: string
                  format: email
                  example: "payer@domain.com"
                phone:
                  pattern: "max 20 characters"
                  description: User's phone number
                  type: string
                  example: "04149876543"
                subject:
                  pattern: "max 200 characters"
                  description: Description of the order
                  type: string
                  example: "description of the order"
                currency:
                  pattern: "max 6 characters"
                  description: Currency type (ISO format)
                  type: string
                  example: "VES"
                order:
                  pattern: "max 50 characters"
                  description: Merchant order
                  type: string
                  example: "order-commerce-999"
                amount:
                  pattern: "max 14 digits"
                  description: Order amount
                  type: integer
                  example: 1000
                accountbank_name:
                  pattern: "max 180 characters"
                  description: Account holder's name
                  type: string
                  example: "John Doe"
                accountbank_rut:
                  pattern: "max 15 characters"
                  description: |
                    ID number of the account holder
                    Format: (V/E/J) VXXXXXXXX
                  type: string
                  example: "V23654789"
                accountbank_sbif:
                  pattern: "max 4 characters"
                  description: |
                    Bank code of the destination account.
                      - 0102 Banco De Venezuela
                      - 0104 Banco Venezolano De Credito
                      - 0105 Banco Mercantil
                      - 0108 Banco Provincial
                      - 0114 Banco Del Caribe
                      - 0115 Banco Exterior
                      - 0128 Banco Caroni
                      - 0134 Banesco
                      - 0137 Sofitasa
                      - 0138 Banco Plaza
                      - 0146 Bangente
                      - 0151 Banco Fondo Común
                      - 0156 100% Banco
                      - 0157 Delsur Banco Universal
                      - 0163 Banco Del Tesoro
                      - 0166 Banco Agrícola De Venezuela
                      - 0168 Bancrecer
                      - 0169 R4 Banco Microfinanciero C.A.
                      - 0171 Banco Activo
                      - 0172 Bancamiga
                      - 0173 Banco Internacional De Desarrollo
                      - 0174 Banplus
                      - 0175 Banco Bicentenario
                      - 0178 N58 Banco Digital
                      - 0191 Banco Nacional De Credito
                  type: string
                  example: "0102"
                accountbank_type:
                  pattern: "max 1 character"
                  description: |
                    Type of account.
                    - 1 Checking
                    - 3 Savings
                  type: string
                  example: "1"
                accountbank_num:
                  pattern: "max 200 characters"
                  description: |
                    Customer's account number in Venezuela
                    Format: (0412 / 0414 / 0424 / 0426 / 0416) 9876543
                  type: string
                  example: "04149876543"
                url_notify:
                  pattern: "max 600 characters"
                  description: |
                    Callback where the result of the payment will be notified.
                    - Note: After making the third-party payment, Payku will automatically respond to the URL provided in `url_notify` with the result.
                      - **Approved example:**
                      - {
                          - "id": "morexzxxxx",
                          - "identifier_payout": "morexzxxxx",
                          - "order": "367734544",
                          - "status": "success",
                          - "update_at": "2023-08-24 12:29:35",
                          - "customer": {
                            - "name": "Jhon Doe",
                            - "phone": "04149876543",
                            - "document": "V23654789",
                            - "number": "04149876543"
                          - }
                      - }
                      - **Rejected example:**
                      - {
                          - "id": "morexzxxxx",
                          - "identifier_payout": "morexzxxxx",
                          - "order": "367734544",
                          - "status": "banking_error",
                          - "update_at": "2023-08-24 12:29:35",
                          - "customer": {
                            - "name": "Jhon Doe",
                            - "phone": "04149876543",
                            - "document": "V23654789",
                            - "number": "04149876543"
                          - }
                      - }
                  type: string
                  example: "https://youwebsite.com/callback/commerce/order-commerce-999"
                additional_parameters:
                  pattern: "max 4000 characters"
                  description: Optional customer additional parameters.
                  type: object
                  properties:
                    parameter_1:
                      description: Custom parameter name defined by Payku user
                      type: string
                      example: "keyValue"
                    parameter_2:
                      description: Custom parameter name defined by Payku user
                      type: string
                      example: "keyValue"
              required:
                - email
                - subject
                - currency
                - order
                - amount
                - accountbank_name
                - accountbank_rut
                - accountbank_sbif
                - accountbank_type
                - accountbank_num

  /api/banks?currency=ves:
    get:
      tags:
        - Banks
      summary: "Get list of banks by currency type"
      description: |
        This method allows you to retrieve a list of associated banks filtered by currency.
        To filter by currency, add the query parameter `currency` with the currency value.
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BanksCurrencyResponse"
        "400":
          description: Request error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorBanks400get"
      x-codeSamples:
        - lang: "CURL"
          source: |
            curl -X GET \
            https://BASE-URL/api/banks?currency=ves  \
            -H 'Accept: application/json, text/plain, */*' \
            -H 'Content-Type: application/json' \
            -H 'Host: BASE-URL'
        - lang: "PHP"
          source: |
            $client = new \GuzzleHttp\Client();
              $body = $client->request('GET', 'https://BASE_URL/api/banks?currency=ves', [
              ])->getBody();
            $response = json_decode($body);
        - lang: "JS"
          source: |
            const request = async () => {
              const response = await fetch('https://BASE_URL/api/banks?currency=ves', {
                method: 'GET',
                headers: {
                  'Content-Type': 'application/json'
                },
              });
              const result = await response.json();
              console.log(result)
            }
            request();

  /api/paymentmethods?currency=ves:
    get:
      tags:
        - Methods of payment
      summary: "Get list of payment methods by currency type"
      description: |
        This method allows you to get a list of payment methods in payku.
        To filter by currency, you have to add the query params currency with the currency value.
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MethodsPaymentCurrencyResponse"
        "400":
          description: Request failed.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorBanks400get"
      x-codeSamples:
        - lang: "CURL"
          source: |
            curl -X GET \
            https://BASE-URL/api/paymentmethods?currency=ves  \
            -H 'Accept: application/json, text/plain, */*' \
            -H 'Content-Type: application/json' \
            -H 'Host: BASE-URL' \
        - lang: "PHP"
          source: |
            $client = new \GuzzleHttp\Client();
              $body = $client->request('GET', 'https://BASE_URL/api/paymentmethods?currency=ves', [
              ])->getBody();
            $response = json_decode($body);
        - lang: "JS"
          source: |
            const request = async () => {
              const response = await fetch('https://BASE_URL/api/paymentmethods?currency=ves', {
                method: 'GET',
                headers: {
                  'Content-Type': 'application/json'
                },
              });
              const result = await response.json();
              console.log(result)
            }
            request();
  /api/payoutv3/{identificadorPayout}:
    get:
      tags:
        - Wallet
      summary: "Get payout V3"
      description: |
        This method allows you to obtain a movement of payments to third parties from your **payku** virtual wallet using an identifier:

        To perform the query it is necessary to add the following at the end of the endpoint /{identificadorPayout} for example: **api/payoutv3/wa24bg36767**.
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PayoutResponseGetv3"
        "400":
          description: Request failed.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error400get"
        "401":
          description: Incorrect public token.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error401"
        "404":
          description: Identifier does not exist.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error404"
      x-codeSamples:
        - lang: "CURL"
          source: |
            curl -X GET \
            https://BASE-URL/api/payoutv3/{identificadorPayout}  \
            -H 'Accept: application/json, text/plain, */*' \
            -H 'Authorization: Bearer PUBLIC-TOKEN' \
            -H 'Sign: SHA256-REQUEST-PATH-VALUE-PRIVATE-TOKEN'  \
            -H 'Content-Type: application/json' \
            -H 'Host: BASE-URL' \
        - lang: "PHP"
          source: |
            $client = new \GuzzleHttp\Client();
              $body = $client->request('GET', 'https://BASE_URL/api/payoutv3/{identificadorPayout}', [
                'headers' => [
                  'Authorization' => 'Bearer PUBLIC-TOKEN',
                  'Sign' => 'SHA256-REQUEST-PATH-VALUE-PRIVATE-TOKEN'
                ]
              ])->getBody();
            $response = json_decode($body);
        - lang: "JS"
          source: |
            const request = async () => {
              const response = await fetch('https://BASE_URL/api/payoutv3/{identificadorPayout}', {
                method: 'GET',
                headers: {
                  'Content-Type': 'application/json',
                  'Authorization': 'Bearer PUBLIC-TOKEN',
                  'Sign': 'SHA256-REQUEST-PATH-VALUE-PRIVATE-TOKEN'
                },
              });
              const result = await response.json();
              console.log(result)
            }

            request();
components:
  schemas:
    BanksResponse:
      description: "Return data from the creation of a transaction"
      type: object
      properties:
        status:
          type: string
          description: |
            Status of the endpoint. The possible statuses that can be obtained are the following:
            - success
          example: "success"
        banks:
          type: array
          items:
            description: "Transaction status return data"
            type: object
            properties:
              code:
                type: string
                description: |
                  Code of the bank to which the bank account belongs.
                example: Banco de Venezuela
              name:
                type: string
                description: Name of bank.
                example: Banco de Venezuela
              currency:
                type: string
                description: Currency
                example: VES
          example:
            - {
                code: "0102",
                name: "Banco de Venezuela",
                currency: "VES"
              }

    BanksCurrencyResponse:
      description: "Code of the bank to which the bank account belongs in VES"
      type: object
      properties:
        status:
          type: string
          description: |
            Status of the endpoint. The possible statuses that can be obtained are the following:
            - success
          example: "success"
        banks:
          type: array
          items:
            description: "Bank list return data"
            type: object
            properties:
              code:
                type: string
                description: |
                  Bank code of the bank to which the bank account belongs.
                example: Banco de Venezuela
              name:
                type: string
                description: Name of bank.
                example: Banco de Venezuela
              currency:
                type: string
                description: Currency
                example: VES
          example:
            - {
                code: "0102",
                name: "Banco de Venezuela",
                currency: "VES"
              }

    MethodsPaymentCurrencyResponse:
      description: "Return data from the creation of the payment method list"
      type: object
      properties:
        status:
          type: string
          description: |
            Status of the endpoint. The possible statuses that can be obtained are the following:
            - success
          example: "success"
        payment_methods:
          type: array
          items:
            description: "Payment method list status return data"
            type: object
            properties:
              code:
                type: string
                description: |
                  Code of the bank to which the bank account belongs.
                example: Banco de Venezuela
              name:
                type: string
                description: Name of bank.
                example: Banco de Venezuela
              currency:
                type: string
                description: Currency
                example: VES
          example:
            - {
                currency: "VES",
                payment: 17,
                name: "VEPUY",
                description: "Use your bank, simplify your transfers."
              }

    TransactionResponse:
      description: "Return data from the creation of a transaction"
      type: object
      properties:
        status:
          type: string
          description: |
            Transaction status The possible statuses you can get are the following:
            - pending
            - success
            - rejected
            - refunded partial
            - refunded
          example: "pending"
        id:
          type: string
          description: Transaction identifier created by payku.
          example: "ma32cb779c0a777fc68"
        url:
          type: string
          description: URL to redirect the user.
          example: "https://BASE-URL/payment_url"

    TransactionRegisterResponse:
      type: object
      properties:
        status:
          type: string
          description: |
            Transaction status. The possible status values are:
            - register
            - success
          example: "register"
        id:
          type: string
          description: Unique identifier of the transaction
          example: "trx6..."
        url:
          type: string
          description: URL to redirect the user.
          example: "https://[BASE_URL]/path?id=trx...&valid=e3c4..."
        account_service:
          type: object
          description: "**[!ONLY FOR ON-SITE METHODS!]** Banking service information required to make the payment."
          properties:
            bank_method:
              type: string
              description: Bank payment method
              example: "PA.."
            bank_number:
              type: string
              description: Mobile payment phone number
              example: "04..."
            bank_document:
              type: string
              description: Bank identification document
              example: "J..."
            bank_name:
              type: string
              description: Full name of the bank
              example: "Ban..."
            bank_nameshort:
              type: string
              description: Short name of the bank
              example: "Ve..."
            bank_code:
              type: string
              description: Bank code
              example: "01..."
            bank_linkqr:
              type: string
              description: URL of the QR code for payment
              example: "ht..."
        attributes_request:
          type: object
          description: "**[!ONLY FOR ON-SITE METHODS!]** Data required to complete and report the payment."
          properties:
            transaction:
              type: string
              description: Transaction identifier
              example: "tr..."
            payer:
              type: object
              description: Required payer information
              properties:
                phone_number:
                  type: string
                  description: Payer's phone number
                payment_reference:
                  type: string
                  description: Payment reference
                  example: "required"

    IdentifierResponse:
      description: "Status return data of a transaction"
      type: object
      properties:
        status:
          type: string
          description: |
            Transaction status The possible statuses you can get are the following:
            - register
            - pending
            - success
            - rejected
          example: "success"
        id:
          type: string
          description: Transaction identifier created by Payku.
          example: "10ac494c1d8da71d98ea"
        created_at:
          type: string
          description: Registration date.
          example: "2019-10-25 14:10:03"
        order:
          type: string
          description: Number of order.
          example: "1572023402"
        email:
          type: string
          description: Client email.
          example: "support@youwebsite.cl"
        subject:
          type: string
          description: Description of the purchase order.
          example: "1572023402"
        amount:
          type: string
          description: Amount.
          example: "98745"
        payment:
          type: object
          properties:
            start:
              type: string
              description: Inicio de la transacciÃ³n.
              example: "2020-12-16 15:10:33"
            end:
              type: string
              description: Fin de la transacciÃ³n.
              example: "2020-12-16 15:10:36"
            media:
              type: string
              description: Payment method, used by the user.
              example: "VEPUY"
            transaction_id:
              type: string
              description: Identifier of the transaction created by payku.
              example: 107999
            transaction_key:
              type: string
              description: Transaction identifier created by Payku.
              example: null
            deposit_date:
              type: string
              description: Date on which the deposit will be made to the customer.
              example: "2023-10-05"
            verification_key:
              type: string
              description: Verification code generated by Payku.
              example: "666..."
            authorization_code:
              type: string
              description: Authorization code.
              example: "10..."
            last_4_digits:
              type: string
              description: Last 4 digits of the affiliated card.
              example: "0000"
            installments:
              type: int
              description: Installments.
              example: 0
            card_type:
              type: string
              description: Card type.
              example: "VN"
            additional_parameters:
              type: object
              description: |
                **Example** of additional parameters that may be sent by Payku.
              properties:
                gateway:
                  type: string
                  description: ""
                  example: "CODE_GATEWAY"
                network:
                  type: object
                  description: |
                    User network data:
                  properties:
                    ip_address:
                      type: string
                      description: |
                        **Example** of IP Address of the user:
                      example: "192.0.2.123"
            currency:
              type: string
              description: Currency.
              example: "VES"

        nullify:
          description: "Objeto que contiene información de la respuesta de la anulación"
          type: object
          properties:
            status:
              type: string
              description: |
                Estatus de anulación. Los posibles estados que puede obtener son los siguientes:
                - pending
                - awaiting_funds
                - waiting_bank_details
                - complete
                - reverse_deleted
                - reverse_completed
              example: "complete"
        gateway_response:
          description: "Object containing transaction response information"
          type: object
          properties:
            status:
              type: string
              description: |
                Transaction status The possible statuses you can get are the following:
                - pending
                - success
                - rejected
                - refunded partial
                - refunded
              example: "success"
            message:
              type: string
              description: |
                Message describing the status.
                  - successful transaction
                  - Transaction rejected.
                  - Transaction must be retried.
                  - Error transaction.
                  - Rate Error Rejection.
                  - Exceeds maximum monthly quota.
                  - Exceeds daily limit per transaction.
                  - unauthorized item.
              example: "successful transaction"
    Error:
      type: object
      properties:
        status:
          type: string
          description: Request status.
          example: failed
        type:
          type: string
          description: Type of error.
          example: Unprocessable Entity
        message_error:
          type: string
          description: Error message.
          example: subject:invalid,amount:is empty,email:is empty,order:invalid

    Error400:
      type: object
      properties:
        status:
          type: string
          description: Request status.
          example: failed
        type:
          type: string
          description: Type of error.
          example: Unprocessable Entity
        message_error:
          type: string
          description: Error message.
          example: subject:invalid,amount:is empty,email:is empty,order:invalid

    Error400get:
      type: object
      properties:
        status:
          type: string
          description: Request status.
          example: failed
        type:
          type: string
          description: Type of error.
          example: Unprocessable Entity
        message_error:
          type: string
          description: Error message.
          example: subject:invalid,amount:is empty,email:is empty,order:invalid

    ErrorBanks400get:
      type: object
      properties:
        status:
          type: string
          description: Request status.
          example: failed
        type:
          type: string
          description: Type of error.
          example: Unprocessable Entity
        message_error:
          type: string
          description: Error message
          example: ""

    Error401:
      type: object
      properties:
        type:
          type: string
          description: Request status.
          example: Unauthorized
        message_error:
          type: object
          properties:
            error:
              type: string
              description: Error message.
              example: waiting token public

    Error404:
      type: object
      properties:
        status:
          type: string
          description: Request status.
          example: failed
        type:
          type: string
          description: Type of error.
          example: Not Found
        id:
          type: string
          description: Id information
          example: is not valid

    WalletResponseThird:
      description: "Return data of the load to the wallet"
      type: object
      properties:
        status:
          type: string
          description: |
            Status of the load to the wallet. The possible statuses that can be obtained are the following:
            - success
            - failed
          example: "success"
        identifier_wallet:
          type: string
          description: payku virtual wallet movement identifier.
          example: "wvb5f7232dafff18f9"
        identifier_payout:
          type: string
          description: Third party payment identifier.
          example: "mv40746ab8eff910f41e"

    PayoutResponseGetv3:
      description: "Return data of the load to the payout"
      type: object
      properties:
        payout:
          type: object
          description: Destination account identifier.
          properties:
            id:
              type: string
              description: Destination account identifier.
              example: "war3999847529816f2"
            phone:
              type: string
              description: Telephone of the destination account holder.
              example: "111111111"
            email:
              type: string
              description: Destination account holder's email.
              example: "test@test.cl"
            subject:
              type: string
              description: Application Status.
              example: "subject order"
            amount:
              type: string
              description: Amount to be deposited in the destination account.
              example: "3680"
            accountbank_rut:
              type: string
              description: Rut of the destination account holder.
              example: "111111111"
            accountbank_name:
              type: string
              description: Name of the destination account holder.
              example: "test"
            accountbank_type:
              type: integer
              description: Type of account of the destination bank.
              example: 1
            accountbank_num:
              type: integer
              description: Destination bank account number.
              example: 123123123
            accountbank_sbif:
              type: string
              description: Code of the bank to which the bank account belongs.
              example: "0001"
            status:
              type: string
              description: |
                Movement status.
                - pending  ("payout registered")
                - processing  ("payout in payment process")
                - success  ("payout successfully deposited")
                - banking_error  ("payout rejected by the bank")
                - fraud_prevention  ("payout rejected by compliance")
              example: "pending"
            update_at:
              type: string
              description: Date the request was made.
              example: "2022-06-09 21:10:46"
            origin_wallet:
              type: string
              description: Id de la wallet origen.
              example: "wa1933f37cdaf7d1c6"
            reason_rejection:
              type: string
              description: Reason for rejection.
              example: " Error CCA 51. Cuenta Beneficiario no Existe, error_creditor_account_not_found"