> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quidkey.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a payment transaction

> Creates a payment transaction for one customer, and answers with the one-time `checkout`, the hosted page that sends them to pay. A retry with the same key leaves it out: `:issueCheckout` recovers it. A request sent once can be answered the same way, if a dropped connection lost its first answer. `MERCHANT_CANNOT_TAKE_PAYMENT` means the merchant can't take a payment transaction in this currency from a customer in this country: it isn't set up for one yet, or such a payment transaction can't be routed to its receiving account.

Credentials: `partner`, `merchant`

Permission: `transactions:create`



## OpenAPI

````yaml /api-reference/v1/payment-api.json post /merchants/{id}/transactions
openapi: 3.1.0
info:
  title: Quidkey API
  version: 1.0.0
  description: >-
    The Quidkey public API.


    Within a version, a response can carry what this document doesn't list yet:
    a new field, a new value of an enum, a new error code. Handle a value you
    don't recognise rather than refusing the response. A client generated from
    this document turns an `enum` into a closed type unless told otherwise, so
    turn on its option for unknown values, such as openapi-generator's
    `enumUnknownDefaultCase`. A request is held to what's listed: a value it
    doesn't list is refused.
  contact:
    name: Quidkey
    url: https://docs.quidkey.com
servers:
  - url: https://api.quidkey.com/v1
security:
  - bearer: []
tags:
  - name: api_key
  - name: bank
  - name: bank_account
  - name: merchant
  - name: payment_link
  - name: payout
  - name: transaction
  - name: webhook_endpoint
