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

# client.deletePaymentMethod()

> Delete a stored payment method for the connected customer.

Use this method to remove a stored payment method — for example, when a customer asks to forget a card, or after a one-off purchase where you don't want to retain card details. For request and response details, see the [Delete payment method API](/api-reference/platform/endpoints/payment-methods/delete).

To obtain a `paymentMethodId`, list the customer's stored payment methods with [`client.getPaymentMethods()`](/platform/sdk-reference/web/get-payment-methods).

```ts Delete a payment method focus={5-15} theme={null}
import { createClient } from "@moonpay/platform-sdk-web";

const client = createClient({ sessionToken: "c3N0XzAwMQ==" });

// Call this after the client has an active connection.
const paymentMethodId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";

const result = await client.deletePaymentMethod(paymentMethodId);

if (!result.ok) {
  // Handle error
  console.error(result.error.code, result.error.message);
  return;
}

// On success, `result.value` is `undefined`.
```

***

## Parameters

| Parameter         | Type     | Required | Description                                                                                                                                                      |
| ----------------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `paymentMethodId` | `string` | ✅        | The `id` of the stored card to delete. Obtain this from [`client.getPaymentMethods()`](/platform/sdk-reference/web/get-payment-methods#storedcardpaymentmethod). |

## Result

`client.deletePaymentMethod()` returns a `Result<void, DevPlatformApiError>`.

The API responds with `204 No Content` on success, so `result.value` is `undefined` — there is no response body to read. Check `result.ok` to confirm the delete succeeded.

### Result envelope

`Result<void, DevPlatformApiError>`

| Field   | Type                                          | Required | Description                                                         |
| ------- | --------------------------------------------- | -------- | ------------------------------------------------------------------- |
| `ok`    | `boolean`                                     | ✅        | Whether the operation succeeded.                                    |
| `value` | `undefined`                                   |          | Present when `ok` is `true`. Always `undefined` (no response body). |
| `error` | [`DevPlatformApiError`](#devplatformapierror) |          | Present when `ok` is `false`.                                       |

### `DevPlatformApiError`

The standard MoonPay Platform API error shape.

| Field     | Type                          | Required | Description                                                                                                                                                                     |
| --------- | ----------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `code`    | `DevPlatformApiErrorCode`     | ✅        | A machine-readable error code (for example, `"not_found"`, `"unauthorized"`). See the [error reference](/api-reference/platform/documentation/using-the-api) for the full list. |
| `message` | `string`                      | ✅        | A developer-friendly message.                                                                                                                                                   |
| `errors`  | `DevPlatformApiErrorDetail[]` |          | Optional list of field-level errors.                                                                                                                                            |

<Accordion title="TS Definition">
  ```ts types.ts theme={null}
  type DevPlatformApiError = {
    code: DevPlatformApiErrorCode;
    message: string;
    errors?: DevPlatformApiErrorDetail[];
  };

  type DevPlatformApiErrorDetail = {
    field?: string;
    message: string;
  };
  ```
</Accordion>
