# Payment API

### Voucher validation API <a href="#voucher-validation-api" id="voucher-validation-api"></a>

GET: /api/payments/voucher/validate

Validate voucher for specific booking

#### Request Body <a href="#request-body" id="request-body"></a>

| Parameter                        | Description        |
| -------------------------------- | ------------------ |
| bookingNumber (String, Required) | Booking Identifier |
| voucherCode (String, Required)   | Voucher code       |

Example

```json
{
    "bookingNumber": "ADCO2203011523483",
    "voucherCode": "AXOLXHLp"
}
```

#### Response <a href="#response" id="response"></a>

| Parameter                        | Description                         |
| -------------------------------- | ----------------------------------- |
| bookingNumber (String)           | Booking identifier                  |
| discountAmount (Double)          | Discount money amount               |
| trackingCode (String)            | Identifier for booking with voucher |
| voucherCode (String)             | Voucher code                        |
| voucherValid (Boolean)           | Is valid voucher code?              |
| duration (Integer, Optional)     |                                     |
| errors (Array\[Error], Optional) |                                     |
| infos (Array\[Info], Optional)   |                                     |
| success (Boolean, Optional)      |                                     |
| textMessage (String, Optional)   |                                     |

**Example**

```json
{
    "isSuccess": true,
    "duration": 3896,
    "textMessage": null,
    "errors": null,
    "infos": null,
    "bookingNumber": "ADCO2203011523483",
    "voucherCode": "AXOLXHLp",
    "voucherValid": true,
    "trackingCode": "track_xbhwiFai1HNQNCQLe2PmvdxJu/rd5zEG7NGuvjHI5CY=",
    "discountAmount": 1000,
    "percentOff": null,
    "type": "AMOUNT",
    "success": true
}
```

***

### Voucher usage confirmation API <a href="#voucher-usage-confirmation-api" id="voucher-usage-confirmation-api"></a>

GET: /api/payments/voucher/redeem

Redeem voucher for specific booking

#### Request Body <a href="#request-body_1" id="request-body_1"></a>

| Parameter                        | Description                        |
| -------------------------------- | ---------------------------------- |
| bookingNumber (String, Required) | Booking identifier                 |
| voucherCode (String, Required)   | Voucher code                       |
| trackingCode (String, Required)  | Tracking code used in api validate |

**Example**

```json
{
    "bookingNumber": "ADCO2203011523483",
    "trackingCode": "track_xbhwiFai1HNQNCQLe2PmvdxJu/rd5zEG7NGuvjHI5CY="
    "voucherCode": "AXOLXHLp"
}
```

#### Response <a href="#response_1" id="response_1"></a>

| Parameter                        | Description                           |
| -------------------------------- | ------------------------------------- |
| bookingNumber (String)           | Booking identifier                    |
| redeemValid (Boolean)            | Confirmation of success using Voucher |
| voucherCode (String)             | Voucher code                          |
| duration (Integer, Optional)     |                                       |
| errors (Array\[Error], Optional) |                                       |
| infos (Array\[Info], Optional)   |                                       |
| success (Boolean, Optional)      |                                       |
| textMessage (String, Optional)   |                                       |

**Example**

```json
    {
        "isSuccess": true,
        "duration": 6508,
        "textMessage": null,
        "errors": null,
        "infos": null,
        "voucherCode": "gtd_fpt_test",
        "bookingNumber": "ADCO2203101541927",
        "redeemValid": true,
        "success": true
    }
```

***

### Booking Payment Request API <a href="#booking-payment-request-api" id="booking-payment-request-api"></a>

GET: /api/partner/place-order

Request payment booking - initiate payment order

Note

* Security requirements: Encrypt data and include a digital signature
* Request: Does not require encryption and includes a digital signature
* Response: Part of the response data is required to be encrypted and accompanied by a digital signature

#### Request <a href="#request" id="request"></a>

| Parameter                               | Description               |
| --------------------------------------- | ------------------------- |
| bookingNumber query (string, required), | Reference code to booking |

```
- bookingNumber `query` (string, required),

    !!! quote ""

        Reference code to booking
```

#### Response <a href="#response_2" id="response_2"></a>

<details>

<summary>Model</summary>

* result (String, optional),

  Information returned in the format:

  ````json
  ```
  <payment_url>?key=<encrypted_key>?data=<encrypted_data>
  ```

  *Signature data schema:*

  ``` 
  <access_code>|<booking_number>|<product_type>|<total_amount>
  ```

  *Original data schema:*
  ```
  <access_code>|<booking_number>|<product_type>|<signature>|<total_amount>
  ```

  - access_code (String, required)

      !!! quote ""

          Access code provided by Gotadi to Partners.

  - bookingNumber (String, optional)

      !!! quote ""

          Code used to refer to booking

  - product_type (String, optional)

      !!! quote ""

          Type of product, whose value is AIR or HOTEL corresponding to the type of product purchased

  - total_amount (String, optional)

      !!! quote ""

          Total payment amount

  - payment_url (String, required)

      !!! quote ""

          URL navigate to payment page

  - encrypted_key (String, required)

      !!! quote ""

          Key decrypts (encrypted) data. How to decrypt refer to the section: Encryption of transmission data and digital signature authentication

  - encrypted_data (String, required)

      !!! quote ""

          Data with digital signature (encrypted). How to decrypt refer to the section: Encryption of transmission data and digital signature authentication
  ````
