Retrieves all payment methods associated with a customer directly from Shopify’s payment API. This endpoint returns detailed information about stored payment instruments including credit/debit cards, digital wallets, and other payment methods that the customer can use for subscription billing.
What This Endpoint Does: Queries Shopify’s GraphQL API to fetch the customer’s payment methods, including active instruments and optionally revoked (expired, removed, or failed) payment methods. This provides real-time payment method data directly from Shopify’s payment vault.
Payment Method Types Supported:
Credit/Debit Cards:
Digital Wallets:
Alternative Payment Methods:
Payment Method Information Returned:
For Each Payment Method:
Query Parameters:
allowRevokedMethod (optional, default: false):
false: Returns only active, usable payment methodstrue: Returns both active AND revoked payment methodsRevoked Payment Methods: Include expired cards, deleted payment methods, failed instruments, and customer-removed methods. Useful for historical records and troubleshooting, but cannot be used for new billing attempts.
Use Cases:
1. Customer Portal:
2. Subscription Management:
3. Payment Method Updates:
4. Troubleshooting & Support:
5. Analytics & Alerts:
Response Structure:
Returns CustomerPaymentMethodsQuery.PaymentMethods object from Shopify GraphQL:
{
"nodes": [
{
"id": "gid://shopify/CustomerPaymentMethod/abc123",
"instrument": {
"__typename": "CustomerCreditCard",
"brand": "VISA",
"lastDigits": "4242",
"expiryMonth": 12,
"expiryYear": 2025,
"name": "John Doe"
},
"revokedAt": null,
"revokedReason": null,
"subscriptionContracts": [...]
}
]
}
Common Scenarios:
Scenario 1: Customer with multiple cards Returns array with multiple payment method objects, each representing a stored card.
Scenario 2: Customer with no payment methods Returns empty nodes array - customer needs to add payment method.
Scenario 3: Expired card included (allowRevokedMethod=true) Returns both active cards and expired/revoked cards with revokedAt timestamp.
Important Considerations:
Data Source:
Performance:
Security:
Privacy:
Best Practices:
allowRevokedMethod=false for payment selection UIsIntegration Examples:
Example 1: Display payment methods in customer portal
const paymentMethods = await fetch(
`/api/external/v2/subscription-contract-details/shopify/customer/${customerId}/payment-methods`,
{ headers: { 'X-API-Key': 'your-key' } }
).then(r => r.json());
paymentMethods.nodes.forEach(pm => {
if (pm.instrument.__typename === 'CustomerCreditCard') {
console.log(`${pm.instrument.brand} ending in ${pm.instrument.lastDigits}`);
if (pm.instrument.expiryYear < currentYear) {
console.warn('Card expired!');
}
}
});
Example 2: Check for valid payment before creating subscription
const paymentMethods = await fetch(...);
const hasValidPayment = paymentMethods.nodes.some(pm =>
!pm.revokedAt && pm.instrument.expiryYear >= currentYear
);
if (!hasValidPayment) {
alert('Please add a valid payment method before subscribing');
}
Related Endpoints:
PUT /api/external/v2/subscription-contracts-update-payment-method - Update subscription payment methodPOST /api/external/v2/associate-shopify-customer-to-external-payment-gateways - Add external payment methodAuthentication: Requires valid X-API-Key header
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contract-details/shopify/customer/{customerId}/payment-methods{
"nodes": [
{
"id": "gid://shopify/CustomerPaymentMethod/abc123",
"instrument": {
"__typename": "CustomerCreditCard",
"brand": "VISA",
"lastDigits": "4242",
"expiryMonth": 12,
"expiryYear": 2025,
"name": "John Doe",
"source": "SHOPIFY"
},
"revokedAt": null,
"revokedReason": null
},
{
"id": "gid://shopify/CustomerPaymentMethod/def456",
"instrument": {
"__typename": "CustomerShopPayAgreement",
"lastDigits": "1234",
"name": "Shop Pay"
},
"revokedAt": null,
"revokedReason": null
}
]
}Documentation Index
Fetch the complete documentation index at: https://appstleinc-aeca3e0a.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Customer Id
Get revoked payment methods?
curl --request GET \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contract-details/shopify/customer/{customerId}/payment-methods{
"nodes": [
{
"id": "gid://shopify/CustomerPaymentMethod/abc123",
"instrument": {
"__typename": "CustomerCreditCard",
"brand": "VISA",
"lastDigits": "4242",
"expiryMonth": 12,
"expiryYear": 2025,
"name": "John Doe",
"source": "SHOPIFY"
},
"revokedAt": null,
"revokedReason": null
},
{
"id": "gid://shopify/CustomerPaymentMethod/def456",
"instrument": {
"__typename": "CustomerShopPayAgreement",
"lastDigits": "1234",
"name": "Shop Pay"
},
"revokedAt": null,
"revokedReason": null
}
]
}