paths:
  /merchants/{id}/transactions:
    post:
      tags:
        - transaction
      summary: Create a payment transaction
      description: >-
        Creates a payment transaction for one customer, and answers with the
        one-time `checkout`, the hosted page that sends them to pay. A retry
        with the same key leaves it out: `:issueCheckout` recovers it. A request
        sent once can be answered the same way, if a dropped connection lost its
        first answer. `MERCHANT_CANNOT_TAKE_PAYMENT` means the merchant can't
        take a payment transaction in this currency from a customer in this
        country: it isn't set up for one yet, or such a payment transaction
        can't be routed to its receiving account.


        Credentials: `partner`, `merchant`


        Permission: `transactions:create`
      operationId: transaction.create
      parameters:
        - name: id
          in: path
          required: true
          schema:
            minLength: 1
            type: string
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            1 to 255 printable ASCII characters with no spaces, quotes or
            backslashes, in double quotes as the IETF draft defines, or without
            them. We recommend a UUID. Make one for each thing you mean to
            happen once and store it before you send the request, so a retry
            after a crash sends the same key. Keys are scoped to your account
            and the endpoint, not to a token, so a new token or a rotated secret
            doesn't affect a retry. A partner and its merchant are separate
            accounts, so the same key sent with each credential starts two
            requests. Keys are kept for at least 7 days. After that, the same
            key starts a new request.
          schema:
            type: string
            minLength: 1
            maxLength: 257
            pattern: >-
              ^(?:([\x21\x23-\x5B\x5D-\x7E]{1,255})|"([\x21\x23-\x5B\x5D-\x7E]{1,255})")$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              if:
                properties:
                  simulation: {}
                required:
                  - simulation
              then:
                type: object
                required:
                  - is_test
                properties:
                  is_test:
                    const: true
                    type: boolean
              additionalProperties: false
              type: object
              required:
                - type
                - amount
                - order
                - customer_details
                - statement_descriptor
                - authorization
              properties:
                type:
                  type: string
                  enum:
                    - payment
                  description: What to create.
                amount:
                  type: object
                  allOf:
                    - $ref: '#/components/schemas/Money'
                    - type: object
                      required:
                        - value
                      properties:
                        value:
                          minimum: 1
                          maximum: 9999999
                          type: integer
                order:
                  $ref: '#/components/schemas/Order'
                customer_details:
                  additionalProperties: false
                  type: object
                  required:
                    - full_name
                    - email
                    - country
                  properties:
                    full_name:
                      minLength: 1
                      type: string
                    email:
                      format: email
                      maxLength: 320
                      type: string
                      pattern: >-
                        ^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
                    phone:
                      pattern: ^\+[1-9]\d{1,14}$
                      type: string
                    country:
                      pattern: ^[A-Z]{2}$
                      type: string
                      description: Decides routing.
                    billing_address:
                      anyOf:
                        - $ref: '#/components/schemas/AddressInput'
                        - type: 'null'
                  description: >-
                    The person paying, as a plain object. On the response,
                    `customer_details` is a link to these details.
                is_test:
                  default: false
                  description: >-
                    Creates a test payment transaction, which any merchant can
                    do before going live.
                  type: boolean
                statement_descriptor:
                  minLength: 1
                  maxLength: 18
                  description: >-
                    Becomes alphanumeric on the way to the bank. On a payment
                    transaction through a virtual account, the customer's
                    statement shows Quidkey's reconciliation reference instead.
                  type: string
                authorization:
                  $ref: '#/components/schemas/CheckoutAuthorization'
                rewards:
                  $ref: '#/components/schemas/RewardsInput'
                webhook_endpoints:
                  maxItems: 10
                  description: >-
                    Not for a partner, whose payment transactions report to the
                    partner's endpoint. Answers `UNKNOWN_WEBHOOK_ENDPOINT` if
                    one doesn't exist, isn't `active`, or doesn't take this
                    payment transaction's environment.
                  type: array
                  items:
                    $ref: '#/components/schemas/WebhookEndpointRequestLink'
                simulation:
                  $ref: '#/components/schemas/Simulation'
      responses:
        '201':
          description: The transaction, in the full view.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
            Location:
              description: The URL of the created resource.
              schema:
                type: string
          content:
            application/json:
              schema:
                additionalProperties: false
                type: object
                required:
                  - result
                  - entities
                  - not_included
                properties:
                  result:
                    $ref: '#/components/schemas/TransactionFull'
                  entities:
                    additionalProperties: false
                    description: Nothing can be included here.
                    type: object
                    properties: {}
                  not_included:
                    type: array
                    items:
                      $ref: '#/components/schemas/NotIncludedEntry'
        '400':
          description: >-
            `AMOUNT_TOO_LARGE`: The amount is more than this endpoint accepts.


            `CURRENCY_COUNTRY_MISMATCH`: This currency can't be used for a
            customer in this country.


            `CURRENCY_NOT_SUPPORTED`: This currency isn't supported.


            `CUSTOMER_COUNTRY_CONFLICT`: customer_details.country and
            customer_details.billing_address.country don't match.


            `CUSTOMER_COUNTRY_NOT_SUPPORTED`: Payment transactions from this
            customer's country aren't accepted.


            `IDEMPOTENCY_KEY_REQUIRED`: This endpoint requires an
            Idempotency-Key header.


            `REGION_NOT_SUPPORTED`: A region isn't supported for this country.


            `REWARDS_INVALID`: rewards needs extra_rewards, and each of
            extra_rewards and total_rewards is a decimal string from "0" to
            "99999999.99", with at most 2 decimal places.


            `SIMULATION_REQUIRES_TEST`: simulation needs is_test: true.


            `UNKNOWN_WEBHOOK_ENDPOINT`: `webhook_endpoints` names an endpoint
            that doesn't exist, isn't `active`, or doesn't take this payment
            transaction's environment.


            `VALIDATION_FAILED`: The request is malformed or failed validation.


            `WEBHOOK_ENDPOINTS_NOT_ALLOWED`: A partner's payment transactions
            report to the partner's endpoint, so it can't name endpoints.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - AMOUNT_TOO_LARGE
            - CURRENCY_COUNTRY_MISMATCH
            - CURRENCY_NOT_SUPPORTED
            - CUSTOMER_COUNTRY_CONFLICT
            - CUSTOMER_COUNTRY_NOT_SUPPORTED
            - IDEMPOTENCY_KEY_REQUIRED
            - REGION_NOT_SUPPORTED
            - REWARDS_INVALID
            - SIMULATION_REQUIRES_TEST
            - UNKNOWN_WEBHOOK_ENDPOINT
            - VALIDATION_FAILED
            - WEBHOOK_ENDPOINTS_NOT_ALLOWED
        '401':
          description: '`UNAUTHENTICATED`: A valid bearer token is required.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - UNAUTHENTICATED
        '403':
          description: >-
            `FORBIDDEN`: This credential doesn't have permission for this
            endpoint.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - FORBIDDEN
        '404':
          description: '`NOT_FOUND`: Not found.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - NOT_FOUND
        '406':
          description: '`NOT_ACCEPTABLE`: This endpoint doesn''t offer the format in Accept.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - NOT_ACCEPTABLE
        '409':
          description: >-
            `IDEMPOTENCY_IN_PROGRESS`: An earlier request with this
            Idempotency-Key hasn't finished. If this persists, contact support.


            `LIVE_PAYMENTS_NOT_ALLOWED`: This merchant can't take this live
            payment transaction now.


            `MERCHANT_CANNOT_TAKE_PAYMENT`: This merchant can't take a payment
            transaction in this currency from a customer in this country.


            `NO_RECEIVING_ACCOUNTS`: This merchant has nothing routed to receive
            this currency in this environment.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - IDEMPOTENCY_IN_PROGRESS
            - LIVE_PAYMENTS_NOT_ALLOWED
            - MERCHANT_CANNOT_TAKE_PAYMENT
            - NO_RECEIVING_ACCOUNTS
        '422':
          description: >-
            `BANK_NOT_AVAILABLE`: `bank` isn't one `GET /merchants/{id}/banks`
            lists for this payment transaction.


            `BANK_SELECTION_NOT_SUPPORTED`: A payment transaction in this
            currency from a customer in this country is paid on its provider's
            own page, with no choice of bank.


            `IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was used with a
            different request.


            `PAYMENT_LIMIT_EXCEEDED`: The amount is over a limit on what this
            merchant may take: on one payment transaction, on its daily or
            monthly total, or, on a USD payment, the payment provider's limit on
            one charge. A smaller amount may pass, and one over a daily or
            monthly total may pass later. Quidkey can raise the limit on one USD
            charge.


            `SIMULATION_NOT_SUPPORTED`: This test payment transaction won't use
            a route that can honour simulation.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - BANK_NOT_AVAILABLE
            - BANK_SELECTION_NOT_SUPPORTED
            - IDEMPOTENCY_KEY_REUSED
            - PAYMENT_LIMIT_EXCEEDED
            - SIMULATION_NOT_SUPPORTED
        '429':
          description: '`RATE_LIMITED`: Too many requests.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - RATE_LIMITED
        '500':
          description: '`INTERNAL_ERROR`: Something went wrong on our side.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - INTERNAL_ERROR
        '503':
          description: '`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          x-error-codes:
            - SERVICE_UNAVAILABLE
