openapi: 3.0.3
info:
  contact:
    email: support@marqeta.com
    name: Marqeta
  termsOfService: https://www.marqeta.com/api-terms
  title: Simulations API
  version: 0.0.1
servers:
  - url: https://sandbox-api-qa.marqeta.io/v3
tags:
  - description: >-
      [NOTE]

      This feature is currently in beta and subject to change.

      To learn more about the beta program for this feature, contact your
      Marqeta representative.

      For older versions of Simulations, see
      <</core-api/simulating-transactions, Simulating Transactions>>.


      The Marqeta platform provides you with a production environment and a
      sandbox.

      The main difference between the production and sandbox environments is
      that your production environment communicates with a payment card network.

      This communication allows your program's cards to pay for goods and
      services by initiating live transactions over the card network.


      There are two types of sandbox environments available:


      * *Public sandbox:* A single-user environment where you can begin building
      your program and experiment with the Marqeta platform.

      * *Private sandbox:* A multi-user environment where you can integrate your
      application with the Marqeta platform.


      All funds and transactions are simulated in both types of sandbox
      environments.


      Unlike the production environment, a sandbox does not communicate with a
      card network, so the cards you create within them cannot be used to
      conduct real-world transactions.

      Therefore, you must rely on simulated transactions in order to test all
      objects you create within a sandbox.

      The sandbox environments provide a set of endpoints that let you simulate
      various types of card network transactions, such as authorizations,
      reversals, and balance inquiries.

      These endpoints are available only within the sandbox, so the details on
      this page do not apply to production.


      To use the Simulations API:


      * Create a card in your sandbox environment.

      * Use the `/simulations/cardtransactions/*` endpoints to simulate
      transaction event types. Each endpoint is its own event type.

      * Use the `/webhooks` endpoint to send optional customer notifications for
      system events.


      All simulations endpoints share the same request/response model, as
      described below.
    name: Simulations 2.0 (Beta)
