> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cariqa.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Payment Methods

> Usage patterns for Stripe payment method management

## Payment Method Setup Flow

Payment methods must be added using [Stripe SDK and native UI elements](/payments-frontend-setup) for PSD2/SCA compliance.

### 1. Fetch Setup Intent

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/setup-intents/?pm_type=card" \
    -H "Authorization: Bearer YOUR_API_TOKEN" \
    -H "Content-Type: application/json"
  ```

  ```python Python theme={null}
  import requests

  headers = {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  }

  response = requests.get(
      "https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/setup-intents/?pm_type=card",
      headers=headers
  )
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/setup-intents/?pm_type=card', {
    headers: {
      'Authorization': 'Bearer YOUR_API_TOKEN',
      'Content-Type': 'application/json'
    }
  });
  ```
</CodeGroup>

Response:

```json theme={null}
{
  "client_secret": "seti_1THkgXHtgZxQ1KXxOhLbYQKU_secret_UGHFCX0iihdboXkwx4QfiR9V2ma55vk"
}
```

### 2. Frontend Integration

Initialize Stripe on the client using:

* Stripe SDK with publishable key from onboarding
* Native Stripe UI elements (required)
* Complete payment method creation client-side

### 3. Confirm Setup with Stripe

Use the `client_secret` to complete payment method attachment through Stripe SDK.

## Payment Method Management

### List User Payment Methods

Common use cases:

* Show saved cards in settings page
* Let user choose default payment method
* Allow payment method removal

Response includes various payment types: `card`, `google_pay`, `apple_pay`

### List Payment Methods

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/payment-methods/" \
    -H "Authorization: Bearer YOUR_API_TOKEN" \
    -H "Content-Type: application/json"
  ```

  ```python Python theme={null}
  import requests

  headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

  response = requests.get(
      "https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/payment-methods/",
      headers=headers
  )
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/payment-methods/', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_TOKEN'
    }
  });
  ```
</CodeGroup>

Response:

```json theme={null}
{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": "pm_1TD1M3HtgZxQ1KXx5wMzfx15",
      "default": false,
      "type": "apple_pay",
      "card": {
        "brand": "visa",
        "last4": "4242",
        "expiration_date": "12/2027",
        "cardholder_name": "John Doe"
      },
      "created_at": "2026-03-20T11:36:39Z"
    },
    {
      "id": "pm_1TD1LuHtgZxQ1KXxNj5sKkKM",
      "default": true,
      "type": "card",
      "card": {
        "brand": "visa",
        "last4": "4242",
        "expiration_date": "04/2044",
        "cardholder_name": null
      },
      "created_at": "2026-03-20T11:36:30Z"
    }
  ]
}
```

### Set Default Payment Method

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/payment-methods/pm_abc123/default/" \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```

  ```python Python theme={null}
  import requests

  headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

  response = requests.post(
      "https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/payment-methods/pm_abc123/default/",
      headers=headers
  )
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/payment-methods/pm_abc123/default/', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_TOKEN'
    }
  });
  ```
</CodeGroup>

### Remove Payment Method

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/payment-methods/pm_abc123/" \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```

  ```python Python theme={null}
  import requests

  headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

  response = requests.delete(
      "https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/payment-methods/pm_abc123/",
      headers=headers
  )
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://connect.cariqa.com/api/v1/users/9405cf8c-8375-4373-b4d3-b61f9a0c01eb/payment-methods/pm_abc123/', {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer YOUR_API_TOKEN'
    }
  });
  ```
</CodeGroup>

## Removal Restrictions

Payment method removal may fail if:

* Charging session is in progress
* Payment method is attached to active session
* Payment method is set as default
* Active charging session present
* CDR processing incomplete
* User debt exists (402 Payment Required)
