openapi: 3.0.1
info:
  title: Transfer
  description: >-
    Transfer funds between your currency accounts.


    __Authentication Header__
      ```
        Authorization: {your_credentials}
      ```
    Replace `{your_credentials}` with your base64-encoded Basic Auth username
    and password given to you by your Implementation Manager.

    <br /> <br />

    You **must** use the `Authorization` header for any request you send to our
    Account APIs.


    __Accept Header__
      ```
        Accept: application/vnd.worldpay.accounts.transfer-v1+json
      ```
    We use the Accept header to identify which version of our API you are using.
    You must use the Accept header for any request you send to our Account APIs.

    <br /><br />


    __DNS Whitelisting__  

    Whitelist the following URLs:

    * `https://try.access.worldpay.com/`

    * `https://access.worldpay.com/`


    Please ensure you use DNS whitelisting, not explicit IP whitelisting.
  version: v1
  x-metadata:
    category:
      - Accounts
    business:
      - Enterprise
    catalog-list: true
    generated: false
  license:
    name: Worldpay
    url: developers.worldpay.com/license
servers:
  - url: https://try.access.worldpay.com
    description: testing (try)
  - url: https://access.worldpay.com
    description: live
paths:
  /accounts/transfer:
    post:
      summary: Transfer funds
      description: Transfer funds between your accounts.
      operationId: transferApi
      parameters:
        - name: WP-CorrelationId
          in: header
          schema:
            type: string
            description: Optional ID to trace requests, if not provided, it is generated.
          example: 15cd16b2-7b82-41cb-9b11-21be9dacad88
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransferRequest'
            examples:
              /accouts/transfer:
                description: Transfer money between accounts.
                value:
                  sourceAccountNumber: '1111550000000001'
                  targetAccountNumber: '1111550000000002'
                  amount: 123.45
                  narrative: CurrencyTransfer12
                  quoteID: Q0000000BV
          application/vnd.worldpay.accounts.transfer-v1+json:
            schema:
              $ref: '#/components/schemas/TransferRequest'
            examples:
              /accouts/transfer:
                description: Transfer money between accounts.
                value:
                  sourceAccountNumber: '1111550000000001'
                  targetAccountNumber: '1111550000000002'
                  amount: 123.45
                  narrative: CurrencyTransfer12
                  quoteID: Q0000000BV
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransferResponse'
            application/vnd.worldpay.accounts.transfer-v1+json:
              schema:
                $ref: '#/components/schemas/TransferResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtendedAccessErrorResponse'
              examples:
                Bad request:
                  $ref: '#/components/examples/400'
            application/vnd.worldpay.accounts.transfer-v1+json:
              schema:
                $ref: '#/components/schemas/ExtendedAccessErrorResponse'
              examples:
                Bad request:
                  $ref: '#/components/examples/400'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseAccessErrorResponse'
              examples:
                Unauthorized:
                  $ref: '#/components/examples/401'
            application/vnd.worldpay.accounts.transfer-v1+json:
              schema:
                $ref: '#/components/schemas/BaseAccessErrorResponse'
              examples:
                Unauthorized:
                  $ref: '#/components/examples/401'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseAccessErrorResponse'
              examples:
                Forbidden:
                  $ref: '#/components/examples/403'
            application/vnd.worldpay.accounts.transfer-v1+json:
              schema:
                $ref: '#/components/schemas/BaseAccessErrorResponse'
              examples:
                Forbidden:
                  $ref: '#/components/examples/403'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseAccessErrorResponse'
              examples:
                Not Found:
                  $ref: '#/components/examples/404'
            application/vnd.worldpay.accounts.transfer-v1+json:
              schema:
                $ref: '#/components/schemas/BaseAccessErrorResponse'
              examples:
                Not Found:
                  $ref: '#/components/examples/404'
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseAccessErrorResponse'
              examples:
                Server Error:
                  $ref: '#/components/examples/500'
            application/vnd.worldpay.accounts.transfer-v1+json:
              schema:
                $ref: '#/components/schemas/BaseAccessErrorResponse'
              examples:
                Server Error:
                  $ref: '#/components/examples/500'
components:
  schemas:
    BaseAccessErrorResponse:
      type: object
      properties:
        errorName:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
      additionalProperties: false
    ExtendedAccessErrorResponse:
      type: object
      properties:
        errorName:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        validationErrors:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrors'
          nullable: true
      additionalProperties: false
    TransferRequest:
      type: object
      properties:
        sourceAccountNumber:
          type: string
          nullable: false
          description: The 16-digit transfer source account number.
        targetAccountNumber:
          type: string
          nullable: false
          description: A 16-digit transfer destination account number.
        amount:
          type: number
          format: double
          description: >-
            A decimal value for the transfer. Currency is defined by the source
            account currency.
        narrative:
          type: string
          nullable: false
          description: A description about the transfer.
        quoteId:
          type: string
          nullable: false
          description: >-
            The ID of the quote of an exchange rate for the transfer. Not
            currently used - can set as empty guid value (all zeros).
      additionalProperties: false
    TransferResponse:
      type: object
      additionalProperties: false
    ValidationErrors:
      type: object
      properties:
        errorName:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        jsonPath:
          type: string
          nullable: true
      additionalProperties: false
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  examples:
    '400':
      value:
        errorName: bodyDoesNotMatchSchema
        message: The json body provided does not match the expected schema
        validationErrors:
          - errorName: fieldHasInvalidValue
            message: Source account number must be 16 characters
            jsonPath: $.SourceAccountNumber
    '401':
      value:
        errorName: Unauthorized
        message: Unauthorized request
    '403':
      value:
        errorName: Forbidden
        message: Authorisation Failed for this Domain
    '404':
      value:
        errorName: Not Found
        message: Could not find details for accountNumber {accountNumber}
    '500':
      value:
        httpStatusCode: internalErrorOccurred
        message: Something went wrong
security:
  - basicAuth: []
