{"title":"Accounts Payment Methods Controller - Liquid Controller Reference","slug":"accounts-payment-methods-controller-reference","url":"https://support.storeconnect.com/articles/accounts-payment-methods-controller-reference","url_markdown":"https://support.storeconnect.com/articles/accounts-payment-methods-controller-reference.md","subtitle":null,"summary":"Hook the saved payment method actions on the customer account (list, add, remove, rename, set default) with Liquid controller templates at controllers/accounts/payment_methods/.","type":"Developer_Documentation","video_url":"","keywords":"liquid, controllers, accounts payment methods, saved cards, saved payment methods, storefront, storeconnect","last_modified":"2026-11-25T21:09:53+0000","body_markdown":"## Description\n\nThe Accounts Payment Methods controller serves the signed-in customer's [saved payment methods](saved-payment-methods). A customer must be signed in.\n\n| Property | Value |\n|----------|-------|\n| **Controller** | `Accounts::PaymentMethodsController` |\n| **Liquid Template Path** | `controllers/accounts/payment_methods/` |\n| **Namespace** | Accounts |\n\n## Actions\n\n| Action | HTTP Method | Route | Result |\n|--------|-------------|-------|--------|\n| `index` | GET | `/account/payment_methods` | Renders the `account` page |\n| `new` | GET | `/account/payment_methods/new` | Renders the `account` page |\n| `create` | POST | `/account/payment_methods` | Saves the method with the payment provider and responds with JSON |\n| `update` | PATCH, PUT | `/account/payment_methods/:id` | Updates the nickname or makes it the default, then redirects back |\n| `destroy` | DELETE | `/account/payment_methods/:id` | Removes the saved method, then redirects back |\n\nOn 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.\n\n`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.\n\n## Example\n\nCreate a theme template with the key `controllers/accounts/payment_methods/index` to send a customer with no saved methods straight to the add form:\n\n\n```liquid\n\n{% before %}\n  {% if current_customer.payment_methods.size == 0 %}\n    {% assign new_method_path = current_request.store_path | append: \"/account/payment_methods/new\" %}\n    {% redirect to: new_method_path %}\n  {% endif %}\n{% endbefore %}\n```\n\n\nSee [how Liquid controllers work](liquid-controllers-guide) for the phases and the tags you can use in them."}