> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-881012b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate OTP for Payment Source

> Generate OTP for payment source using the Razorpay TPAP Pro API.

<div style={{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.35rem 0.9rem",border:"1px solid rgba(128,128,128,0.28)",borderRadius:"0.5rem",padding:"0.45rem 0.75rem",margin:"0 0 1.25rem",fontSize:"0.875rem"}}>
  <span style={{fontWeight:600}}>Available in</span>
  <span>🇮🇳 India</span>
</div>

Use this endpoint to generate the OTP via the remitter bank while setting the UPI PIN.

<RequestExample>
  ```bash Curl theme={null}
  curl -X POST 'api.rzp.<bank>.com/v1/upi/tpap/fundsources/:id/otp' \
  -u [YOUR_KEY_ID]:[YOUR_SECRET] \
  -H "Content-type: application/json" \
  -H "x-device-fingerprint: <device_fingerprint>" \
  -H "x-device-fingerprint-timestamp: 1496918882000" \
  -H "x-customer-reference: customer-id-from-customer" \
  -d '{
    "vpa":"vpa@handle",
    "card":{
      "last6":"123456",
      "expiry_month":"02",
      "expiry_year":"26"
    },
    "upi_transaction_id":"123456",
    "device":{
      "geocode":"1234.1213",
      "ip":"198.1.1.1"
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "entity":"upi.fundsource",
    "id":"fs_1234",
    "type":"savings",
    "customer_name":"name",
    "masked_account_number":"xx9987",
    "ifsc":"IFSC001",
    "upi_pin_set":true,
    "upi_pin_length":4,
    "otp_length":4,
    "atm_pin_length":4,
    "fundsource_provider":{
      "name":"HDFC Bank",
      "upi_iin":"600007",
      "upi_enabled":false,
      "mobile_registration_format":"format1",
      "logo_url":"<bank logo url>"
    },
    "vpas":{
      "entity":"collection",
      "count":1,
      "items":[
        {
          "mobile":"9999999999",
          "address":"anc@handle",
          "status":"active",
          "primary":true
        }
      ]
    },
    "upi_transaction_id":"123456"
  }
  ```
</ResponseExample>

## Query Parameters

<ParamField query="id" type="string">
  The payment source identifier generated as a response from the Create VPA API.
</ParamField>

## Request Parameters

<ParamField body="vpa" type="string" required>
  The VPA linked to the payment source.
</ParamField>

<ParamField body="card" type="object" required>
  The card details.
</ParamField>

<ParamField body="last6" type="string">
  The last 6 digits of the card, which the fund source provider will verify before setting the PIN.
</ParamField>

<ParamField body="expiry_month" type="string">
  The expiry month of the card in `MM` format.
</ParamField>

<ParamField body="expiry_year" type="string">
  The expiry year of the card in `YY` format.
</ParamField>

<ParamField body="upi_transaction_id" type="string" required>
  The UPI transaction identifier. For example, `123456`.
</ParamField>

<ParamField body="device" type="object">
  The device details.
</ParamField>

<ParamField body="ip" type="string">
  The IP address of the device.
</ParamField>

<ParamField body="geocode" type="string">
  The location coordinates of the device. For example, `12.9667,77.5667`.
</ParamField>

## Response Parameters

<ResponseField name="entity" type="string">
  Name of the entity. Here, it is `fundsource`.
</ResponseField>

<ResponseField name="id" type="string">
  Unique identifier of the entity.
</ResponseField>

<ResponseField name="type" type="string">
  Type of account.
</ResponseField>

<ResponseField name="customer_name" type="string">
  Name of the account holder.
</ResponseField>

<ResponseField name="masked_account_number" type="string">
  Masked account number of the customer.
</ResponseField>

<ResponseField name="ifsc" type="string">
  IFSC of the bank.
</ResponseField>

<ResponseField name="upi_iin" type="string">
  UPI Issuer Identification Numbers (iin) of the payment source provider issued by NPCI.
</ResponseField>

<ResponseField name="upi_pin_set" type="boolean">
  Indicates whether the UPI PIN is set. Possible values:

  * `true`: UPI PIN is set.
  * `false`: UPI PIN is not set.
</ResponseField>

<ResponseField name="upi_pin_length" type="integer">
  Length of the UPI PIN.
</ResponseField>

<ResponseField name="otp_length" type="integer">
  Length of the OTP.
</ResponseField>

<ResponseField name="atm_pin_length" type="integer">
  Length of the ATM PIN.
</ResponseField>

<ResponseField name="fundsource_provider" type="object">
  Payment source provider details. Here, if the payment source is a bank, payment source providers will be bank information.
</ResponseField>

<ResponseField name="name" type="string">
  Name of the payment source.
</ResponseField>

<ResponseField name="upi_iin" type="string">
  UPI Issuer Identification Numbers (upi\_iin) of the payment source provider issued by NPCI.
</ResponseField>

<ResponseField name="upi_enabled" type="boolean">
  Indicates whether the provider has UPI enabled. Possible values:

  * `true`: UPI is enabled.
  * `false`: UPI is not enabled.
</ResponseField>

<ResponseField name="mobile_registration_format" type="string">
  Indicates the format as defined by NPCI - `format1`, `format2` and so on.
</ResponseField>

<ResponseField name="logo_url" type="string">
  The URL of the bank logo.
</ResponseField>

<ResponseField name="vpas" type="array">
  Details of the VPAs linked to the payment source.
</ResponseField>

<ResponseField name="entity" type="string">
  The entity type name. Here, it is `collection`.
</ResponseField>

<ResponseField name="count" type="integer">
  Indicates the number of items in the entity type.
</ResponseField>

<ResponseField name="items" type="object">
  VPA details.
</ResponseField>

<ResponseField name="mobile" type="string">
  The mobile number of the VPA linked to the payment source.
</ResponseField>

<ResponseField name="address" type="string">
  The address of the VPA linked to the payment source.
</ResponseField>

<ResponseField name="status" type="string">
  The status of the VPA linked to the payment source.
</ResponseField>

<ResponseField name="primary" type="boolean">
  Indicates if the VPA linked to the payment source marked as primary.

  * `true`: VPA is linked to the payment source.
  * `false`: VPA is not linked to the payment source.
</ResponseField>

<ResponseField name="upi_transaction_id" type="string">
  Transaction ID of the outgoing request to gateway.
</ResponseField>
