> ## 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 authorize operation

> This method allows you to perform an "authorize" operation (also called "preauthorization" or "authorization") through your payment gateway. When you perform the "authorize" operation, the bank that issued the credit card will place an authorization of the total amount of the funds. This is how the bank determines if the funds are available to make the purchase. The card will not actually be “charged” until you perform the "capture" operation (using our `[PUT] /PaymentGateway/capture` method).
**Please note**, different card brands and different banks allow for different time frames on the lifespan of a payment authorization. You will need to check with your payment processor on how long you would have between performing an "authorize" operation and a "charge" operation".
If needed, you can void this "authorize" operation by using the `[DELETE] /PaymentGateway/void` method

This method allows you to perform an "authorize" operation (also called "preauthorization" or "authorization") through your payment gateway. When you perform the "authorize" operation, the bank that issued the credit card will place an authorization of the total amount of the funds. This is how the bank determines if the funds are available to make the purchase. The card will not actually be "charged" until you perform the "capture" operation (using the `PUT /PaymentGateway/capture` method).

**Please note**: Different card brands and different banks allow for different time frames on the lifespan of a payment authorization. Check with your payment processor on how long you have between performing an "authorize" operation and a "capture" operation. If needed, you can void this "authorize" operation using the `DELETE /PaymentGateway/void` method.

<Note>
  **Additional parameters may be required**

  Some payment processors require custom parameters and properties to be added to the request. See [Gateway-Specific Requirements](/guides/rest-api/gateway-requirements) for processors that require additional information.
</Note>

<Note>
  **Payment gateway merchant account credentials**

  Orchestra offers two options for providing merchant account credentials:

  1. **Inline credentials**: Provide the merchant account credentials in the request using the `paymentGatewayAccount` object.
  2. **Stored credentials**: Use our [Payment Gateway Accounts](/api-reference/paymentgatewayaccounts/add-or-replace-a-payment-gateway-account) system to pre-upload and store credentials, then reference them with the `paymentGatewayAccountName` parameter.
</Note>

<Card title="Authorize & Capture Guide" icon="book" href="/guides/rest-api/authorize-capture">
  Complete guide with examples, capture flow, and best practices
</Card>


## OpenAPI

````yaml post /PaymentGateway/authorize
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/authorize:
    post:
      tags:
        - PaymentGateway
      summary: Perform a payment gateway authorize operation
      description: >-
        This method allows you to perform an "authorize" operation (also called
        "preauthorization" or "authorization") through your payment gateway.
        When you perform the "authorize" operation, the bank that issued the
        credit card will place an authorization of the total amount of the
        funds. This is how the bank determines if the funds are available to
        make the purchase. The card will not actually be “charged” until you
        perform the "capture" operation (using our `[PUT]
        /PaymentGateway/capture` method).

        **Please note**, different card brands and different banks allow for
        different time frames on the lifespan of a payment authorization. You
        will need to check with your payment processor on how long you would
        have between performing an "authorize" operation and a "charge"
        operation".

        If needed, you can void this "authorize" operation by using the
        `[DELETE] /PaymentGateway/void` method
      operationId: GatewayAuthorize
      requestBody:
        description: Card Authorize model
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayTools_Api.Models.AuthRequestModel'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Payments.OperationResult'
        '202':
          description: Accepted (for future processing by payment gateway)
        '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 - rejected by payment gateway
        '500':
          description: Error with payment gateway
        '503':
          description: Temporary failure with payment gateway
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PayTools_Api.Models.AuthRequestModel:
      required:
        - amount
        - card
        - currency
      type: object
      properties:
        currency:
          minLength: 1
          type: string
          description: >-
            The currency of the transaction. Based on the <a
            href="https://en.wikipedia.org/wiki/ISO_4217#Active_codes"
            target="_blank">ISO 4217</a> standard.
        isDigital:
          type: boolean
          description: >-
            This field is an additional optional parameter used by some of our
            payment processors. Please read our additional guidance section for
            payment processors that use this and other parameters
        orderDesc:
          type: string
          description: >-
            This field is an additional optional parameter used by some of our
            payment processors. Please read our additional guidance section for
            payment processors that use this and other parameters
          nullable: true
        userToken:
          type: string
          description: Token from gateway to be used instead of card details
          nullable: true
        generateToken:
          type: boolean
          description: Whether to generate a payment gateway token
        payerDetails:
          $ref: '#/components/schemas/PayTools_Api.Models.PayerDetails'
        amount:
          type: number
          description: >-
            The amount to be charged (the amount should be in major units - for
            example, 10.23)
          format: double
        myRef:
          type: string
          description: Your custom reference for this transaction
          nullable: true
        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
    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

````