Skip to main content
GET
/
api
/
v2
/
storefront
/
account
/
credit_cards
List all Credit Cards
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://demo.spreecommerce.org/api/v2/storefront/account/credit_cards', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "data": [
    {
      "id": "1",
      "type": "credit_card",
      "attributes": {
        "cc_type": "visa",
        "last_digits": "1111",
        "month": 12,
        "year": 2026,
        "name": "John Doe",
        "gateway_payment_profile_id": "card_1JqvNB2eZvKYlo2C5OlqLV7S",
        "default": true
      },
      "relationships": {
        "payment_method": {
          "data": {
            "id": "string",
            "type": "string"
          }
        }
      }
    },
    {
      "id": "2",
      "type": "credit_card",
      "attributes": {
        "cc_type": "mastercard",
        "last_digits": "6695",
        "month": 12,
        "year": 2030,
        "name": "John Doe",
        "default": false
      },
      "relationships": {
        "payment_method": {
          "data": {
            "id": "string",
            "type": "string"
          }
        }
      }
    }
  ],
  "included": [
    {
      "id": "1",
      "type": "payment_method",
      "attributes": {
        "type": "Spree::Gateway::StripeGateway",
        "name": "Stripe",
        "description": "Stripe Payments",
        "preferences": {}
      }
    }
  ],
  "meta": {
    "count": 2,
    "total_count": 2,
    "total_pages": 1
  },
  "links": {
    "self": "http://localhost:3000/api/v2/storefront/account/credit_cards",
    "next": "http://localhost:3000/api/v2/storefront/account/credit_cards?page=0",
    "prev": "http://localhost:3000/api/v2/storefront/account/credit_cards?page=1",
    "last": "http://localhost:3000/api/v2/storefront/account/credit_cards?page=0",
    "first": "http://localhost:3000/api/v2/storefront/account/credit_cards?page=1"
  }
}

Documentation Index

Fetch the complete documentation index at: https://spreecommerce.org/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

User token to authorize Cart and Checkout requests.

It is required to associate Cart with the User.

Query Parameters

filter[payment_method_id]
string

Filter based on payment method ID

include
string

Specify the related resources you would like to receive in the response body. More Information.

fields[credit_card]
string

Specify the fields you would like returned in the response body. More information.

Response

200 Success - Returns an array of credit_card objects.

data
Credit Card · object[]
required
meta
Pagination Meta · object
required
included
Credit Card Includes · object[]