> ## 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.

# Fetch Card Details of a Payment

> Fetch Card Details of a Payment using Razorpay Payments 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>
  <span>🇸🇬 Singapore</span>
  <span>🇺🇸 United States</span>
</div>

Use this endpoint to retrieve the details of the card used to make a payment.

<RequestExample>
  ```bash Curl theme={null}
  curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]
  -X GET https://api.razorpay.com/v1/payments/pay_DtFYPi3IfUTgsL/card
  ```

  ```java Java theme={null}
  RazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  String paymentId = "pay_DtFYPi3IfUTgsL";

  Card card = razorpay.cards.fetchCardDetails(paymentId);
  ```

  ```python Python theme={null}
  import razorpay
  client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))

  client.payment.fetchCardDetails(paymentId)
  ```

  ```go Go theme={null}
  import ( razorpay "github.com/razorpay/razorpay-go" )
  client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")

  paymentId := "pay_CBYy6tLmJTzn3Q"

  body, err := client.Payment.FetchCardDetails(paymentId, nil)
  ```

  ```php PHP theme={null}
  $api = new Api($key_id, $secret);

  $api->payment->fetch($paymentId)->fetchCardDetails();
  ```

  ```ruby Ruby theme={null}
  require "razorpay"
  Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET')

  Razorpay::Payment.fetch_card_details(paymentId)
  ```

  ```javascript Node.js theme={null}
  var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })

  instance.payments.fetchCardDetails(paymentId)
  ```

  ```csharp .NET theme={null}
  RazorpayClient client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  string paymentId = "pay_Z6t7VFTb9xHeOs";

  Card card = client.Card.FetchCardDetails(paymentId);
  ```

  ```bash CLI theme={null}
  razorpay payments card pay_ABC123
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "id": "card_JXPULjlKqC5j0i",
    "entity": "card",
    "name": "Gaurav Kumar",
    "last4": "4366",
    "network": "Visa",
    "type": "credit",
    "issuer": "UTIB",
    "international": false,
    "emi": false,
    "sub_type": "consumer",
    "token_iin": null
  }
  ```

  ```json Failure theme={null}
  {
      "error": {
          "code": "BAD_REQUEST_ERROR",
          "description": "Payment was not done using card",
          "source": "NA",
          "step": "NA",
          "reason": "NA",
          "metadata": {}
      }
  }
  ```
</ResponseExample>

## Path Parameters

<ParamField path="id" type="string" required>
  Unique identifier of the payment for which you want to retrieve card details.
</ParamField>

## Response Parameters

<ResponseField name="card" type="object">
  Details of the card used to make the payment.
</ResponseField>

<ResponseField name="id" type="string">
  The unique identifier of the card used by the customer to make the payment.
</ResponseField>

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

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

<ResponseField name="last4" type="integer">
  The last 4 digits of the card number.
</ResponseField>

<ResponseField name="network" type="string">
  The card network. Possible values:

  * `American Express`
  * `Diners Club` (Only available for private limited and registered businesses)
  * `Maestro`
  * `MasterCard`
  * `RuPay`
  * `Unknown`
  * `Visa`
</ResponseField>

<ResponseField name="type" type="string">
  The card type. Possible values:

  * `credit`
  * `debit`
  * `prepaid`
  * `unknown`
</ResponseField>

<ResponseField name="issuer" type="string">
  The card issuer. The 4-character code denotes the issuing bank. This attribute will not be set for the card issued by a foreign bank.
</ResponseField>

<ResponseField name="emi" type="boolean">
  Indicates whether the card can be used for EMI payment method. Possible values:

  * `true`: Card can be used for EMI payments.
  * `false`: Card cannot be used for EMI payments.
</ResponseField>

<ResponseField name="sub_type" type="string">
  The sub-type of the customer's card. Possible values:

  * `customer`
  * `business`<br />

  Know how to accept payments made by customers using [corporate cards](/docs/sg/payments/payment-methods/cards/corporate-cards).
</ResponseField>

## Errors

<AccordionGroup>
  <Accordion title="The API {key/secret} provided is invalid.">
    **Code:** `4xx`

    The API credentials passed in the API call differ from the ones generated on the Dashboard.

    **Solution:** The API keys must be active and entered correctly with no whitespace before or after.
  </Accordion>

  <Accordion title="The id provided does not exist.">
    **Code:** `400`

    The `payment_id` provided is incorrect.

    **Solution:** Enter the correct `payment_id`.
  </Accordion>

  <Accordion title="Payment was not done using card.">
    **Code:** `400`

    The payment for the `payment_id` entered was not completed using a card.

    **Solution:** Use a `payment_id` which was completed using a card.
  </Accordion>
</AccordionGroup>