paths:
  /simulations/cardtransactions/account.funding.authorization:
    post:
      description: >-
        Use this endpoint to simulate Account Funding Transactions (AFTs) using
        `account.funding.authorization`.
      operationId: AccountFundingAuthorizationEventSimulation
      requestBody:
        content:
          application/json:
            example:
              account_funding:
                first_name: FirstName
                funding_source: CREDIT
                last_name: LastName
                receiver_account_type: CARD_ACCOUNT
                transaction_type: ACCOUNT_TO_ACCOUNT
              amount: 10
              card_token: 0cbedb63-0fe0-4464-ab3c-f9d1f037f30a
              network: VISA
            schema:
              $ref: '#/components/schemas/AccountFundingAuthorizationEventSimulation'
      responses:
        '201':
          content:
            application/json:
              example:
                transaction:
                  account_funding:
                    funding_source: CREDIT
                    receiver_name: FirstName LastName
                    transaction_type: ACCOUNT_TO_ACCOUNT
                  acquirer_fee_amount: 0
                  amount: 10
                  card_acceptor:
                    city: St. Petersbu
                    mcc: 4829
                    mid: 984172732880
                    name: Marqeta Storefront
                    postal_code: 33705
                    state: CA
                  card_token: 0cbedb63-0fe0-4464-ab3c-f9d1f037f30a
                  created_time: 2023-01-19T00:03:48.000Z
                  currency_code: USD
                  currency_conversion:
                    conversion_rate: 1
                    original_amount: 10
                    original_currency_code: 840
                  gpa:
                    available_balance: 70
                    impacted_amount: -10
                    ledger_balance: 145
                  network: VISA
                  original_credit:
                    funding_source: CREDIT
                    transaction_type: ACCOUNT_TO_ACCOUNT
                  response:
                    code: 0
                    memo: Approved or completed successfully
                  settlement_date: 2023-01-19T00:00:00.000Z
                  state: PENDING
                  subnetwork: VISANET
                  token: 7bb4d099-2af1-41ef-862c-446a2cc2b60a
                  type: account.funding.authorization
                  user_token: d021cbb9-259f-412c-b3d8-b33ce1346e10
                  user_transaction_time: 2023-01-19T00:03:48.000Z
              schema:
                $ref: '#/components/schemas/CardTransactionSimulationResponse'
          description: Created
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad Request
      summary: Simulate AFT authorization
      tags:
        - Simulations 2.0 (Beta)
  /simulations/cardtransactions/account.funding.authorization.clearing:
    post:
      description: >-
        Use this endpoint to simulate `account.funding.authorization.clearing`
        transactions.
      operationId: AccountFundingAuthorizationClearingEventSimulation
      requestBody:
        content:
          application/json:
            example:
              amount: 10
              preceding_related_transaction_token: 7bb4d099-2af1-41ef-862c-446a2cc2b60a
            schema:
              $ref: >-
                #/components/schemas/AccountFundingAuthorizationClearingEventSimulation
      responses:
        '201':
          content:
            application/json:
              example:
                transaction:
                  amount: 10
                  card_acceptor:
                    city: St. Petersbu
                    country_code: USA
                    mcc: '4829'
                    mid: 984172732880
                    name: Marqeta Storefront
                    state: CA
                  card_token: 0cbedb63-0fe0-4464-ab3c-f9d1f037f30a
                  created_time: 2022-12-06T21:47:21.000Z
                  currency_code: USD
                  currency_conversion:
                    conversion_rate: 1
                    original_amount: 10
                    original_currency_code: 840
                  gpa:
                    available_balance: 93.25
                    impacted_amount: -10
                    ledger_balance: 180
                  network: VISA
                  preceding_related_transaction_token: 7bb4d099-2af1-41ef-862c-446a2cc2b60a
                  response:
                    code: 0
                    memo: Approved or completed successfully
                  settlement_date: 2022-12-06T00:00:00.000Z
                  state: COMPLETION
                  subnetwork: VISANET
                  token: f5b06de2-ca5a-49e4-919a-94ce479b3a25
                  type: account.funding.authorization.clearing
                  user_token: 76592882-92c0-4589-b836-350d639219f8
                  user_transaction_time: 2022-12-06T21:45:57.000Z
              schema:
                $ref: '#/components/schemas/CardTransactionSimulationResponse'
          description: Created
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad Request
      summary: Simulate AFT clearing
      tags:
        - Simulations 2.0 (Beta)
  /simulations/cardtransactions/account.funding.authorization.reversal:
    post:
      description: >-
        Use this endpoint to simulate `account.funding.authorization.reversal`
        transactions.
      operationId: AccountFundingAuthorizationReversalEventSimulation
      requestBody:
        content:
          application/json:
            example:
              amount: 10
              preceding_related_transaction_token: 6c89e18c-4775-45e9-9df1-9700b7466e1
            schema:
              $ref: >-
                #/components/schemas/AccountFundingAuthorizationReversalEventSimulation
      responses:
        '201':
          content:
            application/json:
              example:
                transaction:
                  amount: 10
                  card_acceptor:
                    city: St. Petersbu
                    mcc: '4829'
                    mid: 984172732880
                    name: Marqeta Storefront
                    state: CA
                  card_token: 0cbedb63-0fe0-4464-ab3c-f9d1f037f30a
                  created_time: 2022-12-06T21:49:23.000Z
                  currency_code: USD
                  currency_conversion:
                    conversion_rate: 1
                    original_amount: 10
                    original_currency_code: 840
                  gpa:
                    available_balance: 93.25
                    ledger_balance: 180
                  network: VISA
                  preceding_related_transaction_token: 7bb4d099-2af1-41ef-862c-446a2cc2b60a
                  response:
                    code: 1018
                    memo: Transaction already confirmed
                  settlement_date: 2022-12-06T00:00:00.000Z
                  state: DECLINED
                  subnetwork: VISANET
                  token: f92b98f6-fd20-45fc-a789-e3cf7c8b4f13
                  type: account.funding.authorization.reversal
                  user_token: 76592882-92c0-4589-b836-350d639219f8
                  user_transaction_time: 2022-12-06T21:45:57.000Z
              schema:
                $ref: '#/components/schemas/CardTransactionSimulationResponse'
          description: Created
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad Request
      summary: Simulate AFT reversal
      tags:
        - Simulations 2.0 (Beta)
  /simulations/cardtransactions/authorization:
    post:
      description: >-
        Authorization is the process of confirming whether a card is valid,
        business rules are met, and funds are sufficient, and then placing a
        temporary hold on those funds.

        Use this endpoint to simulate an `authorization` type transaction by
        including the `card_token` and other authorization details in your
        request.


        *Next steps*:


        Complete authorization through
        <</core-api/simulations#AuthorizationClearingEventSimulation,
        authorization.clearing>> or
        <</core-api/simulations#AuthorizationReversalEventSimulation,
        authorization.reversal>>.
      operationId: AuthorizationEventSimulation
      requestBody:
        content:
          application/json:
            example:
              amount: 100
              card_acceptor:
                mid: '11111'
              card_token: 0cbedb63-0fe0-4464-ab3c-f9d1f037f30a
              network: VISA
            schema:
              $ref: '#/components/schemas/AuthorizationEventSimulation'
      responses:
        '201':
          content:
            application/json:
              example:
                transaction:
                  amount: 10
                  card_acceptor:
                    city: St. Petersbu
                    mcc: '6411'
                    mid: '000000000011111'
                    name: Marqeta Storefront
                    state: CA
                  card_token: 0cbedb63-0fe0-4464-ab3c-f9d1f037f30a
                  created_time: 2022-12-06T21:39:43.000Z
                  currency_code: USD
                  currency_conversion:
                    conversion_rate: 1
                    original_amount: 10
                    original_currency_code: 840
                  gpa:
                    available_balance: 123.25
                    impacted_amount: -10
                    ledger_balance: 200
                  network: VISA
                  response:
                    code: 0
                    memo: Approved or completed successfully
                  settlement_date: 2022-12-06T00:00:00.000Z
                  state: PENDING
                  subnetwork: VISANET
                  token: 495ba8f3-f25c-4d98-b6ca-256918cdf31a
                  type: authorization
                  user_token: 76592882-92c0-4589-b836-350d639219f8
                  user_transaction_time: 2022-12-06T21:39:43.000Z
              schema:
                $ref: '#/components/schemas/CardTransactionSimulationResponse'
          description: Created
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad Request
      summary: Simulate authorization
      tags:
        - Simulations 2.0 (Beta)
  /simulations/cardtransactions/authorization.clearing:
    post:
      description: >-
        Clearing is the process of finalizing the hold on funds and posting the
        transaction on the cardholder's account.

        This process is triggered by the merchant's capture request.

        This endpoint simulates an `authorization.clearing` type transaction by
        including the `preceding_related_transaction_token` and `amount` in your
        request.
      operationId: AuthorizationClearingEventSimulation
      requestBody:
        content:
          application/json:
            example:
              amount: 10
              preceding_related_transaction_token: 495ba8f3-f25c-4d98-b6ca-256918cdf31a
            schema:
              $ref: '#/components/schemas/AuthorizationClearingEventSimulation'
      responses:
        '201':
          content:
            application/json:
              example:
                transaction:
                  amount: 10
                  card_acceptor:
                    city: Seattle
                    country_code: USA
                    mcc: '6411'
                    mid: '000000000011111'
                    name: Card Acceptor Name
                    state: WA
                  card_token: 0cbedb63-0fe0-4464-ab3c-f9d1f037f30a
                  created_time: 2022-12-06T21:41:48.000Z
                  currency_code: USD
                  currency_conversion:
                    conversion_rate: 1
                    original_amount: 10
                    original_currency_code: 826
                  gpa:
                    available_balance: 123.25
                    impacted_amount: -10
                    ledger_balance: 190
                  network: VISA
                  preceding_related_transaction_token: 495ba8f3-f25c-4d98-b6ca-256918cdf31a
                  response:
                    code: 0
                    memo: Approved or completed successfully
                  settlement_date: 2022-12-06T00:00:00.000Z
                  state: COMPLETION
                  subnetwork: VISANET
                  token: 7663dbcc-18ee-4c93-8184-fd37aaf04364
                  type: authorization.clearing
                  user_token: 76592882-92c0-4589-b836-350d639219f8
                  user_transaction_time: 2022-12-06T21:39:43.000Z
              schema:
                $ref: '#/components/schemas/CardTransactionSimulationResponse'
          description: Created
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad Request
      summary: Simulate clearing
      tags:
        - Simulations 2.0 (Beta)
  /simulations/cardtransactions/authorization.reversal:
    post:
      description: >-
        A reversal releases the hold that was placed on account funds by an
        authorization, thus returning the funds to the account.

        This endpoint simulates an `authorization.reversal` type transaction by
        including the `original_transaction_token` and `amount` in your request.
      operationId: AuthorizationReversalEventSimulation
      requestBody:
        content:
          application/json:
            example:
              amount: 10
              preceding_related_transaction_token: 495ba8f3-f25c-4d98-b6ca-256918cdf31a
            schema:
              $ref: '#/components/schemas/AuthorizationReversalEventSimulation'
      responses:
        '201':
          content:
            application/json:
              example:
                transaction:
                  amount: 10
                  card_acceptor:
                    city: St. Petersbu
                    mcc: '6411'
                    mid: '000000000011111'
                    name: Marqeta Storefront
                    state: CA
                  card_token: 0cbedb63-0fe0-4464-ab3c-f9d1f037f30a
                  created_time: 2022-12-06T21:44:26.000Z
                  currency_code: USD
                  currency_conversion:
                    conversion_rate: 1
                    original_amount: 10
                    original_currency_code: 840
                  gpa:
                    available_balance: 123.25
                    ledger_balance: 190
                  network: VISA
                  preceding_related_transaction_token: 495ba8f3-f25c-4d98-b6ca-256918cdf31a
                  response:
                    code: 1018
                    memo: Transaction already confirmed
                  settlement_date: 2022-12-06T00:00:00.000Z
                  state: DECLINED
                  subnetwork: VISANET
                  token: 9a4edd0f-ffbe-4909-99c6-400daa43f48a
                  type: authorization.reversal
                  user_token: 76592882-92c0-4589-b836-350d639219f8
                  user_transaction_time: 2022-12-06T21:39:43.000Z
              schema:
                $ref: '#/components/schemas/CardTransactionSimulationResponse'
          description: Created
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad Request
      summary: Simulate reversal
      tags:
        - Simulations 2.0 (Beta)
