Stripe: Create a card — customers post Customers Customer Sources
Stripe customers.postCustomersCustomerSources: arguments, response, policy and SDK examples.
← Customers operations · Get started
Operation stripe.postcustomerscustomersources
Provider route: POST /v1/customers/{customer}/sources. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/stripe with npm, or alter-sdk-stripe with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { StripeIntegration } from "@alter-ai/stripe";
async function execute(input: Parameters<StripeIntegration["customers"]["postCustomersCustomerSources"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new StripeIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.customers.postCustomersCustomerSources(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_stripe import StripeIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = StripeIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.customers.post_customers_customer_sources(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.customer | string | Required within parent | Maximum length: 5000 |
headers | object | Optional | Additional keys: not allowed |
headers.Idempotency-Key | string | Optional | Minimum length: 1 Maximum length: 255 |
body | Model | Optional | Expand Create a card — customers post Customers Customer Cards — request body — body |
Referenced models: Create a card — customers post Customers Customer Cards — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Get Customers Customer Sources Id — response body |
Referenced models: Get Customers Customer Sources Id — response body
Schemas
Section titled “Schemas”707 more schemas are linked from the tables above, on the schema pages.
Get Customers Customer Sources Id — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | Model | Alternative | Expand Create an account — response body |
$ (anyOf 2) | Model | Alternative | Expand Retrieve a bank account — response body |
$ (anyOf 3) | Model | Alternative | Expand Retrieve a card — customers get Customers Customer Cards Id — response body |
$ (anyOf 4) | Model | Alternative | Expand Create a source — response body |
Referenced models: Create an account — response body, Retrieve a bank account — response body, Retrieve a card — customers get Customers Customer Cards Id — response body, Create a source — response body
Create a card — customers post Customers Customer Cards — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
alipay_account | string | Optional | A token returned by [Stripe.js](https://stripe.com/docs/js) representing the user’s Alipay account details. Maximum length: 5000 |
bank_account | JSON | Optional | Either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/js), or a dictionary containing a user's bank account details. |
bank_account (anyOf 1) | Model | Alternative | Expand Update a customer — request body — body / bank_account / account_holder_type: company, individual, object: bank account |
bank_account (anyOf 2) | string | Alternative | Maximum length: 5000 |
card | JSON | Optional | A token, like the ones returned by [Stripe.js](https://stripe.com/docs/js). |
card (anyOf 1) | Model | Alternative | Expand Create a charge — request body — body / card / object: card |
card (anyOf 2) | string | Alternative | Maximum length: 5000 |
expand | array | Optional | Specifies which fields in the response should be expanded. |
expand[] | string | Each item | Maximum length: 5000 |
metadata | object | Optional | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. Additional keys: see wildcard field |
metadata.* | string | Additional keys | |
source | string | Optional | Please refer to full [documentation](https://api.stripe.com) instead. Maximum length: 5000 |
Referenced models: Update a customer — request body — body / bank_account / account_holder_type: company, individual, object: bank account, Create a charge — request body — body / card / object: card
Update a customer — request body — body / bank_account / account_holder_type: company, individual, object: bank account
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
account_holder_name | string | Optional | Maximum length: 5000 |
account_holder_type | string | Optional | One of: company, individual Maximum length: 5000 |
account_number | string | Required within parent | Maximum length: 5000 |
country | string | Required within parent | Maximum length: 5000 |
currency | string | Optional | Format: currency |
object | string | Optional | One of: bank_account Maximum length: 5000 |
routing_number | string | Optional | Maximum length: 5000 |
Create a charge — request body — body / card / object: card
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
address_city | string | Optional | Maximum length: 5000 |
address_country | string | Optional | Maximum length: 5000 |
address_line1 | string | Optional | Maximum length: 5000 |
address_line2 | string | Optional | Maximum length: 5000 |
address_state | string | Optional | Maximum length: 5000 |
address_zip | string | Optional | Maximum length: 5000 |
cvc | string | Optional | Maximum length: 5000 |
encrypted | string | Optional | Maximum length: 5000 |
exp_month | integer | Required within parent | |
exp_year | integer | Required within parent | |
metadata | object | Optional | Additional keys: see wildcard field |
metadata.* | string | Additional keys | |
name | string | Optional | Maximum length: 5000 |
network_token | object | Optional | |
network_token.number | string | Optional | Maximum length: 5000 |
number | string | Required within parent | Maximum length: 5000 |
object | string | Optional | One of: card Maximum length: 5000 |
swipe_data | string | Optional | Maximum length: 5000 |
Create an account — response body — future requirements
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
alternatives | JSON | Optional | |
alternatives (anyOf 1) | array | Alternative | Fields that are due and can be resolved by providing the corresponding alternative fields instead. Many alternatives can list the same `original_fields_due`, and any of these alternatives can serve as a pathway for attempting to resolve the fields again. Re-providing `original_fields_due` also serves as a pathway for attempting to resolve the fields again. |
alternatives (anyOf 1)[] | Model | Each item | Expand Create an account — response body — requirements alternatives array item |
alternatives (anyOf 2) | null | Alternative | |
current_deadline | JSON | Optional | |
current_deadline (anyOf 1) | JSON | Alternative | |
current_deadline (anyOf 1) (anyOf 1) | integer | Alternative | Date on which `future_requirements` becomes the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on its enablement state prior to transitioning. Format: unix-time |
current_deadline (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
current_deadline (anyOf 2) | null | Alternative | |
currently_due | JSON | Optional | |
currently_due (anyOf 1) | array | Alternative | Fields that need to be resolved to keep the account enabled. If not resolved by `future_requirements[current_deadline]`, these fields will transition to the main `requirements` hash. |
currently_due (anyOf 1)[] | string | Each item | Maximum length: 5000 |
currently_due (anyOf 2) | null | Alternative | |
disabled_reason | JSON | Optional | |
disabled_reason (anyOf 1) | string | Alternative | This is typed as an enum for consistency with `requirements.disabled_reason`. Known values: action_required.requested_capabilities, listed, other, platform_paused, rejected.fraud, rejected.incomplete_verification, rejected.listed, rejected.other, rejected.platform_fraud, rejected.platform_other, rejected.platform_terms_of_service, rejected.terms_of_service, requirements.past_due, requirements.pending_verification, under_review |
disabled_reason (anyOf 2) | null | Alternative | |
errors | JSON | Optional | |
errors (anyOf 1) | array | Alternative | Fields that are `currently_due` and need to be collected again because validation or verification failed. |
errors (anyOf 1)[] | Model | Each item | Expand Update an Account Capability — response body — requirements errors item |
errors (anyOf 2) | null | Alternative | |
eventually_due | JSON | Optional | |
eventually_due (anyOf 1) | array | Alternative | Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well. |
eventually_due (anyOf 1)[] | string | Each item | Maximum length: 5000 |
eventually_due (anyOf 2) | null | Alternative | |
past_due | JSON | Optional | |
past_due (anyOf 1) | array | Alternative | Fields that haven't been resolved by `requirements.current_deadline`. These fields need to be resolved to enable the capability on the account. `future_requirements.past_due` is a subset of `requirements.past_due`. |
past_due (anyOf 1)[] | string | Each item | Maximum length: 5000 |
past_due (anyOf 2) | null | Alternative | |
pending_verification | JSON | Optional | |
pending_verification (anyOf 1) | array | Alternative | Fields that are being reviewed, or might become required depending on the results of a review. If the review fails, these fields can move to `eventually_due`, `currently_due`, `past_due` or `alternatives`. Fields might appear in `eventually_due`, `currently_due`, `past_due` or `alternatives` and in `pending_verification` if one verification fails but another is still pending. |
pending_verification (anyOf 1)[] | string | Each item | Maximum length: 5000 |
pending_verification (anyOf 2) | null | Alternative |
Referenced models: Create an account — response body — requirements alternatives array item, Update an Account Capability — response body — requirements errors item
Pause a subscription — response body — presentment details
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
presentment_currency | string | Required within parent | Currency used for customer payments. Maximum length: 5000 |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: stripe.postcustomerscustomersources. Catalog operation: PostCustomersCustomerSources. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"Stripe-Version": "2026-09-30.endive"}