openapi: 3.0.0
info:
  title: rezio API Documentation - B2B Partners
  description: '> **Beta** — This API is in beta. Our API program is still being finalized, access is granted on request, and the interface may still change; changes are announced here. To request access, contact <a href="mailto:service@rezio.io">service@rezio.io</a>.


    The API document is designed for use by organizations needed to integrated with the organization who use rezio''s reservation system. The B2B API is used to carry out the following tasks: Product search, Session availability, Booking infomation search, Place an order, and Cancel the order. Email <a href="mailto:service@rezio.io">service@rezio.io</a> to enable B2B API access; the supplying merchant then provides the <b>Store UUID</b> and <b>Distributor API Key</b>.'
  contact:
    name: rezio API Support
    email: service@rezio.io
  version: 0.0.17
servers:
- url: https://b2b.rezio.io
  description: Production
paths:
  /b2b/product:
    get:
      tags:
      - B2B
      summary: Search for available products
      operationId: getProducts
      responses:
        '200':
          $ref: '#/components/responses/product_list_response'
        '401':
          $ref: '#/components/responses/unauthorized_response'
      security:
      - X-Auth-Store: []
        X-Auth-Distr: []
  /b2b/{productUuid}/{salesOptionId}/sessions:
    get:
      tags:
      - B2B
      summary: Search for available date and session
      operationId: querySalesOption
      parameters:
      - $ref: '#/components/parameters/product_uuid_in_path'
      - $ref: '#/components/parameters/sales_option_uuid_in_path'
      - $ref: '#/components/parameters/start_date_in_query'
      - $ref: '#/components/parameters/end_date_in_query'
      responses:
        '200':
          $ref: '#/components/responses/query_sales_option_response'
        '401':
          $ref: '#/components/responses/unauthorized_response'
      security:
      - X-Auth-Store: []
        X-Auth-Distr: []
  /b2b/{productUuid}/bookingInfo:
    get:
      tags:
      - B2B
      summary: Search for Booking Information
      operationId: queryBookingInfo
      parameters:
      - $ref: '#/components/parameters/product_uuid_in_path'
      responses:
        '200':
          $ref: '#/components/responses/booking_response'
        '401':
          $ref: '#/components/responses/unauthorized_response'
      security:
      - X-Auth-Store: []
        X-Auth-Distr: []
  /b2b/order:
    post:
      tags:
      - B2B
      summary: Place an order
      operationId: orderProduct
      requestBody:
        $ref: '#/components/requestBodies/order_request_body'
      responses:
        '200':
          $ref: '#/components/responses/order_response'
        '401':
          $ref: '#/components/responses/unauthorized_response'
      security:
      - X-Auth-Store: []
        X-Auth-Distr: []
  /b2b/order/{orderNo}:
    get:
      tags:
      - B2B
      summary: Search for order
      operationId: getOrder
      parameters:
      - $ref: '#/components/parameters/order_number_in_path'
      responses:
        '200':
          $ref: '#/components/responses/get_order_response'
        '401':
          $ref: '#/components/responses/unauthorized_response'
      security:
      - X-Auth-Store: []
        X-Auth-Distr: []
  /b2b/{orderNo}/applyCancel:
    post:
      tags:
      - B2B
      summary: Cancel the order
      operationId: applyCancel
      parameters:
      - $ref: '#/components/parameters/order_number_in_path'
      requestBody:
        $ref: '#/components/requestBodies/cancel_request_body'
      responses:
        '200':
          $ref: '#/components/responses/cancel_response'
        '401':
          $ref: '#/components/responses/unauthorized_response'
      security:
      - X-Auth-Store: []
        X-Auth-Distr: []