components:
  schemas:
    AccountFundingAuthorizationClearingEventSimulation:
      allOf:
        - $ref: '#/components/schemas/CardTransactionSimulation'
      properties:
        preceding_related_transaction_token:
          $ref: '#/components/schemas/token'
      required:
        - amount
        - preceding_related_transaction_token
    AccountFundingAuthorizationEventSimulation:
      allOf:
        - $ref: '#/components/schemas/CardTransactionSimulation'
      properties:
        card_token:
          $ref: '#/components/schemas/token'
      required:
        - amount
        - card_token
    AccountFundingAuthorizationReversalEventSimulation:
      allOf:
        - $ref: '#/components/schemas/CardTransactionSimulation'
      properties:
        preceding_related_transaction_token:
          $ref: '#/components/schemas/token'
      required:
        - amount
        - preceding_related_transaction_token
    AuthorizationClearingEventSimulation:
      allOf:
        - $ref: '#/components/schemas/CardTransactionSimulation'
      properties:
        preceding_related_transaction_token:
          $ref: '#/components/schemas/token'
      required:
        - amount
        - preceding_related_transaction_token
    AuthorizationEventSimulation:
      allOf:
        - $ref: '#/components/schemas/CardTransactionSimulation'
      properties:
        card_acceptor:
          allOf:
            - $ref: '#/components/schemas/transaction_card_acceptor'
          properties:
            mid:
              description: The merchant identifier.
              type: string
          required:
            - mid
        card_token:
          $ref: '#/components/schemas/token'
      required:
        - amount
        - card_acceptor
        - card_token
    AuthorizationReversalEventSimulation:
      allOf:
        - $ref: '#/components/schemas/CardTransactionSimulation'
      properties:
        preceding_related_transaction_token:
          $ref: '#/components/schemas/token'
      required:
        - amount
        - preceding_related_transaction_token
    CardTransactionSimulation:
      discriminator:
        mapping:
          account.funding.authorization: '#/components/schemas/AccountFundingAuthorizationEventSimulation'
          account.funding.authorization.clearing: >-
            #/components/schemas/AccountFundingAuthorizationClearingEventSimulation
          account.funding.authorization.reversal: >-
            #/components/schemas/AccountFundingAuthorizationReversalEventSimulation
          authorization: '#/components/schemas/AuthorizationEventSimulation'
          authorization.clearing: '#/components/schemas/AuthorizationClearingEventSimulation'
          authorization.reversal: '#/components/schemas/AuthorizationReversalEventSimulation'
        propertyName: event_type
      properties:
        account_funding:
          $ref: '#/components/schemas/account_funding_request'
        amount:
          description: Amount of the transaction.
          type: number
        card_acceptor:
          $ref: '#/components/schemas/transaction_card_acceptor'
        card_options:
          $ref: '#/components/schemas/card_options'
        card_token:
          $ref: '#/components/schemas/token'
        currency_code:
          description: Currency type of the transaction.
          enum:
            - AED
            - AFN
            - ALL
            - AMD
            - ANG
            - AOA
            - ARS
            - AUD
            - AWG
            - AZN
            - BAM
            - BBD
            - BDT
            - BGN
            - BHD
            - BIF
            - BMD
            - BND
            - BOB
            - BRL
            - BSD
            - BTN
            - BWP
            - BYR
            - BZD
            - CAD
            - CDF
            - CHF
            - CLP
            - CNY
            - COP
            - CRC
            - CUC
            - CUP
            - CVE
            - CZK
            - DJF
            - DKK
            - DOP
            - DZD
            - EGP
            - ERN
            - ETB
            - EUR
            - FJD
            - FKP
            - GBP
            - GEL
            - GGP
            - GHS
            - GIP
            - GMD
            - GNF
            - GTQ
            - GYD
            - HKD
            - HNL
            - HRK
            - HTG
            - HUF
            - IDR
            - ILS
            - IMP
            - INR
            - IQD
            - IRR
            - ISK
            - JEP
            - JMD
            - JOD
            - JPY
            - KES
            - KGS
            - KHR
            - KMF
            - KPW
            - KRW
            - KWD
            - KYD
            - KZT
            - LAK
            - LBP
            - LKR
            - LRD
            - LSL
            - LYD
            - MAD
            - MDL
            - MGA
            - MKD
            - MMK
            - MNT
            - MOP
            - MRO
            - MUR
            - MVR
            - MWK
            - MXN
            - MYR
            - MZN
            - NAD
            - NGN
            - NIO
            - NOK
            - NPR
            - NZD
            - OMR
            - PAB
            - PEN
            - PGK
            - PHP
            - PKR
            - PLN
            - PYG
            - QAR
            - RON
            - RSD
            - RUB
            - RWF
            - SAR
            - SBD
            - SCR
            - SDG
            - SEK
            - SGD
            - SHP
            - SLL
            - SOS
            - SPL
            - SRD
            - STD
            - SVC
            - SYP
            - SZL
            - THB
            - TJS
            - TMT
            - TND
            - TOP
            - TRY
            - TTD
            - TVD
            - TWD
            - TZS
            - UAH
            - UGX
            - USD
            - UYU
            - UZS
            - VEF
            - VND
            - VUV
            - WST
            - XAF
            - XCD
            - XDR
            - XOF
            - XPF
            - YER
            - ZAR
            - ZMW
            - ZWD
          type: string
        currency_conversion:
          $ref: '#/components/schemas/currency_conversion'
        fees:
          description: |-
            List of fees associated with the transaction.

            This array is returned if it exists in the resource.
          items:
            $ref: '#/components/schemas/network_fee_model'
          type: array
        force_post:
          default: false
          description: >-
            Set to `true` to simulate a forced clearing transaction.


            *NOTE:* If you set this field to `true`, you must also set the
            `original_transaction_token` field to an existing transaction token
            (the transaction does not need to be related).
          type: boolean
        is_preauthorization:
          default: false
          description: |-
            Indicates if the transaction is a pre-authorization.
            Set to `true` to mark the amount as an authorization only.
          type: boolean
        network:
          description: Indicates which card network was used to complete the transaction.
          enum:
            - VISA
            - MASTERCARD
            - DISCOVER
            - PULSE
          type: string
        pos:
          $ref: '#/components/schemas/pos'
        preceding_related_transaction_token:
          $ref: '#/components/schemas/token'
        subNetwork:
          description: Indicates which subnetwork used to complete the transaction.
          enum:
            - VISANET
            - VISANETDEBIT
            - VISAINTERLINK
            - VISAPLUS
            - MAESTRO
          type: string
      type: object
    CardTransactionSimulationResponse:
      additionalProperties: false
      description: Contains information about the transaction that was simulated.
      properties:
        transaction:
          $ref: '#/components/schemas/TransactionModel'
      title: Card Transaction Simulation Response
      type: object
    CardholderAddressResponse:
      properties:
        active:
          default: false
          type: boolean
        address_1:
          maxLength: 255
          minLength: 0
          type: string
        address_2:
          maxLength: 255
          minLength: 0
          type: string
        business_token:
          description: Required if 'user_token' is not specified
          maxLength: 36
          minLength: 1
          type: string
        city:
          maxLength: 40
          minLength: 0
          type: string
        country:
          maxLength: 40
          minLength: 1
          type: string
        created_time:
          description: yyyy-MM-ddTHH:mm:ssZ
          format: date-time
          type: string
        first_name:
          maxLength: 40
          minLength: 0
          type: string
        is_default_address:
          default: false
          type: boolean
        last_modified_time:
          description: yyyy-MM-ddTHH:mm:ssZ
          format: date-time
          type: string
        last_name:
          maxLength: 40
          minLength: 0
          type: string
        phone:
          maxLength: 255
          minLength: 0
          type: string
        postal_code:
          maxLength: 10
          minLength: 0
          type: string
        state:
          maxLength: 2
          minLength: 0
          type: string
        token:
          maxLength: 36
          minLength: 1
          type: string
        user_token:
          description: Required if 'business_token' is not specified
          maxLength: 36
          minLength: 1
          type: string
        zip:
          maxLength: 10
          minLength: 0
          type: string
      required:
        - address_1
        - city
        - country
        - created_time
        - first_name
        - last_modified_time
        - last_name
        - postal_code
        - state
        - token
        - zip
      type: object
    Error:
      properties:
        error_code:
          type: string
        error_message:
          type: string
      title: Error
      type: object
    TransactionModel:
      description: Transaction Model
      properties:
        account_funding:
          $ref: '#/components/schemas/account_funding_request'
        amount:
          description: Amount of the transaction.
          type: number
        card_acceptor:
          $ref: '#/components/schemas/transaction_card_acceptor'
        card_token:
          description: >-
            Unique identifier of the card. Useful when a single account holder
            has multiple cards.
          maxLength: 36
          minLength: 0
          type: string
        created_time:
          description: >-
            Date and time when the Marqeta platform created the transaction
            entry (for example, when the platform received an incoming message
            for a refund).
          format: date-time
          type: string
        currency_code:
          description: Currency type of the transaction.
          type: string
        currency_conversion:
          $ref: '#/components/schemas/currency_conversion'
        gpa:
          description: Contains information about the GPA balances and pending credits.
          properties:
            available_balance:
              description: >
                Ledger balance minus any authorized transactions that have not
                yet cleared.

                Also known as the cardholder's purchasing power.

                When using JIT Funding, this balance is usually equal to $0.00.
              type: number
            impacted_amount:
              description: Balance change based on the amount of the transaction.
              type: number
            ledger_balance:
              description: >
                When using standard funding: The funds that are available to
                spend immediately, including funds from any authorized
                transactions that have not yet cleared.


                When using Just-in-Time (JIT) Funding: Authorized funds that are
                currently on hold, but not yet cleared.
              type: number
          type: object
        gpa_order:
          $ref: '#/components/schemas/gpa_response'
        network:
          description: >-
            Indicates which card network was used to complete the transaction
            (DISCOVER, MASTERCARD, PULSE, VISA, and MARQETA).
          enum:
            - VISA
            - MASTERCARD
            - PULSE
            - DISCOVER
          type: string
        original_credit:
          $ref: '#/components/schemas/original_credit'
        preceding_related_transaction_token:
          description: >-
            Returned for final transaction types.

            Unique identifier of the preceding related transaction. Useful for
            identifying the transaction that preceded the current one. For
            example, `authorization`, a temporary transaction type, precedes and
            is completed by `authorization.clearing`, a final transaction type.

            In this case, the `authorization` token is returned with this field.
            See <</core-api/event-types#_transaction_events, Transaction
            events>> for details on which transaction types are temporary or
            final.
          type: string
        response:
          $ref: '#/components/schemas/response'
        settlement_date:
          description: >-
            Date and time when funds were moved for a transaction (for example,
            in the case of a refund, when funds were credited to the
            cardholder).
          format: date-time
          type: string
        state:
          description: >-
            Current state of the transaction. For more information about the

            For more information about the `state` field, see
            <</developer-guides/about-transactions#_the_transaction_lifecycle,
            The transaction lifecycle>> on the "About Transactions" page.
          enum:
            - CLEARED
            - COMPLETION
            - DECLINED
            - ERROR
            - PENDING
          type: string
        subnetwork:
          description: Indicates which subnetwork used to complete the transaction.
          enum:
            - VISANET
            - VISANETDEBIT
            - VISAINTERLINK
            - VISAPLUS
            - MAESTRO
          type: string
        token:
          description: >-
            Unique identifier of the transaction, formatted as a UUID.


            > For subsequent related transactions, this token value appears as
            the `preceding_related_transaction_token`.
          maxLength: 36
          minLength: 1
          readOnly: true
          type: string
        type:
          description: >-
            Transaction event type.


            For more information about the `type` field, see the "Transaction
            events" section on the <</core-api/event-types#_transaction_events,
            Event Types>> page.
          enum:
            - account.credit
            - account.debit
            - account.funding.auth_plus_capture
            - account.funding.auth_plus_capture.reversal
            - account.funding.authorization
            - account.funding.authorization.clearing
            - account.funding.authorization.reversal
            - authorization
            - authorization.advice
            - authorization.atm.withdrawal
            - authorization.cashback
            - authorization.clearing
            - authorization.clearing.atm.withdrawal
            - authorization.clearing.cashback
            - authorization.clearing.chargeback
            - authorization.clearing.chargeback.completed
            - authorization.clearing.chargeback.provisional.credit
            - authorization.clearing.chargeback.provisional.debit
            - authorization.clearing.chargeback.reversal
            - authorization.clearing.chargeback.writeoff
            - authorization.clearing.quasi.cash
            - authorization.incremental
            - authorization.quasi.cash
            - authorization.reversal
            - authorization.reversal.issuerexpiration
            - authorization.standin
            - balanceinquiry
            - billpayment
            - billpayment.clearing
            - billpayment.reversal
            - credit.adjustment
            - debit.adjustment
            - directdeposit.credit
            - directdeposit.credit.pending
            - directdeposit.credit.pending.reversal
            - directdeposit.credit.reject
            - directdeposit.credit.reversal
            - directdeposit.debit
            - directdeposit.debit.pending
            - directdeposit.debit.pending.reversal
            - directdeposit.debit.reject
            - directdeposit.debit.reversal
            - dispute.credit
            - dispute.debit
            - fee.charge
            - fee.charge.pending
            - fee.charge.pending.refund
            - fee.charge.reversal
            - funds.expire
            - gpa.credit
            - gpa.credit.authorization
            - gpa.credit.authorization.billpayment
            - gpa.credit.authorization.billpayment.reversal
            - gpa.credit.authorization.reversal
            - gpa.credit.billpayment
            - gpa.credit.chargeback
            - gpa.credit.chargeback.reversal
            - gpa.credit.issueroperator
            - gpa.credit.networkload
            - gpa.credit.networkload.reversal
            - gpa.credit.pending
            - gpa.credit.pending.reversal
            - gpa.credit.reversal
            - gpa.debit
            - gpa.debit.authorization
            - gpa.debit.issueroperator
            - gpa.debit.networkload
            - gpa.debit.pending
            - gpa.debit.pending.reversal
            - gpa.debit.reversal
            - gpa.grant
            - msa.credit
            - msa.credit.chargeback
            - msa.credit.chargeback.reversal
            - msa.credit.pending
            - msa.credit.pending.reversal
            - msa.credit.reversal
            - msa.debit
            - msa.debit.pending
            - msa.debit.pending.reversal
            - original.credit.auth_plus_capture
            - original.credit.auth_plus_capture.reversal
            - original.credit.authorization
            - original.credit.authorization.clearing
            - original.credit.authorization.reversal
            - pindebit
            - pindebit.atm.withdrawal
            - pindebit.authorization
            - pindebit.authorization.clearing
            - pindebit.authorization.reversal
            - pindebit.authorization.reversal.issuerexpiration
            - pindebit.balanceinquiry
            - pindebit.cashback
            - pindebit.chargeback
            - pindebit.chargeback.completed
            - pindebit.chargeback.provisional.credit
            - pindebit.chargeback.provisional.debit
            - pindebit.chargeback.reversal
            - pindebit.chargeback.writeoff
            - pindebit.credit.adjustment
            - pindebit.quasi.cash
            - pindebit.quasicash
            - pindebit.refund
            - pindebit.refund.reversal
            - pindebit.reversal
            - pindebit.transfer
            - programreserve.credit
            - programreserve.debit
            - pushtocard.debit
            - pushtocard.reversal
            - refund
            - refund.authorization
            - refund.authorization.advice
            - refund.authorization.clearing
            - refund.authorization.reversal
            - reward.earn
            - token.activation-request
            - token.advice
            - transfer.fee
            - transfer.peer
            - transfer.program
            - unknown
          readOnly: true
          type: string
        user_token:
          description: >-
            Unique identifier of the user who owns the account that funded the
            transaction; subsequent related transactions retain the same
            `user_token` even if the card used to complete the transaction moves
            to another user.
          maxLength: 36
          minLength: 0
          type: string
        user_transaction_time:
          description: >-
            Date and time when the user initiated the transaction (for example,
            when a merchant entered a refund).
          format: date-time
          type: string
      required:
        - amount
        - state
        - token
        - type
      title: TransactionModel
      type: object
    account_funding_request:
      description: Information used when funding an account.
      properties:
        first_name:
          description: Account holder's first name.
          type: string
        funding_source:
          description: Describes the source of the funding.
          enum:
            - CREDIT
            - DEBIT
            - PREPAID
            - DEPOSIT_ACCOUNT
            - CASH
            - MOBILE_MONEY_ACCOUNT
            - NON_VISA_CREDIT
          type: string
        last_name:
          description: Account holder's last name.
          type: string
        receiver_account_type:
          description: Identifies the account type used for the funding request.
          enum:
            - OTHER
            - RTN_BANK_ACCOUNT
            - IBAN
            - CARD_ACCOUNT
            - EMAIL
            - PHONE_NUMBER
            - BANK_ACCOUNT_NUMBER_AND_BANK_IDENTIFICATION_CODE
            - WALLET_ID
            - SOCIAL_NETWORK_ID
          type: string
        receiver_name:
          description: Recipient's name.
          type: string
        transaction_purpose:
          description: Identifies the purpose of the transaction.
          enum:
            - FAMILY_SUPPORT
            - REGULAR_LABOR_TRANSFERS
            - TRAVEL_AND_TOURISM
            - EDUCATION
            - MEDICAL_TREATMENT
            - EMERGENCY_NEED
            - SAVINGS
            - GIFTS
            - OTHER
            - SALARY
            - CROWD_LENDING
            - CRYPTO_CURRENCY
          type: string
        transaction_type:
          description: Describes the type of transaction.
          enum:
            - ACCOUNT_TO_ACCOUNT
            - PERSON_TO_PERSON
            - WALLET_TRANSFER
            - MONEY_TRANSFER_BY_BANK
            - BUSINESS_TO_BUSINESS
            - DISBURSEMENT
            - GOVERNMENT_DISBURSEMENT
            - GAMBLING_PAYOUT
            - LOYALTY
            - MERCHANT_DISBURSEMENT
            - ONLINE_GAMBLING_PAYOUT
            - PENSION_DISBURSEMENT
            - PREPAID_LOADS
            - CARD_BILL_PAYMENT
            - BILL_PAYMENT
            - CASH_CLAIM
            - CASH_IN
            - CASH_OUT
            - MOBILE_AIR_TIME_PAYMENT
            - MONEY_TRANSFER_BY_MERCHANT
            - FACE_TO_FACE_MERCHANT_PAYMENT
            - GOVERNMENT_PAYMENT
            - PAYMENTS_GOODS_SERVICES
            - FUNDS_TRANSFER
            - GENERAL_BUSINESS_TO_BUSINESS_TRANSFER
            - BUSINESS_TO_BUSINESS_TRANSFER
            - CASH_DEPOSIT
          type: string
      required:
        - first_name
        - funding_source
        - receiver_account_type
        - transaction_type
      type: object
    card_options:
      description: Contains attributes that govern card usage
      properties:
        billing_address:
          $ref: '#/components/schemas/card_options_billing_address'
        card_present:
          default: true
          description: >-
            A value of `true` requires that the card be present for the
            transaction.
          type: boolean
        cvv:
          description: The CVV2 number for the card.
          maxLength: 3
          minLength: 3
          type: string
        expiration:
          description: The expiration date of the card.
          maxLength: 4
          minLength: 4
          type: string
        pin:
          description: The PIN for the card.
          maxLength: 4
          type: string
      type: object
    card_options_billing_address:
      description: >-
        Used for AVS (address verification system). The address-related fields
        in this object are verified against known values.
      properties:
        address:
          description: Cardholder's address.
          type: string
        first_name:
          description: Cardholder's first name.
          type: string
        last_name:
          description: Cardholder's last name.
          type: string
        zip:
          description: Cardholder's postal code.
          type: string
      type: object
    cardholder_balance:
      properties:
        available_balance:
          type: number
        balances:
          additionalProperties:
            $ref: '#/components/schemas/cardholder_balance'
          type: object
        cached_balance:
          type: number
        credit_balance:
          type: number
        currency_code:
          description: The three-digit ISO 4217 currency code.
          type: string
        impacted_amount:
          type: number
        last_updated_time:
          format: date-time
          type: string
        ledger_balance:
          type: number
        pending_credits:
          type: number
      required:
        - available_balance
        - balances
        - cached_balance
        - credit_balance
        - currency_code
        - last_updated_time
        - ledger_balance
        - pending_credits
      type: object
    currency_conversion:
      description: >-
        Contains information from the card network about currency conversion,
        including the original currency of the transaction, the amount of the
        transaction in the origination currency, and the conversion rate.


        Returned if the transaction involves currency conversion.
      properties:
        conversion_rate:
          description: >-
            Conversion rate between the origination currency and the settlement
            currency.


            Returned when the transaction currency is different from the
            origination currency.
          type: number
        original_amount:
          description: |-
            Amount of the transaction in the currency in which it originated.

            Returned if the transaction involves currency conversion.
          type: number
        original_currency_code:
          description: The three-digit ISO 4217 currency code.
          type: string
      type: object
    fee:
      properties:
        active:
          default: false
          type: boolean
        amount:
          type: number
        created_time:
          description: yyyy-MM-ddTHH:mm:ssZ
          format: date-time
          type: string
        currency_code:
          description: The three-digit ISO 4217 currency code.
          type: string
        last_modified_time:
          description: yyyy-MM-ddTHH:mm:ssZ
          format: date-time
          type: string
        name:
          description: 50 char max
          type: string
        real_time_assessment:
          $ref: '#/components/schemas/real_time_fee_assessment'
        tags:
          description: 255 char max
          type: string
        token:
          description: 36 char max
          type: string
      required:
        - active
        - amount
        - created_time
        - currency_code
        - last_modified_time
        - name
        - token
      type: object
    fee_detail:
      properties:
        fee:
          $ref: '#/components/schemas/fee'
        memo:
          maxLength: 99
          minLength: 1
          type: string
        tags:
          maxLength: 255
          minLength: 0
          type: string
        token:
          description: 36 char max
          maxLength: 36
          minLength: 1
          type: string
        transaction_token:
          type: string
      required:
        - fee
        - token
        - transaction_token
      type: object
    funding:
      properties:
        amount:
          type: number
        gateway_log:
          $ref: '#/components/schemas/gateway_log_model'
        source:
          $ref: '#/components/schemas/funding_source_model'
        source_address:
          $ref: '#/components/schemas/CardholderAddressResponse'
      required:
        - source
      type: object
      xml:
        name: funding
    funding_source_model:
      properties:
        active:
          default: false
          type: boolean
        created_time:
          description: yyyy-MM-ddTHH:mm:ssZ
          format: date-time
          type: string
        is_default_account:
          default: false
          type: boolean
        last_modified_time:
          description: yyyy-MM-ddTHH:mm:ssZ
          format: date-time
          type: string
        token:
          type: string
        type:
          type: string
      required:
        - active
        - created_time
        - is_default_account
        - last_modified_time
        - token
        - type
      type: object
    gateway_log_model:
      properties:
        duration:
          format: int64
          type: integer
        message:
          type: string
        order_number:
          type: string
        timed_out:
          default: false
          type: boolean
        transaction_id:
          type: string
      required:
        - message
        - order_number
        - transaction_id
      type: object
      xml:
        name: gateway_log_model
    gpa_response:
      properties:
        amount:
          type: number
        created_time:
          description: yyyy-MM-ddTHH:mm:ssZ
          format: date-time
          type: string
        currency_code:
          description: The three-digit ISO 4217 currency code.
          type: string
        fees:
          items:
            $ref: '#/components/schemas/fee_detail'
          type: array
          xml:
            name: fees
            wrapped: true
        funding:
          $ref: '#/components/schemas/funding'
        funding_source_address_token:
          type: string
        funding_source_token:
          type: string
        gateway_message:
          type: string
        gateway_token:
          format: int64
          type: integer
        jit_funding:
          $ref: '#/components/schemas/jit_funding_api'
        last_modified_time:
          description: yyyy-MM-ddTHH:mm:ssZ
          format: date-time
          type: string
        memo:
          type: string
        response:
          $ref: '#/components/schemas/response'
        state:
          type: string
        tags:
          type: string
        token:
          type: string
        transaction_token:
          type: string
        user_token:
          type: string
      required:
        - amount
        - created_time
        - currency_code
        - funding
        - funding_source_token
        - last_modified_time
        - response
        - state
        - token
        - transaction_token
      type: object
      xml:
        name: gpa_response
    jit_funding_api:
      properties:
        amount:
          exclusiveMinimum: false
          minimum: 0
          type: number
        balances:
          additionalProperties:
            $ref: '#/components/schemas/cardholder_balance'
          type: object
        business_token:
          maxLength: 36
          minLength: 0
          type: string
        decline_reason:
          enum:
            - INVALID_AMOUNT
            - INSUFFICIENT_FUNDS
            - TRANSACTION_NOT_PERMITTED
            - SUSPECTED_FRAUD
            - AMOUNT_LIMIT_EXCEEDED
            - TRANSACTION_COUNT_LIMIT_EXCEEDED
            - DUPLICATE_TRANSACTION
            - INVALID_MERCHANT
            - INVALID_CARD
            - NO_CREDIT_ACCOUNT
            - EXPIRED_CARD
            - NO_CHECKING_ACCOUNT
            - NO_SAVINGS_ACCOUNT
            - STOP_PAYMENT
            - REVOCATION_AUTHORIZATION_ORDER
            - REVOCATION_ALL_AUTHORIZATION_ORDER
            - SOFT_DECLINE_AUTHENTICATION_REQUIRED
            - CLOSED_ACCOUNT
            - SOFT_DECLINE_PIN_REQUIRED
          type: string
        incremental_authorization_jit_funding_tokens:
          items:
            type: string
          type: array
        memo:
          maxLength: 99
          minLength: 0
          type: string
        method:
          enum:
            - pgfs.authorization
            - pgfs.balanceinquiry
            - pgfs.authorization.incremental
            - pgfs.authorization.capture
            - pgfs.authorization.reversal
            - pgfs.auth_plus_capture
            - pgfs.refund
            - pgfs.force_capture
            - pgfs.authorization.capture.chargeback
            - pgfs.authorization.capture.chargeback.reversal
            - pgfs.pindebit.chargeback
            - pgfs.pindebit.chargeback.reversal
            - pgfs.dispute.credit
            - pgfs.dispute.debit
            - pgfs.directdeposit.credit
            - pgfs.directdeposit.debit
            - pgfs.directdeposit.credit.reversal
            - pgfs.directdeposit.debit.reversal
            - pgfs.adjustment.credit
            - pgfs.adjustment.debit
            - pgfs.auth_plus_capture.standin
            - pgfs.authorization.standin
            - pgfs.network.load
            - pgfs.original.credit.authorization
            - pgfs.original.credit.auth_plus_capture
            - pgfs.refund.authorization
            - pgfs.refund.authorization.reversalpgfs.billpayment
            - pgfs.billpayment.capture
            - pgfs.billpayment.reversal
            - pgfs.authorization.account_verification
          type: string
        original_jit_funding_token:
          maxLength: 36
          minLength: 0
          type: string
        tags:
          maxLength: 255
          minLength: 0
          type: string
        token:
          maxLength: 36
          minLength: 0
          type: string
        user_token:
          maxLength: 36
          minLength: 0
          type: string
      required:
        - amount
        - method
        - token
        - user_token
      type: object
    network_fee_model:
      description: Contains card network fees assessed against the cardholder.
      properties:
        amount:
          description: The amount of the network fee.
          type: number
        credit_debit:
          description: |-
            Indicates whether the fee is a credit or a debit.

            * *C* indicates a credit
            * *D* indicates a debit
          enum:
            - C
            - D
          type: string
        type:
          description: The type of fee assessed by the card network.
          enum:
            - ISSUER_FEE
            - SWITCH_FEE
            - PINDEBIT_ASSOC_FEE
            - ACQUIRER_FEE
            - INTERCHANGE_FEE
            - CUR_CONV_CARDHOLDER_FEE
            - CUR_CONV_ISSUER_FEE
            - CROSS_BORDER_ISSUER_FEE
          type: string
      type: object
    original_credit:
      properties:
        funding_source:
          enum:
            - CREDIT
            - DEBIT
            - PREPAID
            - DEPOSIT_ACCOUNT
            - CASH
            - MOBILE_MONEY_ACCOUNT
            - NON_VISA_CREDIT
          type: string
        transaction_type:
          enum:
            - ACCOUNT_TO_ACCOUNT
            - PERSON_TO_PERSON
            - WALLET_TRANSFER
            - MONEY_TRANSFER_BY_BANK
            - BUSINESS_TO_BUSINESS
            - DISBURSEMENT
            - GOVERNMENT_DISBURSEMENT
            - GAMBLING_PAYOUT
            - LOYALTY
            - MERCHANT_DISBURSEMENT
            - ONLINE_GAMBLING_PAYOUT
            - PENSION_DISBURSEMENT
            - PREPAID_LOADS
            - CARD_BILL_PAYMENT
            - BILL_PAYMENT
            - CASH_CLAIM
            - CASH_IN
            - CASH_OUT
            - MOBILE_AIR_TIME_PAYMENT
            - MONEY_TRANSFER_BY_MERCHANT
            - FACE_TO_FACE_MERCHANT_PAYMENT
            - GOVERNMENT_PAYMENT
            - PAYMENTS_GOODS_SERVICES
            - FUNDS_TRANSFER
            - GENERAL_BUSINESS_TO_BUSINESS_TRANSFER
            - BUSINESS_TO_BUSINESS_TRANSFER
            - CASH_DEPOSIT
          type: string
      type: object
    pos:
      description: >-
        Contains information about the point of sale, including details on how
        the card was presented.

        May be returned if the request uses Transaction Model V2 of the Marqeta
        Core API.

        Not returned for V1 requests.
      properties:
        pan_entry_mode:
          description: Entry mode used for transaction.
          enum:
            - MAG_STRIPE
            - MANUAL
            - CARD_ON_FILE
            - CHIP_FALLBACK
            - BAR_CODE
            - OCR
          type: string
        partial_approval_capable:
          default: false
          description: >-
            Whether the card acceptor or terminal is capable of partial
            approvals.
          type: boolean
      type: object
    real_time_fee_assessment:
      properties:
        domestic_enabled:
          default: false
          type: boolean
        international_enabled:
          default: false
          type: boolean
        transaction_type:
          type: string
      type: object
    response:
      properties:
        additional_information:
          type: string
        code:
          type: string
        memo:
          type: string
      required:
        - code
        - memo
      type: object
    token:
      description: >-
        Unique identifier of the card. Useful when a single account holder has
        multiple cards.
      maxLength: 36
      minLength: 0
      type: string
    transaction_card_acceptor:
      description: Contains information about the merchant.
      properties:
        address:
          description: >-
            Card acceptor's address.

            May be returned if the request uses Transaction Model V1 of the
            Marqeta Core API.

            Not returned for V2 requests.
          maxLength: 255
          minLength: 0
          type: string
        city:
          description: Card acceptor's city.
          maxLength: 255
          minLength: 0
          type: string
        country_code:
          description: >-
            Card acceptor's country code.

            May be returned if the request uses Transaction Model V2 of the
            Marqeta Core API.

            Not returned for V1 requests.
          maxLength: 40
          type: string
        mcc:
          description: Merchant category code (MCC).
          maxLength: 5
          minLength: 0
          type: string
        mid:
          description: The merchant identifier.
          maxLength: 15
          minLength: 2
          type: string
        name:
          description: Card acceptor's name.
          maxLength: 255
          minLength: 0
          type: string
        postal_code:
          description: Card acceptor's postal code.
          maxLength: 10
          minLength: 0
          type: string
        state:
          description: >-
            Two-character state, province, or territorial abbreviation.


            For a complete list of valid state and province abbreviations, see
            <</core-api/kyc-verification#_valid_state_provincial_and_territorial_abbreviations,
            Valid state, provincial, and territorial abbreviations>>.
          maxLength: 2
          type: string
      type: object
