Read stored payment data and reconcile Stripe records
Display stored card summaries or payment sources for a reader. These reads use Wallkit’s saved records. Stripe sync reads the provider and changes local records, with the wider effects described below.
| Task | Operation | Allowed credentials |
|---|---|---|
| Page through stored card summaries | GET /api/v1/admin/users/{user_id}/cards | readonly, manager, support, admin or partner, or root |
| Read combined stored payment sources | GET /api/v1/admin/users/{user_id}/payment-sources | admin or partner, or root |
| Reconcile Stripe data into local payment records | PUT /api/v1/admin/users/{user_id}/sync-payment-provider/stripe | admin or partner, or root |
Existing context and examples
Use the API address, token and publication public key supplied by your operator. Send the key in resource. Allowed roles appear in the task table. Service accounts cannot use these routes, including those with full_access. Keep privileged calls in trusted server code.
| Input | Location / type | Meaning |
|---|---|---|
| resource | Required header, publication public-key string | Selects the publication’s stored customer associations; not a numeric resource ID or secret. |
| token | Required header, existing authorized token string | ADMIN_TOKEN in examples, with the role required by that operation. |
| user_id | Required digits-only path value | Known global account ID; not a card, customer or payment-method ID. |
The caller must be active; their current publication relationship, when present, must not be locked or suspended. Use the intended reader’s ID from your audience records and the publication context described for each task.
Examples use fictional reader 1002, local IDs 9001–9003 and provider references cus_EXAMPLE, pm_EXAMPLE, card_EXAMPLE. Requests use cURL, Node.js 18+ fetch in an ES module (.mjs), and Python 3 urllib. Set WALLKIT_API_BASE to scheme and host only, plus existing RESOURCE_KEY and ADMIN_TOKEN. Card suffixes are illustrative; no full number or security code is used. See response conventions.
Page through stored card summaries
GET /api/v1/admin/users/{user_id}/cards
Read stored card summaries linked to this account and publication through payment-customer relationships. These are saved records rather than a provider lookup; they can include inactive, expired, live or test entries.
Before you call
Use a readonly-or-inherited Admin token, or root, with the publication key and intended account ID. An unknown account and an account with no matching stored cards can both return an empty list.
Cards are selected through saved account/customer/publication associations. Saved details can be stale; confirm current provider state separately when needed.
Request
No body is needed.
| Query input | Type / requirement | Meaning and constraints |
|---|---|---|
| page | Optional integer; send 1 explicitly | Send a positive page, such as 1. The omitted-page default is unspecified. |
| limit | Optional integer; default 10 | Send a positive page size, such as 10. This reference does not specify a maximum. |
| filter | Optional bracket map or JSON-string field map | Metadata-driven UserCards filtering; unknown or invalid filters are not uniformly rejected. The minimal example omits filters. |
| order / by | Optional known field string | order takes precedence over by. Default UserCards.created_at. |
| sort | Optional string; default DESC | Use ASC/DESC; no stable tie order is promised. |
No pay-system or live/test selector is used. Matching saved cards can span providers.
Response fields
HTTP 200 returns items and the common paginator. Items contain these fields, without provider/customer identifiers or nested objects:
| Field | Type / meaning |
|---|---|
| id | Stored Wallkit card-row identifier; not a full card number or provider card/source ID. |
| card_brand | Stored brand text, potentially null. |
| card_country | Stored country text, potentially null; not a current address verification result. |
| card_last4 | Stored last-four suffix string, potentially null; not a complete card number. |
| default | Stored default flag; scalar representation follows stored data, not a universal boolean cast. It does not prove the provider currently has the same default. |
| expiration_date | Stored expiration date or null; not a guarantee the card is usable. |
| pay_system | Stored provider label selected from the associated payment customer. |
IDs and flags keep their stored types. No token, key, CVV, full card number or provider-source reference is returned. Suffix and expiration describe saved data, not payment authorization.
Example: Read the first page of saved cards
curl "${WALLKIT_API_BASE}/api/v1/admin/users/1002/cards" \
-X GET \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}" \
--get \
--data-urlencode 'page=1' \
--data-urlencode 'limit=10' \
--data-urlencode 'by=UserCards.id' \
--data-urlencode 'sort=ASC'
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/cards`);
url.search = new URLSearchParams({"page": "1", "limit": "10", "by": "UserCards.id", "sort": "ASC"}).toString();
const response = await fetch(url, {
method: "GET",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN}
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
from urllib.parse import urlencode
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/users/1002/cards"
url += "?" + urlencode({'page': '1', 'limit': '10', 'by': 'UserCards.id', 'sort': 'ASC'})
request = Request(
url,
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"]},
method="GET"
)
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
HTTP 200 response:
{
"items": [
{
"id": 9001,
"card_brand": "Visa",
"card_country": "US",
"card_last4": "4242",
"default": true,
"expiration_date": "2027-12-31",
"pay_system": "stripe"
}
],
"paginator": {
"current_page": 1,
"page": 1,
"total_pages": 1,
"total_items": 1,
"limit": 10
}
}
9001 identifies the local Wallkit card row. The read does not fetch current Stripe data or authorize a payment.
No card summaries are returned
HTTP 200 excerpt, paginator omitted:
{
"items": []
}
No matching saved rows, an unknown account, filtering or an empty page can produce this result. Provider-held sources may still exist.
Recovery
| HTTP status | API code / response shape | Cause | Next action |
|---|---|---|---|
| 200 | items [] with paginator | No saved rows match this selection, or the account is unknown. | Check the known account ID, publication, filters and page. Do not infer absence of provider-held payment data. |
| Varies / no guaranteed JSON | Filter/query/paginator/response-format or transport failure | Failure response formats can vary. | Use known query fields, retain any request reference and ask the integration operator to inspect the failure. |
See shared errors. Display the masked summaries, or use payment sources for methods and legacy cards with its higher permissions and provider selection.
Read combined stored payment sources
GET /api/v1/admin/users/{user_id}/payment-sources
Read stored payment methods and legacy cards for one provider. The default is the publication’s configured provider, falling back to stripe. This is not an all-provider inventory.
Before you call
Use an admin-or-inherited token, or root. The intended account and its publication relationship must exist. The result uses saved customer/account/publication associations, rather than a current provider lookup. Confirm unexpected references or inconsistent saved data with your operator.
Stored inventory can include live and test records. A method’s mode reflects its stored livemode flag. Saved inventory and defaults may differ from the provider.
Request
No body, pagination, sort or live/test-mode input is consumed.
| Query input | Type / requirement | Meaning and constraints |
|---|---|---|
| pay-system | Optional trimmed string | Selects a provider when accepted. Omitted/empty uses the publication’s configured default, with stripe fallback. Explicit selectors can fail validation; do not assume every provider label is consistently accepted. |
The example omits pay-system to use the configured provider. If an explicit selector is rejected, confirm the intended provider with your operator before changing it.
Response fields and source kinds
HTTP 200 returns an items array, empty when no sources match. There is no paginator, count or status wrapper. Methods appear first, then legacy cards not already linked by stored card IDs. This removes that linked duplicate, not every possible historical duplicate.
| Source field | Type / meaning |
|---|---|
| source_type | String payment-method or user-card; determines the populated nested object. |
| default | Boolean selected for display in this collection. At most one item is marked true; none is also possible. Does not persist a default or prove provider agreement. |
| pay_system | Provider-label string from the saved payment customer. |
| customer_id | Provider customer reference string or null, not a Wallkit customer-row ID or caller credential. |
| payment_method | Object for a payment-method source; otherwise null. Exact fields below. |
| user_card | Object for a legacy user-card source; otherwise null. Exact fields below. |
Within each segment, saved defaults sort first, then local IDs descending. Only the first stored default in the combined sequence is returned as true; later defaults are shown as false without changing stored rows. The list is not globally sorted and does not repair saved defaults.
| payment_method field | Type / meaning |
|---|---|
| id | Stored Wallkit payment-method identifier. |
| payment_method_id | Provider payment-method reference; not a caller authentication token. |
| mode | String live or test from the stored livemode flag. |
| type | Stored payment-method type string. |
| data | For type card with a linked stored card: card_brand, card_country, card_last4 and expiration_date (saved text/null). Otherwise email from saved billing details, or null. A card-type method without a linked card can therefore have email-shaped data. No full billing/metadata/card payload is returned. |
| user_card field | Type / meaning |
|---|---|
| id | Wallkit card-row integer identifier. |
| card_id | Provider card/source reference string or null; distinct from id and card_last4. |
| card_brand | Saved brand string or null. |
| card_country | Saved country string or null. |
| card_last4 | Saved last-four suffix string or null. |
| expiration_date | Saved date string or null. |
Provider references identify stored objects, not credentials. No client secret, API key, session token, CVV or full card number is returned. Saved values and defaults do not confirm provider validity.
Example: Read a stored method and an unmatched legacy card
Assume the configured provider is stripe. The first item is a card-type payment method with its summary in payment_method.data, so user_card is null. The second is an unmatched legacy card.
curl "${WALLKIT_API_BASE}/api/v1/admin/users/1002/payment-sources" \
-X GET \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}"
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/payment-sources`);
const response = await fetch(url, {
method: "GET",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN}
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/users/1002/payment-sources"
request = Request(
url,
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"]},
method="GET"
)
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
HTTP 200 response:
{
"items": [
{
"source_type": "payment-method",
"default": true,
"pay_system": "stripe",
"customer_id": "cus_EXAMPLE",
"user_card": null,
"payment_method": {
"id": 9002,
"payment_method_id": "pm_EXAMPLE",
"mode": "test",
"type": "card",
"data": {
"card_brand": "Visa",
"card_country": "US",
"card_last4": "4242",
"expiration_date": "2027-12-31"
}
}
},
{
"source_type": "user-card",
"default": false,
"pay_system": "stripe",
"customer_id": "cus_EXAMPLE",
"user_card": {
"id": 9003,
"card_id": "card_EXAMPLE",
"card_brand": "Visa",
"card_country": "US",
"card_last4": "1111",
"expiration_date": "2027-06-30"
},
"payment_method": null
}
]
}
test comes from the stored method. This read does not change payment mode, fetch provider data or update defaults.
No sources match the selected provider context
HTTP 200 response:
{
"items": []
}
Target checks passed, but no sources matched the selected provider. This does not show whether other providers or the provider’s current inventory contain sources.
Recovery
| HTTP status | API code / response shape | Cause | Next action |
|---|---|---|---|
| 404 | user_not_found | Global account is missing. | Check the intended reader ID. |
| 404 | user_not_found_in_resource | No target audience relationship with the selected publication. | Check publication key and existing reader/publication records. |
| 409 | invalid_pay_system | An explicit pay-system selector fails validation; description can be Unsupported pay system. | Confirm intended provider with the integration operator. Omit the selector only when the configured default is the intended provider. |
| 409 | user_sources_error | A caught source-query/mapping exception prevents the result; description can vary. | Provide req_guid and intended reader/publication/provider context to the integration operator. |
| 200 | items [] | No stored matching sources. | Display an empty source state; do not infer absence at other providers or from live provider data. |
| Varies / no guaranteed JSON | Other PHP/transport failure | Not every incompatible stored row or transport failure becomes the documented exception response. | Retain any request reference and ask the integration operator to inspect the failure. |
See shared errors. Display the source kind and masked details. Use card summaries for the paginated view. Neither read refreshes sources.
Reconcile Stripe data into local payment records
PUT /api/v1/admin/users/{user_id}/sync-payment-provider/stripe
Read Stripe customers matching the reader’s current email and reconcile local customer, method and card records. This is a write to Wallkit’s local payment data.
Sync can remove shared local customer/card associations and reset defaults across publications and providers. Empty or partial provider results can trigger removals. Review the shared records with your operator and plan for these changes before reconciliation.
The flow reads the provider and changes local records. It does not delete Stripe customers/sources, change provider defaults or charge the reader. Repeating it does not make local cleanup isolated or reversible.
Before you call
Use an admin-or-inherited token, or root. The global account, publication relationship and existing Stripe configuration must exist. Sync finds customers by the reader’s current email, not a supplied customer ID.
Review the shared-record cleanup and default changes through your existing operator process. Other-publication/provider records can be affected, and incomplete provider results can lead to local removals. Plan for those effects before reconciliation.
Request
Send the path and headers without a body. The request has no customer-ID, live/test or provider-key input. Existing publication payment-mode settings choose live or test access, with live as fallback. This request does not configure keys or mode.
Changes and completion limits
Reconciliation creates or updates local customer associations and saved method/card details from matching Stripe customers, then updates defaults and attempts to remove local records absent from the fetched selection. Review both saved records and shared associations afterward.
Method retrieval is limited to 50 per fetched customer; the result may not cover the provider’s complete inventory. Shared customer records and defaults can extend beyond this publication. Even an empty fetched customer list can lead to default resets and removal of local records.
The request attempts a local rollback after a caught sync failure, but a successful response does not confirm every change. After failure, timeout or an unexpected result, inspect known local state before another write. Repeating sync can repeat broad cleanup.
Response
| Field | Type / presence | Meaning |
|---|---|---|
| status | String success on nominal HTTP 200 | Completion marker only. No changed-row count, per-customer result, source list or proof that every record was reconciled is returned. |
Read stored cards and sources separately. Neither read shows every shared record affected by sync or verifies every reconciliation step.
Example: Run an intended local reconciliation
Assume the reader relationship and Stripe configuration exist, and the broad local changes are intended. These prerequisites do not remove shared-record or partial-inventory risks. The example uses no real provider/customer data.
curl "${WALLKIT_API_BASE}/api/v1/admin/users/1002/sync-payment-provider/stripe" \
-X PUT \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}"
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/sync-payment-provider/stripe`);
const response = await fetch(url, {
method: "PUT",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN}
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/users/1002/sync-payment-provider/stripe"
request = Request(
url,
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"]},
method="PUT"
)
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
Nominal HTTP 200 response:
{
"status": "success"
}
This is not a per-source report, complete-inventory confirmation or charge result. A successful flow can still reset defaults or remove shared records after empty provider results.
A caught sync failure returns a conflict response
HTTP 409 example from the generic caught-exception branch:
{
"error": "sync_user_payment_data_error",
"error_description": "Sync stripe payment method data has failed",
"req_guid": "example-request"
}
Other caught sync exceptions use the same code with different descriptions. Rollback is attempted, but the error does not establish unchanged state. Inspect before repeating.
Recovery
| HTTP status | API code / response shape | Cause | Next action |
|---|---|---|---|
| 404 | user_not_exists | Global account is missing; description is User not found. | Check the intended reader ID. |
| 404 | resource_not_found | Required publication context is not available. | Check the supplied publication public key and existing integration context. |
| 409 | user_not_found | Target has no matching publication relationship; description is Incorrect user resource. | Check the known reader/publication relationship before another request. |
| 409 | sync_user_payment_data_error | A caught provider/local reconciliation exception occurred; description can vary. | Provide req_guid to the integration operator and inspect current local state before any repeat. Do not treat it as a guaranteed no-change result. |
| 200 | status success with unexpected stored sources/defaults | Completion does not verify every write; empty/partial results and shared cleanup can be consequential. | Inspect the intended reader state and known shared associations/defaults through the existing operator process. Do not repeat sync as a restoration strategy. |
| Varies / no guaranteed JSON | Other PHP/transport failure | Not every failure is converted to the documented exception response or verified rollback. | Retain any request reference and ask the integration operator to inspect effects before another write. |
See shared errors. Inspect saved cards and payment sources, remembering that sync can affect shared records outside those results.