components:
  schemas:
    pickup_request:
      title: 'Request: Pickup'
      properties:
        id:
          description: Pickup info ID (for SYSTEM type)
          type: string
          example: 2a9263c8-d98c-4121-b609-5a51755c6c1f
        request:
          description: Pickup requirement (for CUSTOM type)
          type: string
          example: 煙波大飯店 花蓮縣花蓮市中美路142號
        time:
          description: Pickup duration (for CUSTOM type, it has be between startTime and endTime.)
          type: string
          example: '13:30'
      type: object
    pickup_response:
      title: 'Response: Pickup'
      properties:
        id:
          description: Pickup info ID
          type: string
          example: 2a9263c8-d98c-4121-b609-5a51755c6c1f
        type:
          description: 'Pickup type: SYSTEM/ CUSTOM'
          type: string
          example: SYSTEM
        label:
          description: Pickup location
          type: string
          example: 花蓮火車站正門
        address:
          description: Pickup address
          type: string
          example: 花蓮縣花蓮市國聯一路100號
        vehicle:
          description: Vehicle (for CUSTOM type)
          type: string
          example: 豪華轎車
        instructions:
          description: Pickup instructions
          type: string
          example: 請在火車站右側等待區，找尋穿綠色背心的工作人員報到
        date:
          description: Pickup date
          type: string
          example: '2021-08-18'
        startTime:
          description: Pickup start time
          type: string
          example: '13:00'
        endTime:
          description: Pickup end time
          type: string
          example: '13:50'
        latitude:
          description: Latitude of pickup location
          type: string
          example: '23.9938653'
        longitude:
          description: Longitude of pickup location
          type: string
          example: '121.6022198'
      type: object
    bookingInfo_result:
      title: Booking Information Response
      properties:
        key:
          description: Keys
          type: string
          example: firstName
        title:
          description: View text
          type: string
          example: 名
        type:
          description: Info type
          type: string
          example: string
        option:
          description: Available options
          type: array
          items:
            description: Text
            type: string
            example: mobile
        required:
          description: Required or not
          type: boolean
          example: true
      type: object
    bookingInfoType:
      title: Booking Info Types and Order Field Mapping
      description: "\n| type            \t|Information|Example|\n|-----------------\t|------------------------------------------------------------------\t|--------------------------------------------------------------------\t|\n| string          \t| \"{key}\": \"{value}\"                                              \t| \"firstName\": \"name\"                                            \t|\n| email           \t| \"{key}\": \"{value}\"                                              \t| \"email\": \"test@test.test\"                                      \t|\n| date            \t| \"{key}\": \"Y-m-d\"                                             \t| \"birthday\": \"2021-01-01\"                                       \t|\n| datetime        \t| \"{key}\": \"Y-m-d H:i:s\"                                       \t| \"departureDateTime\": \"2021-12-20 10:20:00\"                     \t|\n| phone           \t| \"{key}\":{\"countryCode\":country code, \"number\":\"phone\"}            \t| \"mobile\": {\"countryCode\":886, \"number\":\"987654321\"}        \t|\n| shoe            \t| \"{key}\":{\"type\":\"category from option\", \"value\":200}             \t| \"shoeSize_mm\": {\"type\":\"Man\", \"value\":275}                 \t|\n| bool            \t| \"{key}\": true                                                  \t| \"31a95a4e-a5e2-4b7c-8c5a-f7a417403b83\": false                    \t|\n| list            \t| \"{key}\":[\"{value1}\",\"{value2}\",\"{value3}\"]                        \t| \"a74aeff8-c350-467a-aa18-7d4a6ec6a412\": [\"A\",\"B\"]            \t|\n| duringItinerary \t| \"{key}\": {\"type\":\"option key\", \"value\":\"corresponding value\"} \t| \"contactAccount\": {\"type\":\"mobile\", \"value\":\"987654321\"} \t|"
      type: object
    error_code:
      title: Error Codes
      description: "Result code. `S0000` means success. Business errors are also returned with HTTP 200 — always check this field to determine success or failure.\n\n|Error code|Error reason|\n| ------------ \t| ---------------------------------\t                                                                |\n| V0001     \t|Lack of parameters|\n| V0002     \t|Error parameters format|\n| E0002     \t|Info not found|\n| F0001     \t|Something went wrong|\n| B0001     \t|Error add-on item(extras)purchase amount|\n| B0002     \t|No available product for sale at this session|\n| B0003     \t|No pickup option selected|\n| B0004     \t|Error selected pickup option|\n| B0005     \t|The selected pickup time is not within the available pickup range|\n| B0006     \t|No language of guide service selected|\n| B0007     \t|Error language selected|\n| B0008     \t|Error booking info option|\n| B0009     \t|No required booking info|\n| B0010     \t|Error purchaseContent items not found|\n| B0011     \t|purchaseContent error purchase amount|\n| B0012     \t|Error traveler information amount|\n| B0013     \t|Add-on items(extras)not exist|"
      type: string
      example: S0000
  responses:
    product_list_response:
      description: OK
      content:
        application/json:
          schema:
            properties:
              code:
                $ref: '#/components/schemas/error_code'
              codeMessage:
                description: Responses
                type: string
                example: SUCCESS
              data:
                description: Return data
                properties:
                  products:
                    description: Product list
                    type: array
                    items:
                      properties:
                        id:
                          description: Product ID
                          type: string
                          example: 2c935076-ac44-41cf-943f-8e5fdd29bdf1
                        productCode:
                          description: Product code
                          type: string
                          example: MN8SEH
                        title:
                          description: Product title
                          type: string
                          example: '[測試票券] 花蓮｜滑翔傘飛行體驗、俯瞰壯麗的太平洋'
                        language:
                          description: Language of guide service
                          properties:
                            audioHeadset:
                              description: Language of Audio Guide Device
                              type: array
                              items:
                                description: Language code
                                type: string
                              example:
                              - en
                              - cmn
                            guide:
                              description: Languages spoken by Guides
                              type: array
                              items:
                                description: Language code
                                type: string
                              example:
                              - en
                              - cmn
                            translation:
                              description: Languages spoken by Guide On-site
                              type: array
                              items:
                                description: Language code
                                type: string
                              example:
                              - en
                              - cmn
                            written:
                              description: Language in Printed Materials
                              type: array
                              items:
                                description: Literal code
                                type: string
                              example:
                              - en-US
                              - ja-JP
                              - zh-CN
                              - zh-TW
                          type: object
                        extras:
                          description: Add-on Items
                          type: array
                          items:
                            properties:
                              id:
                                description: Add-on Items ID
                                type: string
                                example: 9b2b7cfc-fd35-4481-8cb3-ef64caaff442
                              label:
                                description: Add-on Items name
                                type: string
                                example: GOPRO影片
                              priceType:
                                description: 'Type of add-on items: ORDER/QUANTITY.<br><b>ORDER<b>: purchase by order (maximum quantity limits to 1); <b>QUANTITY</b>: purchase by number of selected add-on items.'
                                type: string
                                example: ORDER
                              quantity:
                                description: Available amount (-1 represents unlimited)
                                type: number
                                example: 1.0
                              price:
                                description: Price
                                type: number
                                example: 500.0
                            type: object
                        salesOptions:
                          description: Sales options list
                          type: array
                          items:
                            properties:
                              id:
                                description: Sales options ID
                                type: string
                                example: c8873111-73ff-4218-b0cf-c40796f05e01
                              title:
                                description: Sales options name
                                type: string
                                example: 滑翔傘飛行體驗＋GOPRO全程攝影
                            type: object
                      type: object
                type: object
            type: object
    query_sales_option_response:
      description: OK
      content:
        application/json:
          schema:
            properties:
              code:
                $ref: '#/components/schemas/error_code'
              codeMessage:
                description: Responses
                type: string
                example: SUCCESS
              data:
                description: Return data
                properties:
                  sessions:
                    description: Available session info
                    properties:
                      id:
                        description: Session ID
                        type: string
                        example: b3ca9362-22de-4a24-b9c7-2fb866624ca8
                      startDate:
                        description: Start date
                        type: string
                        example: '2021-08-18'
                      startTime:
                        description: Start date
                        type: string
                        example: '14:00'
                      endDate:
                        description: End date
                        type: string
                        example: '2021-08-18'
                      endTime:
                        description: End date
                        type: string
                        example: '15:00'
                      currencyCode:
                        description: Currency sign
                        type: string
                        example: TWD
                      prices:
                        description: Price of sales options
                        type: array
                        items:
                          properties:
                            id:
                              description: Price option ID
                              type: string
                              example: 76d2d935-4a55-4c09-80df-42311e7bbaa9
                            type:
                              description: 'Type of price option: PERSON/ ITEM'
                              type: string
                              example: PERSON
                            label:
                              description: Name
                              type: string
                              example: Participant
                            price:
                              description: Price
                              type: number
                              example: 3000.0
                          type: object
                      quotaAvailable:
                        description: Available quota (-1:UNLIMITED)
                        type: number
                        example: 20.0
                      pickup:
                        description: Pickup info
                        properties:
                          departure:
                            description: Outbound pickup info
                            type: array
                            items:
                              $ref: '#/components/schemas/pickup_response'
                          return:
                            description: Return pickup info
                            type: array
                            items:
                              $ref: '#/components/schemas/pickup_response'
                        type: object
                    type: object
                type: object
            type: object
    order_response:
      description: OK
      content:
        application/json:
          schema:
            properties:
              code:
                $ref: '#/components/schemas/error_code'
              codeMessage:
                description: Responses
                type: string
                example: SUCCESS
              data:
                description: Return data
                properties:
                  orderNo:
                    description: Order number
                    type: string
                    example: DS210713SN4361
                  currencyCode:
                    description: Currency
                    type: string
                    example: TWD
                  totalAmount:
                    description: Price of payment
                    type: number
                    format: float
                    example: 3200.0
                  vouchers:
                    description: Voucher information. (Only products that are instantly confirmed and are using rezio QR Code have relevant information.)
                    type: array
                    items:
                      properties:
                        qrCodeStr:
                          description: String of QR Code, please generate the standard QR Code by ISO 18004.
                          type: string
                          example: rezio://redeem?code=1234567890
                      type: object
                type: object
            type: object
    get_order_response:
      description: OK
      content:
        application/json:
          schema:
            properties:
              code:
                $ref: '#/components/schemas/error_code'
              codeMessage:
                description: Responses
                type: string
                example: SUCCESS
              data:
                description: Return data
                properties:
                  orderNo:
                    description: Order number
                    type: string
                    example: DS210713SN4361
                  status:
                    description: Order status：CANCELED / NEW_UNPAID / NEW_PAID / PENDING / CONFIRMED / CHECKIN / NO_SHOW / CANCELING / CANCEL_REQUESTED / DEPARTED
                    type: string
                    example: CONFIRMED
                  currencyCode:
                    description: Currency
                    type: string
                    example: TWD
                  totalAmount:
                    description: Price of payment
                    type: number
                    format: float
                    example: 3200.0
                  vouchers:
                    description: Voucher information.
                    type: array
                    items:
                      properties:
                        qrCodeStr:
                          description: String of QR Code, please generate the standard QR Code by ISO 18004.
                          type: string
                          example: rezio://redeem?code=1234567890
                        redeemTimes:
                          description: Number of Times for Redeemed
                          type: integer
                          example: 1
                        totalRedeemableTimes:
                          description: Number of Times for Redemption
                          type: integer
                          example: 1
                        status:
                          description: Voucher Status：<br>NONE：No voucher / VALID：Available / USED：Redeemed / LOCKED：Awaiting Cancellation / INVALID / EXPIRED：Overdue
                          type: string
                          example: USED
                          enum:
                          - NONE
                          - VALID
                          - USED
                          - LOCKED
                          - INVALID
                          - EXPIRED
                        usedAt:
                          description: Redeem time
                          type: string
                          example: '2021-07-21 10:01:00'
                        invalidAt:
                          description: Actual time of invalidation
                          type: string
                          example: ''
                        sessionStartAt:
                          description: Order's session start time. ("Null" for Ticket (No sessions))
                          type: string
                          example: '2021-07-21 10:00:00'
                        sessionEndAt:
                          description: Order's session end time. ("Null" for Ticket (No sessions))
                          type: string
                          example: '2021-07-21 12:00:00'
                        ticketStartAt:
                          description: Ticket validity start time ("Null" for general products.)
                          type: string
                          example: ''
                        ticketEndAt:
                          description: Ticket validity end time ("Null" for general products.)
                          type: string
                          example: ''
                      type: object
                type: object
            type: object
    cancel_response:
      description: OK
      content:
        application/json:
          schema:
            properties:
              code:
                $ref: '#/components/schemas/error_code'
              codeMessage:
                description: Responses
                type: string
                example: SUCCESS
              data:
                description: Return data
                type: object
            type: object
    booking_response:
      description: OK
      content:
        application/json:
          schema:
            properties:
              code:
                $ref: '#/components/schemas/error_code'
              codeMessage:
                description: Responses
                type: string
                example: SUCCESS
              data:
                description: Return data
                properties:
                  bookingInfo:
                    description: Booking info
                    properties:
                      contact:
                        description: Contact information
                        type: array
                        items:
                          $ref: '#/components/schemas/bookingInfo_result'
                      order:
                        description: Traveler representative
                        type: array
                        items:
                          $ref: '#/components/schemas/bookingInfo_result'
                      participant:
                        description: Traveler information
                        type: array
                        items:
                          $ref: '#/components/schemas/bookingInfo_result'
                    type: object
                type: object
            type: object
    unauthorized_response:
      description: Authentication failed (missing or invalid `X-Auth-Store` / `X-Auth-Distr`)
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                example: 401
                description: Always 401
              status:
                type: string
                example: error
                description: Always "error"
              message:
                type: string
                example: Unauthorized access
                description: Error description
  parameters:
    product_uuid_in_path:
      name: productUuid
      in: path
      description: product ID
      required: true
      schema:
        type: string
        example: 2c935076-ac44-41cf-943f-8e5fdd29bdf1
    sales_option_uuid_in_path:
      name: salesOptionId
      in: path
      description: Sales options ID
      required: true
      schema:
        type: string
        example: c8873111-73ff-4218-b0cf-c40796f05e01
    start_date_in_query:
      name: startDate
      in: query
      description: Start date
      required: true
      schema:
        type: string
        example: '2021-08-18'
    end_date_in_query:
      name: endDate
      in: query
      description: End date
      required: true
      schema:
        type: string
        example: '2021-08-19'
    order_number_in_path:
      name: orderNo
      in: path
      description: Order Number
      required: true
      schema:
        type: string
        example: DS210709GC0272
  requestBodies:
    order_request_body:
      description: Place an order
      required: true
      content:
        application/json:
          schema:
            required:
            - productId
            - salesOptionId
            - sessionId
            - sessionDate
            - sessionTime
            - language
            - extras
            - pickup
            - purchaseContent
            - bookingInfo
            properties:
              productId:
                description: Product ID
                type: string
                example: 2c935076-ac44-41cf-943f-8e5fdd29bdf1
              salesOptionId:
                description: Sales options ID
                type: string
                example: c8873111-73ff-4218-b0cf-c40796f05e01
              sessionId:
                description: Session ID
                type: string
                example: b3ca9362-22de-4a24-b9c7-2fb866624ca8
              sessionDate:
                description: Selected booking date
                type: string
                example: '2021-08-18'
              sessionTime:
                description: Selected booking time
                type: string
                example: '14:00'
              language:
                description: If the item in the "Language of guide service" of "Query Product List" has value, it is required to fill in
                properties:
                  audioHeadset:
                    description: Selected language of audio guide device
                    type: string
                    example: en
                  guide:
                    description: Selected language spoken by guide
                    type: string
                    example: en
                  translation:
                    description: Selected language spoken by group guide on-site
                    type: string
                    example: en
                  written:
                    description: Selected language in printed materials
                    type: string
                    example: en-US
                type: object
              extras:
                description: Add-on Items list, please leave with [] if there is no add-on items required.
                type: array
                items:
                  properties:
                    id:
                      description: Add-on items ID
                      type: string
                      example: 9b2b7cfc-fd35-4481-8cb3-ef64caaff442
                    quantity:
                      description: Add-on items amount. (number > 0, and the maximum number will be 1 when priceType = "ORDER")
                      type: number
                      example: 1.0
                  type: object
              pickup:
                description: Pickup info
                properties:
                  departure:
                    $ref: '#/components/schemas/pickup_request'
                  return:
                    $ref: '#/components/schemas/pickup_request'
                type: object
              purchaseContent:
                description: Purchase content. (Only go with items to be purchased (quantity > 0).)
                type: array
                items:
                  properties:
                    id:
                      description: purchase content ID
                      type: string
                      example: 76d2d935-4a55-4c09-80df-42311e7bbaa9
                    quantity:
                      description: Purchase amount
                      type: number
                      example: 1.0
                  type: object
              bookingInfo:
                description: Booking info
                properties:
                  contact:
                    description: Contact information(change by the key of booking info)
                    type: array
                    items:
                      properties:
                        firstName:
                          type: string
                          example: Fiona
                      type: object
                  order:
                    description: Traveler representative(change by the key of booking info)
                    type: array
                    items:
                      properties:
                        firstName:
                          type: string
                          example: Lin
                      type: object
                  participant:
                    description: Traveler information(change by the key of booking info)
                    type: array
                    items:
                      type: array
                      items:
                        properties:
                          firstName:
                            type: string
                            example: Fiona
                        type: object
                type: object
            type: object
    cancel_request_body:
      description: Cancel order
      required: true
      content:
        application/json:
          schema:
            required:
            - reason
            properties:
              reason:
                description: Reason of cancel order
                type: string
                example: Reschedule my trip
            type: object
  securitySchemes:
    X-Auth-Store:
      type: apiKey
      description: '- Please fill in the Store UUID.'
      name: X-Auth-Store
      in: header
    X-Auth-Distr:
      type: apiKey
      description: '- Please fill in the Distributor API Key.'
      name: X-Auth-Distr
      in: header
tags:
- name: B2B
  description: B2B
