---
displayed_sidebar: jsClientSidebar
slug: /references/js-client/PaymentMethodsResource
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# PaymentMethodsResource

This class is used to send requests to Payment Method API Routes part of the [Store Customer API Routes](https://docs.medusajs.com/api/store#customers\_postcustomers). All its method
are available in the JS Client under the `medusa.customers.paymentMethods` property.

All methods in this class require [customer authentication](js_client.AuthResource.mdx#authenticate).

## Methods

### list

Retrieve the logged-in customer's saved payment methods. This method only works with payment providers created with the deprecated Payment Service interface.
The payment methods are saved using the Payment Service's third-party service, and not on the Medusa backend. So, they're retrieved from the third-party service.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged
medusa.customers.paymentMethods.list()
.then(({ payment_methods }) => {
  console.log(payment_methods.length);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;StoreCustomersListPaymentMethodsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the customer's payment methods.",
    "expandable": false,
    "children": [
      {
        "name": "payment_methods",
        "type": "`object`[]",
        "description": "The details of the saved payment methods.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "data",
            "type": "`object`",
            "description": "The data needed for the Payment Provider to use the saved payment method.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "provider_id",
            "type": "`string`",
            "description": "The ID of the Payment Provider where the payment method is saved.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />
