# Retrieve a payment source

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


Retrieves the payment source identified by the unique identifier.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/payment_sources/pm___test__KyVmmpTSneqVht \
     -u {site_api_key}:
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = PaymentSource.Retrieve("pm___test__KyVmmpTSneqVht").Request();

PaymentSource paymentSource = result.PaymentSource;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    paymentsourceAction "github.com/chargebee/chargebee-go/v3/actions/paymentsource"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := paymentsourceAction.Retrieve("pm___test__KyVmmpTSneqVht").Request()
    if err != nil {
        fmt.Println(err)
    } else {
        PaymentSource := res.PaymentSource
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  
  res, err := client.PaymentSource.Retrieve("pm___test__KyVmmpTSneqVht")
      if err != nil {
        fmt.Println(err)
    } else {
        PaymentSource := res.PaymentSource
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = PaymentSource.retrieve("pm___test__KyVmmpTSneqVht").request();

        PaymentSource paymentSource = result.paymentSource();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.paymentSource.PaymentSource;
import com.chargebee.v4.models.paymentSource.params.PaymentSourceRetrieveParams;
import com.chargebee.v4.models.paymentSource.responses.PaymentSourceRetrieveResponse;

public class PaymentSourceRetrieve {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        PaymentSourceRetrieveResponse response = client.paymentSources().retrieve("pm___test__KyVmmpTSneqVht");

        PaymentSource paymentSource = response.getPaymentSource();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.paymentSource.retrieve("pm___test__KyVmmpTSneqVht");

    console.log(result);
    const paymentSource = result.payment_source;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->paymentSource()->retrieve("pm___test__KyVmmpTSneqVht");
$paymentSource = $result->payment_source;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.PaymentSource.retrieve("pm___test__KyVmmpTSneqVht")
payment_source = response.payment_source
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::PaymentSource.retrieve("pm___test__KyVmmpTSneqVht")

payment_source = result.payment_source
```

## Sample Response

```json
{
  "payment_source": {
    "card": {
      "brand": "visa",
      "expiry_month": 12,
      "expiry_year": 2030,
      "funding_type": "credit",
      "iin": "411111",
      "last4": "1111",
      "masked_number": "************1111",
      "object": "card"
    },
    "created_at": 1517467526,
    "customer_id": "__test__KyVmmpTSneqFXs",
    "deleted": false,
    "gateway": "stripe",
    "gateway_account_id": "gw___test__KyVmsTTSnefon30",
    "id": "pm___test__KyVmmpTSneqVht",
    "issuing_country": "US",
    "object": "payment_source",
    "reference_id": "cus_NA13opXonQckcW/card_0MPh10J7ubj1SVcrJTe4m32g",
    "resource_version": 1517467526693,
    "status": "valid",
    "type": "card",
    "updated_at": 1517467526
  }
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/payment_sources/{cust-payment-source-id}

## Returns

- `payment_source` (Payment source object)
  Resource object representing payment\_source
