---
title: "Accounts Payment Methods Controller - Liquid Controller Reference"
source: https://support.storeconnect.com/articles/accounts-payment-methods-controller-reference
type: article
format: markdown
site: StoreConnect Support — product and developer documentation for StoreConnect
site_index: https://storeconnect.com/llms.txt
docs_index: https://support.storeconnect.com/llms.txt
note: Append .md to any page or article URL on this site to get its Markdown form.
---
# Accounts Payment Methods Controller - Liquid Controller Reference

## Description

The Accounts Payment Methods controller serves the signed-in customer's [saved payment methods](saved-payment-methods). A customer must be signed in.

| Property | Value |
|----------|-------|
| **Controller** | `Accounts::PaymentMethodsController` |
| **Liquid Template Path** | `controllers/accounts/payment_methods/` |
| **Namespace** | Accounts |

## Actions

| Action | HTTP Method | Route | Result |
|--------|-------------|-------|--------|
| `index` | GET | `/account/payment_methods` | Renders the `account` page |
| `new` | GET | `/account/payment_methods/new` | Renders the `account` page |
| `create` | POST | `/account/payment_methods` | Saves the method with the payment provider and responds with JSON |
| `update` | PATCH, PUT | `/account/payment_methods/:id` | Updates the nickname or makes it the default, then redirects back |
| `destroy` | DELETE | `/account/payment_methods/:id` | Removes the saved method, then redirects back |

On the pages it renders, `current_request.params.section` is `payment_methods`, or `payment_methods_new` on `new`. Use it in the `account` page template to show the right section.

`create` makes the new method the default when `is_default` is `true`, or when it is the customer's only saved method for the store. It responds with `{"redirect_url": "/account/payment_methods"}` on success, and with an `error_message` and status `422` on failure.

## Example

Create a theme template with the key `controllers/accounts/payment_methods/index` to send a customer with no saved methods straight to the add form:


```liquid

{% before %}
  {% if current_customer.payment_methods.size == 0 %}
    {% assign new_method_path = current_request.store_path | append: "/account/payment_methods/new" %}
    {% redirect to: new_method_path %}
  {% endif %}
{% endbefore %}
```


See [how Liquid controllers work](liquid-controllers-guide) for the phases and the tags you can use in them.

---

## Follow StoreConnect

- [Email Newsletter](https://storeconnect.com/c/lp-newsletter)
- [LinkedIn Newsletter](https://www.linkedin.com/build-relation/newsletter-follow?entityUrn=7444956928444862464)
- [YouTube](https://www.youtube.com/channel/UCngKdP2x8l1wcbAKW3tvU8g)
- [LinkedIn](https://www.linkedin.com/company/storeconnect)
- [X / Twitter](https://x.com/storeconnecthq)

## Popular Links

- [Partners](https://storeconnect.com/partners)
- [Become a Partner](https://storeconnect.com/become-a-partner)
- [News](https://storeconnect.com/articles/news)
- [Events](https://storeconnect.com/articles/events)
- [Feature Comparison](https://storeconnect.com/how-we-compare)
- [Download a free trial](https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FMkeKUAT)
- [Book a Demo](https://storeconnect.com/contact)

## Documentation

- [Help documentation](https://support.storeconnect.com/help-documentation)
- [AI agents](https://support.storeconnect.com/ai)
- [Videos & tutorials](https://support.storeconnect.com/videos-tutorials)
- [Developer reference](https://support.storeconnect.com/developer-reference)
- [Release notes](https://support.storeconnect.com/release-notes)
- [Troubleshooting](https://support.storeconnect.com/troubleshooting)
- [Trust Center](https://trust.getstoreconnect.com/)
- [Status Page](https://status.storeconnect.com/)

## Contact

- info@getstoreconnect.com
- US +1 415 745 3230
- AUS +61 2 8365 2308

100 S Ashley Dr, Suite 600-2461
Tampa FL 33602-600 USA

Level 22, Sydney Place
180 George Street
Sydney, NSW, 2000, AUS

## Machine-readable

- [Site index for agents](https://storeconnect.com/llms.txt): curated map of the StoreConnect site in llms.txt format
- [Documentation index for agents](https://support.storeconnect.com/llms.txt): full technical and product documentation map

Every page and article on this site has a Markdown rendering: append `.md` to its URL.

Continue in Markdown: [Help documentation](https://support.storeconnect.com/help-documentation.md) · [Developer reference](https://support.storeconnect.com/developer-reference.md) · [Videos & tutorials](https://support.storeconnect.com/videos-tutorials.md) · [Release notes](https://support.storeconnect.com/release-notes.md)

---

StoreConnect Support — https://support.storeconnect.com/articles/accounts-payment-methods-controller-reference