# Authorize request (deprecated)

Endpoint: POST /authorize
Version: 1.2
Security: X-Api-Key

## Header parameters:

  - `X-Idempotency-Key` (string)
    The system supports the query deduplication mechanism. 
Any system-wide merchant's request after the first one with 
the same X-Idempotency-Key will return an error.
For example, if you have retrying mechanism for payouts and you want 
to avoid double sending, you can put header with value payout_{your_payout_id}

## Request fields (application/json):

  - `payment_method` (string, required)

  - `merchant_payment_id` (string)
    Optional field, might be used as a reference from the merchant side

  - `merchant_customer_id` (string, required)

  - `email` (string, required)

  - `amount` (string, required)
    can't be zero for SALE | MIT_SALE

  - `language` (string)
    required only for SALE | AUTHORIZE | RECURRING

  - `country_code` (string, required)
    Country Code (ISO 3166-2)

  - `currency_code` (string, required)
    Currency code (ISO 4217)

  - `forced_3d` (boolean)
    If needs to initiate 3d secure from merchant side.

  - `success_url` (string)
    required only for SALE | AUTHORIZE | RECURRING

  - `failure_url` (string)
    required only for SALE | AUTHORIZE | RECURRING

  - `shop_name` (string)
    Shop name

  - `shop_url` (string)
    Shop URL with protocol HTTP or HTTPS

  - `products` (array, required) — one of:
    Expected at least 1 product
    - productSale:
      - `product_id` (string)
        Product ID in Upgate env
      - `merchant_product_id` (string)
        Optional field, might be used as a reference from the merchant side
      - `product_price` (string, required)
      - `product_transaction_price` (string)
      - `product_name` (string, required)
      - `product_description` (string)
      - `is_optional` (boolean)
        Optional product that can be selected or deselected to include or exclude it from the total
      - `is_preselected` (boolean)
        Indicates whether the product is preselected by default on the checkout form. When set to true, the product is automatically checked and included in the total.
      - `product_type` (string, required)
        Enum: "SALE"
    - productSubscription:
      - `product_id` (string)
        Product ID in Upgate env
      - `merchant_product_id` (string)
        Optional field, might be used as a reference from the merchant side
      - `product_price` (string, required)
      - `product_transaction_price` (string)
      - `product_name` (string, required)
      - `product_description` (string, required)
      - `is_optional` (boolean)
        Optional product that can be selected or deselected to include or exclude it from the total
      - `is_preselected` (boolean)
        Indicates whether the product is preselected by default on the checkout form. When set to true, the product is automatically checked and included in the total.
      - `product_type` (string, required)
        Enum: "SUBSCRIPTION"
      - `charge_interval_value` (integer, required)
      - `charge_interval` (string, required)
        Enum: "DAY"
      - `is_trial` (boolean, required)
        If subscription with trial period
      - `trial_interval_value` (integer)
        Only for trial subscription
      - `trial_interval` (string)
        Only for trial subscription
        Enum: same as `charge_interval` in "productSubscription" (1 values)
      - `rebill_transaction_amount` (string, required)
      - `rebill_transaction_currency_code` (string, required)
      - `rebill_transaction_fee_amount` (string)
      - `rebill_transaction_fee_currency_code` (string)
      - `rebill_transaction_tax_amount` (string)
      - `rebill_transaction_tax_currency_code` (string)
      - `last_transacion_id` (string)

