> ## Documentation Index
> Fetch the complete documentation index at: https://api-reference.hyperswitch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Telephone Order - Charge

> Charges a card that an IVR provider collected over the phone. Only `twilio` is supported as `{provider}`.



## OpenAPI

````yaml post /telephone_order/{merchant_id}/{provider}
openapi: 3.0.3
info:
  title: Hyperswitch - API Documentation
  description: >

    ## Get started


    Hyperswitch provides a collection of APIs that enable you to process and
    manage payments.

    Our APIs accept and return JSON in the HTTP body, and return standard HTTP
    response codes.


    You can consume the APIs directly using your favorite HTTP/REST library.


    We have a testing environment referred to "sandbox", which you can setup to
    test API calls without

    affecting production data.

    Currently, our sandbox environment is live while our production environment
    is under development

    and will be available soon.

    You can sign up on our Dashboard to get API keys to access Hyperswitch API.


    ### Environment


    Use the following base URLs when making requests to the APIs:


    | Environment   |  Base URL                          |

    |---------------|------------------------------------|

    | Sandbox       | <https://sandbox.hyperswitch.io>   |

    | Production    | <https://api.hyperswitch.io>       |


    ## Authentication


    When you sign up on our [dashboard](https://app.hyperswitch.io) and create a
    merchant

    account, you are given a secret key (also referred as api-key) and a
    publishable key.

    You may authenticate all API requests with Hyperswitch server by providing
    the appropriate key in

    the request Authorization header.


    | Key             | 
    Description                                                                                 
    |

    |-----------------|-----------------------------------------------------------------------------------------------|

    | api-key         | Private key. Used to authenticate all API requests from
    your merchant server                  |

    | publishable key | Unique identifier for your account. Used to authenticate
    API requests from your app's client  |


    Never share your secret api keys. Keep them guarded and secure.
  contact:
    name: Hyperswitch Support
    url: https://hyperswitch.io
    email: support.global@juspay.io
  license:
    name: Apache-2.0
  version: 0.1.0
servers:
  - url: https://sandbox.hyperswitch.io
    description: Sandbox Environment
security: []
tags:
  - name: Merchant Account
    description: Create and manage merchant accounts
  - name: Profile
    description: Create and manage profiles
  - name: Merchant Connector Account
    description: Create and manage merchant connector accounts
  - name: Payments
    description: Create and manage one-time payments, recurring payments and mandates
  - name: Refunds
    description: Create and manage refunds for successful payments
  - name: Mandates
    description: Manage mandates
  - name: Customers
    description: Create and manage customers
  - name: Payment Methods
    description: Create and manage payment methods of customers
  - name: Disputes
    description: Manage disputes
  - name: API Key
    description: Create and manage API Keys
  - name: Payouts
    description: Create and manage payouts
  - name: payment link
    description: Create payment link
  - name: Routing
    description: Create and manage routing configurations
  - name: Event
    description: Manage events
  - name: Authentication
    description: Create and manage authentication
  - name: Subscriptions
    description: Subscription management and billing endpoints
  - name: Card Issuer
    description: Create and manage card issuers
  - name: Telephone Order
    description: Charge cards collected over the phone by an IVR provider
paths:
  /telephone_order/{merchant_id}/{provider}:
    post:
      tags:
        - Telephone Order
      summary: Telephone Order - Charge
      description: >-
        Charges a card that an IVR provider collected over the phone. Only
        `twilio` is supported as `{provider}`.
      operationId: Charge a telephone order
      parameters:
        - name: merchant_id
          in: path
          description: >-
            The unique identifier for the merchant account the card is charged
            under
          required: true
          schema:
            type: string
          example: merchant_1791294465
        - name: provider
          in: path
          description: >-
            The telephone order provider posting the request. Currently only
            `twilio`.
          required: true
          schema:
            type: string
          example: twilio
      requestBody:
        description: >-
          The provider's charge request. Shown here in Twilio's Generic Pay
          Connector shape.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TwilioGenericPayRequest'
            examples:
              Charge a card collected over the phone:
                value:
                  amount: '1.00'
                  cardnumber: '4242424242424242'
                  currency_code: USD
                  cvv: '123'
                  description: Order placed over the phone
                  expiry_month: '12'
                  expiry_year: '28'
                  method: charge
                  parameters:
                    payment_id: pay_8320b449b06630271e378214dab80ce5
                    profile_id: pro_GUMsmmzTU7oadT00pJeo
                  postal_code: '94122'
                  transaction_id: IPe16430-39ba-4820-bedc-7aad0762a487
        required: true
      responses:
        '200':
          description: The outcome of the charge, in the provider's response shape.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TwilioGenericPayResponse'
              examples:
                01. The card was charged:
                  value:
                    charge_id: pay_8320b449b06630271e378214dab80ce5
                    error_code: null
                    error_message: null
                    parameters:
                      amount_capturable: '0'
                      amount_received: '100'
                      connector: stripe
                      connector_transaction_id: pi_3URyI8D5R7gDAGff17RhZpfW
                      merchant_order_reference_id: IPe16430-39ba-4820-bedc-7aad0762a487
                      payment_id: pay_8320b449b06630271e378214dab80ce5
                      status: succeeded
                02. The card was declined:
                  value:
                    charge_id: null
                    error_code: card_declined
                    error_message: Your card was declined.
                    parameters:
                      connector: stripe
                      merchant_order_reference_id: IPe16430-39ba-4820-bedc-7aad0762a487
                      payment_id: pay_8320b449b06630271e378214dab80ce5
                      status: failed
                      unified_code: UE_9000
                03. The charge has no final outcome:
                  value:
                    charge_id: null
                    error_code: PAYMENT_PENDING
                    error_message: Payment is not yet complete
                    parameters:
                      connector: stripe
                      merchant_order_reference_id: IPe16430-39ba-4820-bedc-7aad0762a487
                      payment_id: pay_8320b449b06630271e378214dab80ce5
                      status: processing
        '400':
          description: >-
            The request was rejected before a charge was attempted: the API key
            is missing or does not belong to this merchant, the provider in the
            path is unknown, or the body is not a valid charge request for that
            provider.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericErrorResponseOpenApi'
              example:
                code: IR_04
                message: 'Missing required param: transaction_id'
                type: invalid_request
      security:
        - basic_api_key: []
components:
  schemas:
    TwilioGenericPayRequest:
      type: object
      required:
        - method
        - transaction_id
      properties:
        method:
          $ref: '#/components/schemas/TwilioPayMethod'
        transaction_id:
          type: string
          description: >-
            Twilio's id for this attempt. Stable across its retries, and used to
            derive the `payment_id` so a retry replays the original charge.
          example: IPe16430-39ba-4820-bedc-7aad0762a487
        cardnumber:
          type: string
          description: Card number collected over DTMF. Required for a charge.
          example: '4242424242424242'
          nullable: true
        cvv:
          type: string
          description: Card security code collected over DTMF. Required for a charge.
          example: '123'
          nullable: true
        expiry_month:
          type: string
          description: Two digit card expiry month. Required for a charge.
          example: '12'
          nullable: true
        expiry_year:
          type: string
          description: Two or four digit card expiry year. Required for a charge.
          example: '28'
          nullable: true
        postal_code:
          type: string
          description: Billing postal code, collected for AVS.
          example: '94122'
          nullable: true
        bankaccountnumber:
          type: string
          description: Bank account number for ACH debits. Not supported.
          nullable: true
        routingnumber:
          type: string
          description: Bank routing number for ACH debits. Not supported.
          nullable: true
        amount:
          type: string
          description: Amount in major units, as a decimal string. Absent for `tokenize`.
          example: '1.00'
          nullable: true
        currency_code:
          allOf:
            - $ref: '#/components/schemas/Currency'
          nullable: true
        description:
          type: string
          description: Free-form description configured on the `<Pay>` verb.
          example: Order placed over the phone
          nullable: true
        parameters:
          type: object
          description: >-
            Values from the IVR's `<Parameter>` tags, stored unmasked in the
            payment's `metadata`. `profile_id`, `payment_id` and `customer_id`
            are also read.
          nullable: true
    TwilioGenericPayResponse:
      type: object
      description: >-
        Body Twilio expects back. It reads `error_code` to decide the outcome,
        so a decline is a `200` with that set.
      required:
        - parameters
      properties:
        charge_id:
          type: string
          description: The Hyperswitch `payment_id`, on a successful charge.
          example: pay_8320b449b06630271e378214dab80ce5
          nullable: true
        error_code:
          type: string
          description: >-
            Set when the payment did not succeed: the connector's decline code,
            or one of `INVALID_REQUEST`, `PROFILE_NOT_FOUND`,
            `PAYMENT_NOT_COMPLETED`, `PAYMENT_PENDING`, `DUPLICATE_TRANSACTION`,
            `PROCESSING_ERROR`, `TOKENIZE_UNSUPPORTED`,
            `BANK_ACCOUNT_UNSUPPORTED`. On `PAYMENT_PENDING` the funds may be
            held, so do not re-prompt for a card.
          example: PAYMENT_NOT_COMPLETED
          nullable: true
        error_message:
          type: string
          description: Human readable counterpart to `error_code`.
          example: Your card was declined.
          nullable: true
        parameters:
          type: object
          description: >-
            Returned either way, and the only channel carrying a `payment_id`
            when `charge_id` is `null`. Flat and all-string; the request's own
            `parameters` are never echoed back.
    GenericErrorResponseOpenApi:
      type: object
      required:
        - error_type
        - message
        - code
      properties:
        error_type:
          type: string
          example: invalid_request
        message:
          type: string
          example: 'Missing required param: {param}'
        code:
          type: string
          example: IR_04
    TwilioPayMethod:
      type: string
      description: The operation Twilio is asking us to perform.
      enum:
        - charge
        - tokenize
    Currency:
      type: string
      description: >-
        The three-letter ISO 4217 currency code (e.g., "USD", "EUR") for the
        payment amount. This field is mandatory for creating a payment.
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BTN
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHF
        - CLF
        - CLP
        - CNY
        - COP
        - CRC
        - CUC
        - CUP
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ERN
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HRK
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - IQD
        - IRR
        - ISK
        - 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
        - MRU
        - 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
        - SLE
        - SLL
        - SOS
        - SRD
        - SSP
        - STD
        - STN
        - SVC
        - SYP
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VES
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
        - ZWL
  securitySchemes:
    basic_api_key:
      type: http
      scheme: basic
      description: >-
        HTTP Basic authentication with a merchant API key as the password. The
        username is ignored. Used by endpoints that a third party posts to, such
        as telephone order providers.

````

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