# Retrieve a transfer voucher

> Retrieve the voucher download URL for a successful transfer. Download the voucher within 30 minutes of obtaining the URL, as the link may expire after that time.

```yaml
openapi: 3.1.0
x-onerway-docs-version: original
x-onerway-spec-key: transfer/v3-transactions/voucher-query
info:
  title: Retrieve a transfer voucher
  version: original
  description: Retrieve the voucher download URL for a successful transfer.
    Download the voucher within 30 minutes of obtaining the URL, as the link may
    expire after that time.
servers:
  - url: https://sandbox-transfer-api.onerway.com
    description: sandbox
  - url: https://transfer-api.onerway.com
    description: production
paths:
  /api/v3/txn/voucherQuery:
    post:
      summary: Retrieve a transfer voucher
      description: Retrieve the voucher download URL for a successful transfer.
        Download the voucher within 30 minutes of obtaining the URL, as the link
        may expire after that time.
      parameters:
        - name: ApiKey
          in: header
          required: true
          description: Account service API key assigned by Onerway, supplied in the
            request header. Use the key for the same environment as the request
            domain.
          schema:
            type: string
            description: Account service API key assigned by Onerway, supplied in the
              request header. Use the key for the same environment as the
              request domain.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                transferId:
                  type: integer
                  description: Onerway payment identifier.
                  x-onerway-constraints:
                    - kind: rule
                      text: Supply transferId or requestId. If both are supplied, they must identify
                        the same payment.
                    - kind: rule
                      text: Only a transfer whose underlying payout status is S is eligible. An
                        unsuccessful transfer cannot provide a success voucher.
                        Failure to obtain the voucher produces an error.
                requestId:
                  type: string
                  description: Merchant-generated business reference for the payout.
                onBehalfOf:
                  type: string
                  description: Merchant number that the request applies to. Supply it only when
                    making a request on behalf of another merchant.
            examples:
              default:
                summary: Request structure (replace with your merchant data)
                value:
                  requestId: demo_transfer_001
      responses:
        "200":
          description: Success example
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      respCode:
                        type: string
                        description: Response code; `20000` indicates successful request processing. All
                          other values are error codes.
                      respMsg:
                        type: string
                        description: Human-readable description of the response code.
                      data:
                        type: object
                        properties:
                          merchantNo:
                            type: string
                            description: Merchant number of the request initiator.
                          onBehalfOf:
                            type: string
                            description: Merchant number that the request applies to. Supply it only when
                              making a request on behalf of another merchant.
                          requestId:
                            type: string
                            description: Merchant-generated business reference for the payout.
                          transferId:
                            type: integer
                            description: Onerway payment identifier.
                          downloadUrl:
                            type: string
                            description: Download URL for the electronic payment receipt. Download the
                              receipt within 30 minutes of obtaining the URL, as
                              the link may expire after that time.
                        description: Business data on success; do not consume as valid business data on
                          failure
                        x-onerway-constraints:
                          - kind: rule
                            text: Use downloadUrl to retrieve the voucher.
                      error:
                        type: object
                        properties:
                          type:
                            type: string
                            description: Error type.
                          code:
                            type: string
                            description: Endpoint error identifier.
                          declineCode:
                            type: string
                            description: Decline reason code; may be empty.
                          message:
                            type: string
                            description: Detailed error description
                          param:
                            type: string
                            description: Failed field or condition; may be empty when no field is identified
                          docUrl:
                            type: string
                            description: Link to error documentation; may be empty.
                          requestId:
                            type: string
                            description: Server-generated error trace identifier, req_ plus 32 hexadecimal
                              characters; not the merchant requestId
                          errorDetails:
                            type: array
                            description: Error details; see the variants below
                            items:
                              type: object
                              properties:
                                errorCode:
                                  type: string
                                  description: Business or validation detail code.
                                message:
                                  type: string
                                  description: Detail message
                        description: Structured failure information; not present for every failure path
                  - type: object
                    properties:
                      respCode:
                        type: string
                      respMsg:
                        type: string
                      error:
                        type: object
                        properties:
                          type:
                            type: string
                          code:
                            type: string
                          message:
                            type: string
                          requestId:
                            type: string
                          errorDetails:
                            type: array
                            items:
                              type: object
                              properties:
                                errorCode:
                                  type: string
                                message:
                                  type: string
                              required:
                                - errorCode
                                - message
                          param:
                            type: string
                        required:
                          - type
                          - code
                          - message
                          - requestId
                          - errorDetails
                          - param
                    required:
                      - respCode
                      - respMsg
                      - error
              examples:
                "50120":
                  summary: Omitting both transferId and requestId.
                  description: Omitting both transferId and requestId.
                  value:
                    respCode: "50120"
                    respMsg: requestId or transferId is invalid
                    error:
                      type: business_error
                      code: "50120"
                      message: requestId or transferId is invalid
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        - errorCode: "50120"
                          message: requestId or transferId is invalid
                      param: transferId
                success:
                  summary: Success example
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      merchantNo: "10000"
                      requestId: demo_transfer_001
                      transferId: 1000001
                      downloadUrl: https://developers.onerway.com/example-voucher.pdf
                failure:
                  summary: Omitting both transferId and requestId.
                  value:
                    respCode: "50120"
                    respMsg: requestId or transferId is invalid
                    error:
                      type: business_error
                      code: "50120"
                      message: requestId or transferId is invalid
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        - errorCode: "50120"
                          message: requestId or transferId is invalid
                      param: transferId
```
