> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://useroot.docs.buildwithfern.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://useroot.docs.buildwithfern.com/_mcp/server.

# Set default payment method

POST https://api.useroot.com/api/payees/{payee_id}/payment-methods/{payment_method_id}/set-default

Sets a payment method as the default for a payee. Only verified payment methods can be set as default.

**Path Parameters**

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `payee_id` | UUID | Yes | ID of the payee |
| `payment_method_id` | UUID | Yes | ID of the payment method to set as default |


**Success Responses**

| Status Code | Description |
|-------------|-------------|
| 200 | OK - The payment method was successfully set as default |

**Error Responses**

| Status Code | Error Code | Description |
|-------------|------------|-------------|
| 401 | AUTHENTICATION_ERROR | Authentication credentials are invalid or missing |
| 403 | AUTHORIZATION_ERROR | You do not have permission to perform this action |
| 404 | NOT_FOUND | The specified payment method or payee was not found |
| 422 | INVALID_OPERATION | The payment method cannot be set as default (e.g., not verified) |

Reference: https://useroot.docs.buildwithfern.com/api-reference/payment-methods-api/payee-payment-methods-api/set-payee-default-payment-method

## Authentication

- `x-api-key` header (required) — RootPay API key sent in the x-api-key header. Keys are environment-scoped: live_* for production, test_* for sandbox.

## Request

### Path parameters

- `payee_id` (string, required)
- `payment_method_id` (string, required)

## Response

### 200

Payment method set as default successfully

- `data` (object or object, required)
  - BankPaymentMethodResponse
    - `created_at` (datetime, required)
    - `updated_at` (datetime, required)
    - `id` (string, required)
    - `account_last_four` (string, required)
    - `routing_number` (string, required)
    - `currency_code` (enum, required)
      - Allowed values: `USD`, `GBP`, `INR`
    - `country_code` (enum, required)
      - Allowed values: `US`, `GB`, `IN`
    - `verification_status` (enum, required)
      - Allowed values: `verified`, `pending`, `failed`
    - `is_default` (boolean, required)
    - `supported_rails` (list of enum, required)
      - Allowed values: `instant_card`, `instant_bank`, `same_day_ach`, `standard_ach`, `wire`, `{'instant_card', 'instant_bank'}`, `{'standard_ach', 'same_day_ach'}`, `{'standard_ach', 'wire'}`
    - `payee_id` (string, optional, nullable)
    - `payer_id` (string, optional, nullable)
    - `warning` (string, optional, nullable)
  - PushToCardPaymentMethodResponse
    - `created_at` (datetime, required)
    - `updated_at` (datetime, required)
    - `id` (string, required)
    - `payee_id` (string, required)
    - `card_last_four` (string, required)
    - `card_expiry_date` (string, required)
    - `currency_code` (enum, required)
      - Allowed values: `USD`, `GBP`, `INR`
    - `country_code` (enum, required)
      - Allowed values: `US`, `GB`, `IN`
    - `is_default` (boolean, required)
    - `supported_rails` (list of enum, required)
      - Allowed values: `instant_card`, `instant_bank`, `same_day_ach`, `standard_ach`, `wire`, `{'instant_card', 'instant_bank'}`, `{'standard_ach', 'same_day_ach'}`, `{'standard_ach', 'wire'}`
    - `verification_status` (enum, required)
      - Allowed values: `verified`, `pending`, `failed`
    - `warning` (string, optional, nullable)
- `warning` (string, optional, nullable)

## Examples

### Bank account example

**Response**

```json
{
  "data": {
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z",
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "payee_id": "987e6543-c21b-43a5-a987-654321098765",
    "account_last_four": "7890",
    "routing_number": "021000021",
    "currency_code": "USD",
    "country_code": "US",
    "verification_status": "verified",
    "is_default": true,
    "supported_rails": [
      "instant_bank",
      "same_day_ach",
      "standard_ach",
      "wire"
    ]
  }
}
```

**SDK Code**

```python Bank account example
import requests

url = "https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default"

headers = {"x-api-key": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Bank account example
const url = 'https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Bank account example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Bank account example
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Bank account example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Bank account example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Bank account example
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Bank account example
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Card example

**Response**

```json
{
  "data": {
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z",
    "id": "123e4567-e89b-12d3-a456-426614174001",
    "payee_id": "987e6543-c21b-43a5-a987-654321098765",
    "card_last_four": "1111",
    "card_expiry_date": "2512",
    "currency_code": "USD",
    "country_code": "US",
    "is_default": true,
    "supported_rails": [
      "instant_card"
    ],
    "verification_status": "verified"
  }
}
```

**SDK Code**

```python Card example
import requests

url = "https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default"

headers = {"x-api-key": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Card example
const url = 'https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Card example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Card example
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Card example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Card example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Card example
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Card example
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payees/payee_id/payment-methods/payment_method_id/set-default")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```