components:
  schemas:
    Money:
      description: An amount of money. Decimal values are refused, not rounded.
      additionalProperties: false
      type: object
      required:
        - value
        - currency
      properties:
        value:
          description: In the currency's ISO 4217 minor units, so GBP 45.00 is 4500.
          type: integer
        currency:
          pattern: ^[A-Z]{3}$
          type: string
    Order:
      description: >-
        The caller's order. Not unique: a reusable link puts it on every payment
        transaction.
      additionalProperties: false
      type: object
      required:
        - order_id
      properties:
        order_id:
          minLength: 1
          type: string
    AddressInput:
      additionalProperties: false
      type: object
      required:
        - line1
        - city
        - country
        - postal_code
      properties:
        line1:
          minLength: 1
          type: string
        city:
          minLength: 1
          type: string
        country:
          pattern: ^[A-Z]{2}$
          type: string
        postal_code:
          type: string
          description: Empty in a country without postal codes, such as AE or HK.
        line2:
          anyOf:
            - type: string
            - type: 'null'
        region:
          anyOf:
            - allOf:
                - pattern: ^[A-Z]{2}-[A-Z0-9]{1,3}$
                  type: string
                - pattern: ^(US|CA|AU|NZ)-
                  type: string
              description: >-
                ISO 3166-2, of this address's country, which has to be one of
                US, CA, AU, NZ. Another region answers `REGION_NOT_SUPPORTED`.
            - type: 'null'
    CheckoutAuthorization:
      description: >-
        How the customer authorizes the payment transaction, and what that
        needs.
      additionalProperties: false
      type: object
      required:
        - method
        - success_url
        - failure_url
      properties:
        method:
          type: string
          enum:
            - checkout
          description: >-
            The customer authorizes the payment transaction themselves, at their
            bank, and comes back to `success_url` or `failure_url`.
        success_url:
          format: uri
          pattern: ^https://
          maxLength: 2048
          type: string
        failure_url:
          format: uri
          pattern: ^https://
          maxLength: 2048
          type: string
        locale:
          pattern: ^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$
          type: string
          default: en
        bank:
          $ref: '#/components/schemas/BankRequestLink'
          description: >-
            The bank the customer chose on your own page, from `GET
            /merchants/{id}/banks` for this payment transaction's
            `customer_details.country`, currency and `is_test`. The checkout
            opens with it chosen, for the customer to confirm. Any other bank
            answers `BANK_NOT_AVAILABLE`.
    RewardsInput:
      description: Points shown to the customer.
      additionalProperties: false
      type: object
      required:
        - extra_rewards
      properties:
        extra_rewards:
          $ref: '#/components/schemas/Points'
        total_rewards:
          $ref: '#/components/schemas/Points'
        description:
          maxLength: 255
          type: string
    WebhookEndpointRequestLink:
      additionalProperties: false
      type: object
      required:
        - id
      properties:
        id:
          type: string
        _link:
          pattern: ^/
          type: string
        _type:
          const: webhook_endpoint
          type: string
      x-link-target:
        resource: webhook_endpoint
        kind: request
        is_published: true
    Simulation:
      description: >-
        Chooses how a test payment transaction ends. USD only. It isn't read
        back.
      minProperties: 1
      additionalProperties: false
      type: object
      properties:
        payment_outcome:
          type: string
          enum:
            - paid
            - on_hold_daily_limit
            - cancelled_for_fraud_risk
            - cancelled_for_balance_check
            - failed_insufficient_funds
            - reversed_insufficient_funds
            - failed_customer_dispute
            - reversed_customer_dispute
            - failed_closed_bank_account
            - reversed_closed_bank_account
        customer_outcome:
          type: string
          enum:
            - verified
            - rejected
            - in_review
        bank_link_outcome:
          type: string
          enum:
            - active
            - rejected
    TransactionFull:
      additionalProperties: false
      type: object
      required:
        - _type
        - _uri
        - _view
        - id
        - created_at
        - updated_at
        - type
        - is_test
        - transaction_number
        - status
        - reason
        - failure
        - required_actions
        - amount
        - payout_amount
        - exchange_rate
        - fees
        - routing
        - refund_status
        - can_refund
        - order
        - rewards
        - reported_statement_descriptor
        - platform
        - merchant
        - customer_details
        - parent_transaction
        - refunds
        - reversals
        - payout
      properties:
        _type:
          const: transaction
          type: string
        _uri:
          pattern: ^/
          description: The canonical URI, relative to the version root.
          type: string
        _view:
          const: full
          type: string
        id:
          type: string
        created_at:
          anyOf:
            - format: date-time
              pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$
              type: string
            - type: 'null'
        updated_at:
          anyOf:
            - format: date-time
              pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$
              type: string
            - type: 'null'
        type:
          type: string
          enum:
            - payment
            - refund
            - reversal
        is_test:
          type: boolean
          description: >-
            Whether this is a test payment transaction, or a refund or reversal
            of one.
        transaction_number:
          type: string
          description: >-
            A short reference, the same in Console and the API. Quote it to
            support.
        status:
          type: string
          enum:
            - pending
            - processing
            - completed
            - failed
            - cancelled
            - unresolved
          description: >-
            Where this money movement is in its lifecycle. No status confirms
            that money has arrived, `completed` included.


            - `pending`: Nothing has moved. On a payment transaction, the
            customer hasn't finished or the provider hasn't answered, and
            `:issueCheckout` may revive it. On a refund, it's held until
            `:executeRefund`, waiting on `required_actions` or on its payment
            transaction converting, or waiting on Quidkey with
            `required_actions: []`.

            - `processing`: Accepted and moving. On a payment transaction this
            includes money that hasn't landed. A refund can carry
            `required_actions` here, when something stopped it on the way.

            - `completed`: Finished. On a payment transaction, the provider
            reported success, which can be days before the money arrives, or on
            a virtual account the merchant's payout finished. On a refund, the
            payment to the customer's account went out. A reversal is always
            `completed`.

            - `failed`: It didn't happen, and nothing further will. Safe to try
            the order again.

            - `cancelled`: Stopped before moving money. On a payment
            transaction, the customer or Quidkey cancelled it.

            - `unresolved`: The outcome isn't known, and a later `completed` can
            still apply, so don't charge again for this order until it resolves.
            A payment transaction becomes `processing` or `completed`, or
            `failed` once Quidkey confirms.
        reason:
          anyOf:
            - maxLength: 255
              type: string
            - type: 'null'
          description: The caller's reason, on a refund. `null` otherwise.
        failure:
          anyOf:
            - $ref: '#/components/schemas/TransactionFailure'
            - type: 'null'
          description: >-
            Why a payment transaction failed: `null` unless its `status` is
            `failed`, and on a refund and a reversal. `message` is what the
            customer is told of the code.


            - `INSUFFICIENT_FUNDS`: The customer's account didn't hold enough.

            - `ACCOUNT_CLOSED`: The customer's account is closed.

            - `ACCOUNT_BLOCKED`: The customer's account can't be debited.

            - `AGREEMENT_INACTIVE`: The payment agreement wasn't approved, or is
            no longer active.

            - `DECLINED`: The bank declined, with no more specific reason.

            - `UNKNOWN`: No reason the customer can act on is recorded. It can
            become a more specific code if the bank reports one later.
        required_actions:
          type: array
          items:
            $ref: '#/components/schemas/RequiredAction'
          description: >-
            What has to happen before this can move on, and `[]` when nothing's
            needed. A `pending` refund with `[]` is waiting on Quidkey.
            `hosted_link` is `null` here, since resolution links are sent from
            Console.


            - `REFUND_NOT_EXECUTED`: Actor `api`. The refund is held, and
            `:executeRefund` on it moves the money.

            - `REFUND_NEEDS_PLATFORM_SESSION`: Actor `person`. Someone starts
            the refund in the merchant's platform.

            - `BILLING_ADDRESS_REQUIRED`: Actor `person`. Someone supplies it in
            Console, or sends a resolution link from there.

            - `CUSTOMER_BANK_ACCOUNT_REQUIRED`: Actor `person`. Someone supplies
            it in Console, or sends a resolution link from there.

            - `CUSTOMER_EMAIL_REQUIRED`: Actor `person`. Someone supplies it in
            Console, or sends a resolution link from there.

            - `ACCOUNT_HOLDER_NAME_REQUIRED`: Actor `person`. Someone sends a
            resolution link from Console.

            - `REFUND_BALANCE_TOO_LOW`: Actor `person`. Someone tops up the
            refund account, and it's retried hourly.

            - `REFUND_EXCEEDS_RECEIVED`: Actor `quidkey`. The refund is more
            than the customer actually paid, and Quidkey staff handle it.

            - `PAYMENT_IN_TRANSIT`: Actor `quidkey`. It goes on by itself once
            the payment transaction converts.

            - `PAYMENT_PROVIDER_UNAVAILABLE`: Actor `quidkey`. It's retried
            hourly.

            - `CUSTOMER_BANK_ACCOUNT_NEEDS_CONFIRMING`: Actor `quidkey`. Quidkey
            staff confirm the account.

            - `PAYEE_NOT_ACCEPTED`: Actor `quidkey`. The provider didn't accept
            the customer as a payee, and Quidkey staff handle it.

            - `CUSTOMER_BANK_DETAILS_UNUSABLE`: Actor `quidkey`. The customer's
            bank details can't be used, and Quidkey staff handle it.

            - `MERCHANT_NOT_SET_UP_FOR_REFUNDS`: Actor `quidkey`. Quidkey staff
            set the merchant up for refunds.

            - `PROCESSING_ERROR`: Actor `quidkey`. Anything else, which Quidkey
            staff handle.
        amount:
          type: object
          allOf:
            - $ref: '#/components/schemas/Money'
            - type: object
              required:
                - value
              properties:
                value:
                  minimum: 0
                  maximum: 9007199254740991
                  type: integer
          description: >-
            Always the customer's side, in the customer's currency: what they
            were charged, what they get back, or what the bank took back.
        payout_amount:
          anyOf:
            - type: object
              allOf:
                - $ref: '#/components/schemas/Money'
                - type: object
                  required:
                    - value
                  properties:
                    value:
                      minimum: 0
                      maximum: 9007199254740991
                      type: integer
            - type: 'null'
          description: >-
            What this payment transaction adds to the merchant's payouts, after
            fees and any conversion. `null` unless a payment transaction is
            `processing` or `completed`.
        exchange_rate:
          anyOf:
            - $ref: '#/components/schemas/ExchangeRate'
            - type: 'null'
          description: >-
            Explains the amounts, which are authoritative: don't recompute them
            from it. `null` until converted, and when no conversion ran.
        fees:
          anyOf:
            - $ref: '#/components/schemas/Fees'
            - type: 'null'
          description: >-
            The fees. `null` when there are none, and on a `failed`, `cancelled`
            or `unresolved` payment transaction.
        routing:
          anyOf:
            - type: string
              enum:
                - virtual_account
                - direct
            - type: 'null'
          description: >-
            Whether the money passes through a virtual account Quidkey runs for
            the merchant.
        refund_status:
          anyOf:
            - type: string
              enum:
                - refunding
                - refunding_blocked
                - refunding_failed
                - partially_refunded
                - fully_refunded
            - type: 'null'
          description: >-
            How far refunds of this payment transaction have got. None of these
            confirms that money has arrived. A list has no `required_actions`,
            so a single read gives them.


            - `refunding`: A refund is under way, held until `:executeRefund`,
            or waiting on Quidkey with `required_actions: []`.

            - `refunding_blocked`: A refund has `required_actions` other than
            `REFUND_NOT_EXECUTED`, or is waiting for a refund started in the
            merchant's platform.

            - `refunding_failed`: The latest refund outcome is a failure.

            - `partially_refunded`: Some of it has been refunded.

            - `fully_refunded`: All of it has been refunded.

            - `null`: No refunds, or the type is not `payment`.
        can_refund:
          type: boolean
          description: >-
            Whether a refund that moves money can be created now. `false` on a
            payment transaction whose refunds are paid from the merchant's
            platform, where `execution: manual` can still prepare one.
        order:
          anyOf:
            - $ref: '#/components/schemas/Order'
            - type: 'null'
          description: The caller's order. `null` where none was given.
        rewards:
          anyOf:
            - $ref: '#/components/schemas/Rewards'
            - type: 'null'
          description: >-
            What the payment transaction was created with. `null` on a payment
            transaction given none, and on a refund and a reversal.
        reported_statement_descriptor:
          anyOf:
            - type: string
            - type: 'null'
          description: What the provider reported as sent. `null` when not reported.
        platform:
          anyOf:
            - type: string
              enum:
                - api
                - payment_link
                - shopify
                - woocommerce
            - type: 'null'
          description: >-
            How the payment transaction came. `null` on a refund and a reversal,
            whose `parent_transaction` has it.
        merchant:
          $ref: '#/components/schemas/MerchantLink'
        customer_details:
          anyOf:
            - $ref: '#/components/schemas/CustomerDetailsSubResourceLink'
            - type: 'null'
          description: >-
            A link on a payment transaction. `null` on a refund and a reversal,
            whose parent payment transaction has it.
        checkout:
          type: object
          allOf:
            - $ref: '#/components/schemas/HostedLink'
            - type: object
              required:
                - expires_at
              properties:
                expires_at:
                  format: date-time
                  pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$
                  type: string
          description: >-
            The hosted payment page. Appears only on the responses to create and
            `:issueCheckout`, and never on a replayed create.
          x-one-time-secret: true
        parent_transaction:
          anyOf:
            - $ref: '#/components/schemas/TransactionLink'
            - type: 'null'
          description: The payment transaction, on a refund or a reversal.
        refunds:
          anyOf:
            - $ref: '#/components/schemas/TransactionCollectionLink'
            - type: 'null'
          description: >-
            The payment transaction's refunds. `null` on a refund and a
            reversal.
        reversals:
          maxItems: 100
          type: array
          items:
            $ref: '#/components/schemas/TransactionLink'
          description: At most one today.
        payout:
          anyOf:
            - $ref: '#/components/schemas/PayoutLink'
            - type: 'null'
          description: >-
            The payout that carries this. `null` until batched, and on a test
            transaction. A payout that fails while being sent answers 404 until
            Quidkey staff resolve it, and part or all of its money may have
            moved by then.
    NotIncludedEntry:
      additionalProperties: false
      type: object
      required:
        - link
        - reason
      properties:
        link:
          $ref: '#/components/schemas/AnyLink'
        reason:
          type: string
          enum:
            - no_permission
            - not_published
          description: >-
            Why this link has no entity.


            - `no_permission`: This credential can't read it. Fetching it
            answers 403, or 404 where a 403 would reveal that it exists.

            - `not_published`: The API doesn't show it: a type it doesn't
            publish, or a record it doesn't show on a type it does, such as a
            failed payout. Fetching it, where it has a URI, answers 404.
    Error:
      additionalProperties: false
      type: object
      required:
        - error
      properties:
        error:
          additionalProperties: false
          type: object
          required:
            - code
            - message
            - details
            - retryable
            - request_id
          properties:
            code:
              description: Branch on this. New codes can appear.
              type: string
            message:
              description: For people. It can change.
              type: string
            details:
              type: array
              items:
                $ref: '#/components/schemas/ErrorDetail'
            retryable:
              description: >-
                Whether sending the same request again unchanged, after a wait,
                can succeed with nothing else changing.
              type: boolean
            request_id:
              description: Quote this to support.
              type: string
    BankRequestLink:
      additionalProperties: false
      type: object
      required:
        - id
      properties:
        id:
          minLength: 1
          maxLength: 100
          type: string
        _link:
          pattern: ^/
          type: string
        _type:
          const: bank
          type: string
      x-link-target:
        resource: bank
        kind: request
        is_published: true
    Points:
      pattern: ^\d{1,8}(\.\d{1,2})?$
      description: >-
        Points as a decimal string, from `"0"` to `"99999999.99"` with at most 2
        decimal places. A response always has 2: `"12.50"`. Not money.
      type: string
    TransactionFailure:
      additionalProperties: false
      type: object
      required:
        - code
        - message
        - retryable
      properties:
        code:
          description: >-
            Public and stable, and listed on the field that holds it. New codes
            can appear, so handle any you don't recognise.
          type: string
        message:
          type: string
        retryable:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            Whether the same payment transaction could succeed if the customer
            tried again. `null` when neither the bank nor Quidkey gave an
            indication.
    RequiredAction:
      description: Something that has to happen before a resource can move on.
      additionalProperties: false
      type: object
      required:
        - code
        - message
        - actor
        - target
        - fields
        - hosted_link
      properties:
        code:
          description: >-
            Public and stable, and listed on the field that holds it. New codes
            can appear, so handle any you don't recognise.
          type: string
        message:
          type: string
        actor:
          type: string
          enum:
            - api
            - person
            - quidkey
          description: >-
            Who resolves it. `api`: your integration makes the API call the code
            names. `person`: someone acts, in Console or on the page in
            `hosted_link`. `quidkey`: there's nothing for you to do, because
            Quidkey retries it or its staff handle it.
        target:
          anyOf:
            - $ref: '#/components/schemas/AnyLink'
            - type: 'null'
        fields:
          type: array
          items:
            type: string
          description: >-
            The public fields of `target` it's about, with dotted paths into an
            address, such as `registered_address.city`. `[]` unless the code
            names fields.
        hosted_link:
          anyOf:
            - $ref: '#/components/schemas/HostedLink'
            - type: 'null'
    ExchangeRate:
      description: 1 unit of from_currency converts to rate units of to_currency.
      additionalProperties: false
      type: object
      required:
        - rate
        - from_currency
        - to_currency
      properties:
        rate:
          pattern: ^\d+(\.\d+)?$
          description: >-
            How many units of `to_currency` one unit of `from_currency` converts
            to, as a decimal string.
          type: string
        from_currency:
          pattern: ^[A-Z]{3}$
          type: string
        to_currency:
          pattern: ^[A-Z]{3}$
          type: string
    Fees:
      additionalProperties: false
      type: object
      required:
        - total
        - items
      properties:
        total:
          type: object
          allOf:
            - $ref: '#/components/schemas/Money'
            - type: object
              required:
                - value
              properties:
                value:
                  minimum: 0
                  maximum: 9007199254740991
                  type: integer
          description: >-
            Fees in the customer's currency, or on a refund the refund
            account's.
        items:
          type: array
          items:
            additionalProperties: false
            type: object
            required:
              - type
              - amount
              - tax_amount
              - rate
              - status
              - settled_at
            properties:
              type:
                type: string
                enum:
                  - percentage
                  - fixed
              amount:
                type: object
                allOf:
                  - $ref: '#/components/schemas/Money'
                  - type: object
                    required:
                      - value
                    properties:
                      value:
                        minimum: 0
                        maximum: 9007199254740991
                        type: integer
              tax_amount:
                type: object
                allOf:
                  - $ref: '#/components/schemas/Money'
                  - type: object
                    required:
                      - value
                    properties:
                      value:
                        minimum: 0
                        maximum: 9007199254740991
                        type: integer
                description: The tax included in `amount`.
              rate:
                anyOf:
                  - $ref: '#/components/schemas/Rate'
                  - type: 'null'
                description: A fraction. `null` on a fixed fee.
              status:
                type: string
                enum:
                  - pending
                  - invoiced
                  - settled
                  - failed
              settled_at:
                anyOf:
                  - format: date-time
                    pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$
                    type: string
                  - type: 'null'
    Rewards:
      description: Points shown to the customer.
      additionalProperties: false
      type: object
      required:
        - extra_rewards
        - total_rewards
        - description
      properties:
        extra_rewards:
          $ref: '#/components/schemas/Points'
        total_rewards:
          anyOf:
            - $ref: '#/components/schemas/Points'
            - type: 'null'
        description:
          anyOf:
            - type: string
            - type: 'null'
    MerchantLink:
      additionalProperties: false
      type: object
      required:
        - _link
        - _type
        - id
      properties:
        _link:
          pattern: ^/
          type: string
        _type:
          const: merchant
          type: string
        id:
          type: string
      x-link-target:
        resource: merchant
        kind: resource
        is_published: true
        views:
          - full
    CustomerDetailsSubResourceLink:
      additionalProperties: false
      type: object
      required:
        - _link
        - _type
        - id
      properties:
        _link:
          pattern: ^/
          type: string
        _type:
          const: customer_details
          type: string
        id:
          type: string
      x-link-target:
        resource: customer_details
        kind: singleton
        is_published: true
        views:
          - full
    HostedLink:
      description: >-
        A page a person opens, on HTTPS in production. Its URL can carry a
        token, so treat it as a secret.
      additionalProperties: false
      type: object
      required:
        - url
        - expires_at
      properties:
        url:
          format: uri
          type: string
        expires_at:
          anyOf:
            - format: date-time
              pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$
              type: string
            - type: 'null'
    TransactionLink:
      additionalProperties: false
      type: object
      required:
        - _link
        - _type
        - id
      properties:
        _link:
          pattern: ^/
          type: string
        _type:
          const: transaction
          type: string
        id:
          type: string
      x-link-target:
        resource: transaction
        kind: resource
        is_published: true
        views:
          - full
          - summary
    TransactionCollectionLink:
      additionalProperties: false
      type: object
      required:
        - _link
        - _type
      properties:
        _link:
          pattern: ^/
          type: string
        _type:
          const: collection
          type: string
      x-link-target:
        resource: transaction
        kind: collection
        is_published: true
        views:
          - full
          - summary
    PayoutLink:
      additionalProperties: false
      type: object
      required:
        - _link
        - _type
        - id
      properties:
        _link:
          pattern: ^/
          type: string
        _type:
          const: payout
          type: string
        id:
          type: string
      x-link-target:
        resource: payout
        kind: resource
        is_published: true
        views:
          - full
    AnyLink:
      anyOf:
        - additionalProperties: false
          type: object
          required:
            - _link
            - _type
            - id
          properties:
            _link:
              pattern: ^/
              type: string
            _type:
              type: string
            id:
              type: string
        - additionalProperties: false
          type: object
          required:
            - _type
            - id
          properties:
            _type:
              type: string
            id:
              type: string
      x-link-target:
        resource: any
        kind: any
        is_published: true
    ErrorDetail:
      anyOf:
        - additionalProperties: false
          type: object
          required:
            - field
            - message
          properties:
            field:
              type: string
            message:
              type: string
        - additionalProperties: false
          type: object
          required:
            - required_actions
            - message
          properties:
            required_actions:
              description: The `required_actions` codes holding this back.
              type: array
              items:
                type: string
            message:
              type: string
        - additionalProperties: false
          type: object
          required:
            - available_percent
            - message
          properties:
            available_percent:
              $ref: '#/components/schemas/Percent'
            message:
              type: string
        - additionalProperties: false
          type: object
          required:
            - agreement
            - message
          properties:
            agreement:
              $ref: '#/components/schemas/AgreementLink'
            message:
              type: string
        - additionalProperties: false
          type: object
          required:
            - agreement
            - current_agreement
            - message
          properties:
            agreement:
              $ref: '#/components/schemas/AgreementLink'
            current_agreement:
              $ref: '#/components/schemas/AgreementLink'
            message:
              type: string
        - additionalProperties: false
          type: object
          required:
            - legal_entity
            - message
          properties:
            legal_entity:
              $ref: '#/components/schemas/LegalEntityLink'
            message:
              type: string
    Rate:
      pattern: ^\d+(\.\d{1,8})?$
      description: >-
        A fraction as a decimal string, with at most 8 decimal places:
        `"0.0500"` is 5%.
      type: string
    Percent:
      pattern: ^\d+(\.\d+)?$
      description: 'A percentage as a decimal string: `"25.00"` is 25%.'
      type: string
    AgreementLink:
      additionalProperties: false
      type: object
      required:
        - _link
        - _type
        - id
      properties:
        _link:
          pattern: ^/
          type: string
        _type:
          const: agreement
          type: string
        id:
          type: string
      x-link-target:
        resource: agreement
        kind: resource
        is_published: true
        views:
          - full
    LegalEntityLink:
      additionalProperties: false
      type: object
      required:
        - _link
        - _type
        - id
      properties:
        _link:
          pattern: ^/
          type: string
        _type:
          const: legal_entity
          type: string
        id:
          type: string
      x-link-target:
        resource: legal_entity
        kind: resource
        is_published: true
        views:
          - full
  headers:
    RequestId:
      description: Identifies this request. Quote it to support.
      schema:
        type: string
    IdempotentReplayed:
      description: '`true` on a retry that answers with the first attempt''s outcome.'
      schema:
        type: string
        enum:
          - 'true'
    RetryAfter:
      description: How many seconds to wait before retrying.
      schema:
        minimum: 0
        type: integer
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.