* duration (integer, optional),
* errors (Array\[Error], optional),
* infos (Array\[Info], optional),
* success (boolean, optional),
* textMessage (string, optional)

</details>

***

### Payment Recording and Booking Commit API <a href="#payment-recording-and-booking-commit-api" id="payment-recording-and-booking-commit-api"></a>

POST: /api/partner/commit

Yêu cầu commit booking được cập nhật đầy đủ thông tin và hoàn tất thanh toán

Chú ý

* Security requirements: Encrypt data and include a digital signature
* Request: Does not require encryption and includes a digital signature
* Response: Part of the response data is required to be encrypted and accompanied by a digital signature

#### Request Body <a href="#request-body_2" id="request-body_2"></a>

Model

<details>

<summary>Model</summary>

* key (string, required),

  Data decrypted key. How to decrypt refer to the section: Encryption of transmission data and digital signature authentication
* data (string, required),

  Data with digital signature (encrypted). How to decrypt refer to the section: Encryption of transmission data and digital signature authentication

  *Signature data schema:*

  ```
  <access_code>|<booking_number>|<partner_trans_id>|<product_type>
  ```

  *Original data schema:*

  ```
  <access_code>|<booking_number>|<partner_trans_id>|<product_type>|<signature>
  ```

  * access\_code (String, required)

    Access code provided by Gotadi to Partners.
  * bookingNumber (String, required)

    Code used to refer to booking
  * partner\_trans\_id (String, optional)

    Partner transaction identifier. If the partner does not pass a value to this field, the default value will be assigned using booking\_number
  * product\_type (String, required)

    Type of product, whose value is AIR or HOTEL corresponding to the type of product purchased

</details>

Example

#### Response <a href="#response_3" id="response_3"></a>

Model

<details>

<summary>Model</summary>

* key (String, required)

  Data decrypted key. How to decrypt refer to the section: Encryption of transmission data and digital signature authentication
* data (String, required)

  Data with digital signature (encrypted). How to decrypt refer to the section: Encryption of transmission data and digital signature authentication

  *Signature data schema:*

  ```
  <access_code>|<booking_number>|<error_code>|<product_type>|<properties>|<return_url>|<total_amount>
  ```

  *Original data schema:*

  ```
  <access_code>|<booking_number>|<error_code>|<product_type>|<properties>|<return_url>|<signature>|<total_amount>
  ```

  * access\_code (String, required)

    Access code provided by Gotadi to Partners.
  * booking\_number (String, required)

    Code used to refer to booking
  * error\_code (String, required)

    Error code
  * product\_type (String, optional)

    Type of product, whose value is AIR or HOTEL corresponding to the type of product purchased
  * properties (String, optional)

    …
  * return\_url (String, optional)

    …
  * total\_amount (Double, required)

    …

</details>

***

### API to retrieve Booking Details After Ticket Issuance

GET: /api/products/final-booking-detail

**Description:**

This API is optimized to retrieve the booking status for use in the payment process (its usage is similar to the **booking-detail API**). It also adds enhanced handling for both successful and failed cases.

* In the **happy case** (success), the API immediately returns the result.
* In the **failure case**, the API automatically retries to fetch the latest booking status and continues returning results until the configured timeout is reached.

Parameter

<details>

<summary>Parameter</summary>

* booking\_number (String, Required)\
  Booking Reference Code

</details>

**Response**

**Code 200**

> OK

**Model**

<details>

<summary>Model</summary>

* orgCode (String, Optional)\
  Organization code referencing the creator of the booking.
* branchCode (String, Optional)\
  Branch code referencing the creator of the booking.
* agencyCode (String, Optional)\
  Agency code referencing the creator of the booking.
* agentCode (String, Optional)\
  Agent (staff) code referencing the creator of the booking.
* customerCode (String, Optional)\
  Customer code referencing the creator of the booking.
* id (String, Optional)\
  Unique ID of the booking.
* bookingNumber (String, Optional)\
  Reference code of the booking.
* bookingCode (String, Optional)\
  Code describing the basic information of the booking.
* bookingType (String, Optional)\
  Booking type: `FLIGHT` or `HOTEL`, depending on the purchased product.
* bookingInfo (BookingInfoDTO, Optional)\
  Detailed booking information.
* groupPricedItineraries (GroupPricedItineraryDTO\[], Optional)\
  Group itinerary details (already specified in the **Search** section).
* travelerInfo (TravelerInfoDTO, Optional)\
  Passenger and contact information.
* channelType (String, Optional)\
  Distribution channel type: `B2B` or `B2C`.
* saleChannel (String, Optional)\
  Sales channel. Example: `B2B_WEB`, `B2B_APP`, etc.
* supplierType (String, Optional)\
  Supplier type. Example: `AIR`, `HOTEL`, etc.
* bookingDate (String, Optional)\
  Booking creation date (reservation date).

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.gotadi.com/english/b2b2c-partner/api-method/payment-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
