> Index of every page: https://docs.merchantservicedepot.com/llms.txt

# Set default card


`POST /v1/payment_methods/{payment_method_id}/default`

The card charged when a request names none, including a scheduled invoice.

Auth: a secret key with the `paymentMethods.setDefault` permission. Returns `200` with Payment method.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `paymentMethodId` | path | string | Yes | The reusable identifier of a stored payment method. |

## Request

**curl**

```curl
curl -X POST "https://payments-api-sandbox.merchantservicedepot.com/v1/payment_methods/{payment_method_id}/default" \
  -H "Authorization: Bearer $MYELA_API_KEY"
```

**Node**

```node
const res = await fetch("https://payments-api-sandbox.merchantservicedepot.com/v1/payment_methods/{payment_method_id}/default", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MYELA_API_KEY}`,
  },
});

if (!res.ok) {
  const { error } = await res.json();
  // Branch on error.code — never on error.message.
  throw new Error(error.code);
}
const data = await res.json();
```

**Python**

```python
import os
import requests

res = requests.post(
    "https://payments-api-sandbox.merchantservicedepot.com/v1/payment_methods/{payment_method_id}/default",
    headers={
        "Authorization": f"Bearer {os.environ['MYELA_API_KEY']}",
    },
)

if not res.ok:
    # Branch on error["code"] — never on error["message"].
    raise RuntimeError(res.json()["error"]["code"])
data = res.json()
```

## Response

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Unique payment-method identifier. |
| `object` | "payment_method" | Stable resource discriminator. |
| `customerId` | string | Customer that owns this method. |
| `brand` | string | Card brand. |
| `last4` | string | Last four digits only. |
| `expMonth` | integer | Expiration month. |
| `expYear` | integer | Four-digit expiration year. |
| `isDefault` | boolean | Whether this is the customer default. |
| `createdAt` | string | ISO 8601 creation timestamp. |

```json
{
  "id": "pm_01JEXAMPLE",
  "object": "payment_method",
  "customerId": "cus_01JEXAMPLE",
  "brand": "visa",
  "last4": "4242",
  "expMonth": 12,
  "expYear": 2030,
  "isDefault": true,
  "createdAt": "2026-08-10T20:49:51.653Z"
}
```

Source: https://docs.merchantservicedepot.com/api-reference/set-default-card/
