Skip to main content
Skip to main content

PaymentMethodsResource

This class is used to send requests to Payment Method API Routes part of the Store Customer API Routes. All its method are available in the JS Client under the medusa.customers.paymentMethods property.

All methods in this class require customer authentication.

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

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

customHeadersRecord<string, any>Required
Custom headers to attach to the request.

Default: {}

Returns

ResponsePromiseResponsePromise<StoreCustomersListPaymentMethodsRes>Required
Resolves to the customer's payment methods.
Was this section helpful?