## Response 200 fields (application/json):

  - `type` (string, required)
    Enum: "PAYMENT"

  - `data` (object, required)

  - `data.payment_id` (string, required)

  - `data.initial_subscription_id` (string)

  - `data.payment_type` (string, required)
    Enum: "SALE", "AUTHORIZE", "MIT_SALE", "MIT_AUTHORIZE", "RECURRING", "RECURRING_REBILL"

  - `data.payment_method` (string, required)

  - `data.created_at` (string, required)
    UTC date time format
    Example: "2020-20-20T20:00:00.633Z"

  - `data.merchant_id` (string, required)

  - `data.merchant_payment_id` (string)

  - `data.merchant_customer_id` (string, required)

  - `data.email` (string, required)

  - `data.amount` (string, required)

  - `data.language` (string)

  - `data.country_code` (string, required)
    Country Code (ISO 3166-2)

  - `data.currency_code` (string, required)
    Currency code (ISO 4217)

  - `data.base_amount` (string)

  - `data.base_currency_code` (string)
    Currency code (ISO 4217)

  - `data.transaction_amount` (string)

  - `data.transaction_currency_code` (string)
    Currency code (ISO 4217)

  - `data.transaction_fee_amount` (string)

  - `data.transaction_fee_currency_code` (string)
    Currency code (ISO 4217)

  - `data.transaction_tax_amount` (string)

  - `data.transaction_tax_currency_code` (string)
    Currency code (ISO 4217)

  - `data.transaction_tax_percentage` (string)

  - `data.transaction_tax_exempt_amount` (string)

  - `data.transaction_tax_type` (string)
    Enum: "INCLUDED", "ON_TOP"

  - `data.transaction_tax_label` (string)
    Enum: "TAX", "VAT", "GST", "SALES_TAX"

  - `data.forced_3d` (boolean)
    If needs to initiate 3d secure from merchant side

  - `data.success_url` (string)
    required only for SALE | AUTHORIZE | RECURRING | RECURRING_REBILL

  - `data.failure_url` (string)
    required only for SALE | AUTHORIZE | RECURRING | RECURRING_REBILL

  - `data.payment_token_id` (string)
    Token from original payment. Used for MIT_SALE | MIT_AUTHORIZE

  - `data.shop_name` (string)
    Shop name

  - `data.shop_url` (string)
    Shop URL with protocol HTTP or HTTPS

  - `data.session` (object)

  - `data.session.created_at` (string, required)
    UTC date time format

  - `data.session.expires_at` (string, required)
    UTC date time format

  - `data.session.redirect_url` (string, required)

  - `data.products` (array, required) — one of:
    Expected at least 1 product
    - productSale:
      - `product_id` (string)
        Product ID in Upgate env
      - `merchant_product_id` (string)
        Optional field, might be used as a reference from the merchant side
      - `product_price` (string, required)
      - `product_transaction_price` (string)
      - `product_name` (string, required)
      - `product_description` (string)
      - `is_optional` (boolean)
        Optional product that can be selected or deselected to include or exclude it from the total
      - `is_preselected` (boolean)
        Indicates whether the product is preselected by default on the checkout form. When set to true, the product is automatically checked and included in the total.
      - `product_type` (string, required)
        Enum: same as `product_type` in "productSale" (1 values)
    - productSubscription:
      - `product_id` (string)
        Product ID in Upgate env
      - `merchant_product_id` (string)
        Optional field, might be used as a reference from the merchant side
      - `product_price` (string, required)
      - `product_transaction_price` (string)
      - `product_name` (string, required)
      - `product_description` (string, required)
      - `is_optional` (boolean)
        Optional product that can be selected or deselected to include or exclude it from the total
      - `is_preselected` (boolean)
        Indicates whether the product is preselected by default on the checkout form. When set to true, the product is automatically checked and included in the total.
      - `product_type` (string, required)
        Enum: same as `product_type` in "productSubscription" (1 values)
      - `charge_interval_value` (integer, required)
      - `charge_interval` (string, required)
        Enum: same as `charge_interval` in "productSubscription" (1 values)
      - `is_trial` (boolean, required)
        If subscription with trial period
      - `trial_interval_value` (integer)
        Only for trial subscription
      - `trial_interval` (string)
        Only for trial subscription
        Enum: same as `charge_interval` in "productSubscription" (1 values)
      - `rebill_transaction_amount` (string, required)
      - `rebill_transaction_currency_code` (string, required)
      - `rebill_transaction_fee_amount` (string)
      - `rebill_transaction_fee_currency_code` (string)
      - `rebill_transaction_tax_amount` (string)
      - `rebill_transaction_tax_currency_code` (string)
      - `last_transacion_id` (string)

## Response 400 fields (application/json):

  - `errors` (array)

  - `errors.error_code` (string, required)
    Enum: "INVALID_REQUEST_PARAMETER", "INVALID_REQUEST", "INTERNAL_ERROR", "TOO_MANY_REQUESTS", "NOT_FOUND"

  - `errors.error_message` (string, required)


