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

# Perform a payment gateway tokenize operation

> This method allows you to perform a "tokenize" operation for a card.
This will take the card details and will generate a payment gateway-specific token.
Please note that not all payment gateways support this operation.

<Note>
  Not all payment gateways support tokenization. Gateway tokens are specific to the payment processor and are used for recurring payments. For general-purpose tokenization, see [String Tokens](/api-reference/stringtokens/overview).
</Note>

<Card title="Gateway Tokenization Guide" icon="book" href="/guides/rest-api/gateway-tokenization">
  Complete guide with examples and comparison to String Tokens
</Card>


## OpenAPI

````yaml post /PaymentGateway/tokenize
openapi: 3.0.4
info:
  title: Orchestra API
  description: Code Version 1.0.11.6
  version: Prod
servers:
  - url: https://api.orchestrasolutions.com
security: []
tags:
  - name: AP2
    description: Test AP2 controller
  - name: EWalletOperations
    description: Card operations controller
  - name: MockCredentialProvider
    description: |-
      Mock Credential Provider controller implementing JSON-RPC 2.0 protocol
      Used for testing AP2 checkout flows
  - name: PaymentGatewayAccounts
    description: Payment Gateway Accounts
  - name: PaymentGateway
    description: Universal Payment Gateway
  - name: StringTokens
    description: Token management
  - name: Tools
    description: >-
      Card tools for BIN/IIN lookup, brand identification, Luhn validation, and
      card risk assessment
  - name: Utils
    description: Utils
paths:
  /PaymentGateway/tokenize:
    post:
      tags:
        - PaymentGateway
      summary: Perform a payment gateway tokenize operation
      description: >-
        This method allows you to perform a "tokenize" operation for a card.

        This will take the card details and will generate a payment
        gateway-specific token.

        Please note that not all payment gateways support this operation.
      operationId: GatewayTokenize
      requestBody:
        description: Tokenize Request Model
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayTools_Api.Models.TokenizeRequestModel'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Payments.OperationResult'
        '400':
          description: Bad data
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: >-
                    #/components/schemas/PayTools_Shared.Models.ValidationErrorMessage
        '401':
          description: Not authenticated
        '409':
          description: >-
            Conflict - payment gateway does not support the 'Tokenize' operation
            or rejected by payment gateway
        '500':
          description: Error with payment gateway
        '503':
          description: Temporary failure with payment gateway
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PayTools_Api.Models.TokenizeRequestModel:
      required:
        - card
      type: object
      properties:
        payerDetails:
          $ref: '#/components/schemas/PayTools_Api.Models.PayerDetails'
        card:
          $ref: '#/components/schemas/PayTools_Api.Models.CardInputModel'
        paymentGatewayAccountName:
          type: string
          description: >-
            The reference name provided to the stored Payment Gateway Account as
            set in `PUT /PaymentGatewayAccounts/{name}`.

            **Please note**, if you provide us with both this parameter and the
            raw credentials in the `paymentGatewayAccount` object, this
            parameter will be ignored and the raw credentials will take
            precedence.
          nullable: true
        certificateName:
          maxLength: 128
          type: string
          description: >-
            Optional parameter if the payment gateway requires authentication
            using a client certificate. The name of the certificate that was
            stored in our system via our <a
            href="https://portal.orchestrasolutions.com" target="_blank">users
            portal</a>
          nullable: true
        paymentGatewayAccount:
          $ref: '#/components/schemas/PayTools_Api.Models.PaymentGatewayAccount'
        networkTokenBrand:
          $ref: '#/components/schemas/Payments.NetworkTokenSchemes'
      additionalProperties: false
      description: Model for performing a payment gateway tokenization
    Payments.OperationResult:
      type: object
      properties:
        authorizationCode:
          type: string
          nullable: true
        currency:
          $ref: '#/components/schemas/Payments.CurrencyCode'
        amount:
          type: number
          format: double
        operationType:
          $ref: '#/components/schemas/Payments.Operation'
        operationResultCode:
          $ref: '#/components/schemas/Payments.Result'
        operationResultDescription:
          type: string
          nullable: true
        customGatewayResponse:
          nullable: true
        gatewayName:
          type: string
          nullable: true
        gatewayReference:
          type: string
          nullable: true
        gatewayResultCode:
          type: string
          nullable: true
        gatewayResultDescription:
          type: string
          nullable: true
        gatewayResultSubCode:
          type: string
          nullable: true
        gatewayResultSubDescription:
          type: string
          nullable: true
        gatewayToken:
          nullable: true
      additionalProperties: false
    PayTools_Shared.Models.ValidationErrorMessage:
      type: object
      properties:
        fieldName:
          type: string
          description: Field name the error(s) are referring to
          nullable: true
        errors:
          type: array
          items:
            type: string
          description: List of errors
          nullable: true
      additionalProperties: false
      description: Model for display validation error messages
    PayTools_Api.Models.PayerDetails:
      required:
        - clientIPAddress
        - countryCode
      type: object
      properties:
        address1:
          type: string
          description: 1st address line
          nullable: true
        address2:
          type: string
          description: 2nd address line
          nullable: true
        address3:
          type: string
          description: 3rd address line
          nullable: true
        postCode:
          type: string
          description: Postal code or Zip code
          nullable: true
        clientIPAddress:
          minLength: 1
          type: string
          description: Client IP address
        city:
          type: string
          description: City
          nullable: true
        stateProvince:
          type: string
          description: State or Province
          nullable: true
        countryCode:
          minLength: 1
          pattern: '[A-Z]{2}'
          type: string
          description: >-
            2 letter country code (<a
            href="https://en.wikipedia.org/wiki/ISO_3166-2#Current_codes"
            target="_blank">ISO 3166-2 <img
            src="https://files.readme.io/b676144-openNewWindow.png" width="10"
            /></a>)
      additionalProperties: false
      description: The billing information of the card owner
    PayTools_Api.Models.CardInputModel:
      required:
        - cardHolderName
        - cardNumber
        - expirationMonth
        - expirationYear
      type: object
      properties:
        ownerID:
          type: string
          description: Card owner Id
          nullable: true
        issueNumber:
          type: string
          description: Card Issue Number
          nullable: true
        cvv:
          type: string
          description: >-
            Card security code (digits on back of card) or a Reference to a
            Tokenized string. A Token should be referenced in the format @TOKEN,
            e.g \"@nQGywsQE9gbURtrXEjTZwtWqeMdK9nsO\
          nullable: true
        threeDSAuthentication:
          $ref: >-
            #/components/schemas/PayTools_Api.Models.ThreeDSAuthenticationInputModel
        cardType:
          $ref: '#/components/schemas/Payments.CardTypes'
        cardHolderName:
          minLength: 1
          type: string
          description: Cardholder name (as apears on card)
        cardNumber:
          minLength: 1
          type: string
          description: >-
            Card number (PAN) or a Reference to a Tokenized string. A Token
            should be referenced in the format @TOKEN, e.g
            "@nQGywsQE9gbURtrXEjTZwtWqeMdK9nsO"
        expirationYear:
          type: integer
          description: Expiration year
          format: int32
        expirationMonth:
          type: integer
          description: Expiration month
          format: int32
      additionalProperties: false
      description: >-
        The card details that should be charged. You can either provide us with
        the raw card details or provide a reference to the stored card details
        in a token.
    PayTools_Api.Models.PaymentGatewayAccount:
      type: object
      properties:
        paymentGatewayName:
          type: string
          description: >-
            Unique name of the Payment Gateway the account information relates
            to.
          nullable: true
        credentials:
          type: array
          items:
            $ref: '#/components/schemas/PayTools_Shared.Models.KeyValue'
          description: >-
            A list of key-value pairs that represents your credentials within
            the Payment gateway. 

            Each key should represent a parameter listed in the
            "CredentialsNames" element of the response from the list all payment
            gateways method at `[GET] /paymentGateway`

            Example:

            "Credentials": [
               {
                   "Key": "PrivateKey",
                   "Value": "VBtt666M/G098098vgdewvk0Mc-GH"
               }
            ]
          nullable: true
      additionalProperties: false
      description: >-
        The raw credentials necessary to connect to the chosen payment gateway
        as defined in `GET /PaymentGateway`.

        **Please note**, if you provide us with both the raw details here and a
        stored Payment Gateway Account in the `paymentGatewayAccountName`
        parameter, these credentials will take precedence.
    Payments.NetworkTokenSchemes:
      enum:
        - Visa
        - MasterCard
        - Amex
      type: string
    Payments.CurrencyCode:
      enum:
        - AFN
        - EUR
        - ALL
        - DZD
        - USD
        - AOA
        - XCD
        - ARS
        - AMD
        - AWG
        - AUD
        - AZN
        - BSD
        - BHD
        - BDT
        - BBD
        - BYR
        - BZD
        - XOF
        - BMD
        - BTN
        - INR
        - BOB
        - BOV
        - BAM
        - BWP
        - NOK
        - BRL
        - BND
        - BGN
        - BIF
        - KHR
        - XAF
        - CAD
        - CVE
        - KYD
        - CLF
        - CLP
        - CNY
        - COP
        - COU
        - KMF
        - CDF
        - NZD
        - CRC
        - HRK
        - CUC
        - CUP
        - ANG
        - CZK
        - DKK
        - DJF
        - DOP
        - EGP
        - SVC
        - ERN
        - ETB
        - FKP
        - FJD
        - XPF
        - GMD
        - GEL
        - GHS
        - GIP
        - GTQ
        - GBP
        - GNF
        - GYD
        - HTG
        - HNL
        - HKD
        - HUF
        - ISK
        - IDR
        - XDR
        - IRR
        - IQD
        - ILS
        - JMD
        - JPY
        - JOD
        - KZT
        - KES
        - KPW
        - KRW
        - KWD
        - KGS
        - LAK
        - LBP
        - LSL
        - ZAR
        - LRD
        - LYD
        - CHF
        - LTL
        - MOP
        - MKD
        - MGA
        - MWK
        - MYR
        - MVR
        - MRO
        - MUR
        - XUA
        - MXN
        - MXV
        - MDL
        - MNT
        - MAD
        - MZN
        - MMK
        - NAD
        - NPR
        - NIO
        - NGN
        - OMR
        - PKR
        - PAB
        - PGK
        - PYG
        - PEN
        - PHP
        - PLN
        - QAR
        - RON
        - RUB
        - RWF
        - SHP
        - WST
        - STD
        - SAR
        - RSD
        - SCR
        - SLL
        - SGD
        - XSU
        - SBD
        - SOS
        - SSP
        - LKR
        - SDG
        - SRD
        - SZL
        - SEK
        - CHE
        - CHW
        - SYP
        - TWD
        - TJS
        - TZS
        - THB
        - TOP
        - TTD
        - TND
        - TRY
        - TMT
        - UGX
        - UAH
        - AED
        - USN
        - UYI
        - UYU
        - UZS
        - VUV
        - VEF
        - VND
        - YER
        - ZMW
        - ZWL
        - XBA
        - XBB
        - XBC
        - XBD
        - XTS
        - XXX
        - XAU
        - XPD
        - XPT
        - XAG
      type: string
    Payments.Operation:
      enum:
        - Charge
        - PreAuth
        - Capture
        - Void
        - Refund
        - Tokenize
        - Status
      type: string
    Payments.Result:
      enum:
        - Success
        - Accepted
        - Rejected
        - TemporaryFailure
        - FatalFailure
        - NotImplemented
      type: string
    PayTools_Api.Models.ThreeDSAuthenticationInputModel:
      required:
        - authenticationValue
        - eci
        - merchantName
        - version
        - xid
      type: object
      properties:
        authenticationValue:
          minLength: 1
          type: string
          description: Authentication value
        eci:
          maxLength: 2
          minLength: 1
          type: string
          description: Electronic Commerce Indicator
        xid:
          maxLength: 40
          minLength: 1
          type: string
          description: transaction ID from the 3D Secure provider
        version:
          maxLength: 5
          minLength: 1
          type: string
          description: 3ds Version
        merchantName:
          maxLength: 40
          minLength: 1
          type: string
          description: Merchant name
        sli:
          type: string
          description: (MasterCard) Security Level Indicator
          nullable: true
      additionalProperties: false
      description: Model for 3DS authentication data
    Payments.CardTypes:
      enum:
        - Unspecified
        - AMEX
        - BC
        - CartaSi
        - Dankort
        - Delta
        - DinersClub
        - Discover
        - Electron
        - Elo
        - enRoute
        - Hipercard
        - JCB
        - Maestro
        - MasterCard
        - MC_Alaska
        - MC_Canada
        - Switch
        - Troy
        - UATP
        - UnionPay
        - Visa
      type: string
    PayTools_Shared.Models.KeyValue:
      type: object
      properties:
        key:
          type: string
          description: Key
          nullable: true
        value:
          type: string
          description: Value
          nullable: true
      additionalProperties: false
      description: A helper class
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Please enter ApiKey into field
      name: X-Api-Key
      in: header

````