Skip to content

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.

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 os
from alter_sdk import App
from 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()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.customerstringRequired within parentMaximum length: 5000
headersobjectOptionalAdditional keys: not allowed
headers.Idempotency-KeystringOptionalMinimum length: 1
Maximum length: 255
bodyModelOptionalExpand 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 media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Get Customers Customer Sources Id — response body

Referenced models: Get Customers Customer Sources Id — response body

707 more schemas are linked from the tables above, on the schema pages.

Get Customers Customer Sources Id — response body
FieldTypePresenceDescription and constraints
$JSONRoot
$ (anyOf 1)ModelAlternativeExpand Create an account — response body
$ (anyOf 2)ModelAlternativeExpand Retrieve a bank account — response body
$ (anyOf 3)ModelAlternativeExpand Retrieve a card — customers get Customers Customer Cards Id — response body
$ (anyOf 4)ModelAlternativeExpand 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
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
alipay_accountstringOptionalA token returned by [Stripe.js](https://stripe.com/docs/js) representing the user’s Alipay account details.
Maximum length: 5000
bank_accountJSONOptionalEither 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)ModelAlternativeExpand Update a customer — request body — body / bank_account / account_holder_type: company, individual, object: bank account
bank_account (anyOf 2)stringAlternativeMaximum length: 5000
cardJSONOptionalA token, like the ones returned by [Stripe.js](https://stripe.com/docs/js).
card (anyOf 1)ModelAlternativeExpand Create a charge — request body — body / card / object: card
card (anyOf 2)stringAlternativeMaximum length: 5000
expandarrayOptionalSpecifies which fields in the response should be expanded.
expand[]stringEach itemMaximum length: 5000
metadataobjectOptionalSet 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.*stringAdditional keys
sourcestringOptionalPlease 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
FieldTypePresenceDescription and constraints
$objectRoot
account_holder_namestringOptionalMaximum length: 5000
account_holder_typestringOptionalOne of: company, individual
Maximum length: 5000
account_numberstringRequired within parentMaximum length: 5000
countrystringRequired within parentMaximum length: 5000
currencystringOptionalFormat: currency
objectstringOptionalOne of: bank_account
Maximum length: 5000
routing_numberstringOptionalMaximum length: 5000
Create a charge — request body — body / card / object: card
FieldTypePresenceDescription and constraints
$objectRoot
address_citystringOptionalMaximum length: 5000
address_countrystringOptionalMaximum length: 5000
address_line1stringOptionalMaximum length: 5000
address_line2stringOptionalMaximum length: 5000
address_statestringOptionalMaximum length: 5000
address_zipstringOptionalMaximum length: 5000
cvcstringOptionalMaximum length: 5000
encryptedstringOptionalMaximum length: 5000
exp_monthintegerRequired within parent
exp_yearintegerRequired within parent
metadataobjectOptionalAdditional keys: see wildcard field
metadata.*stringAdditional keys
namestringOptionalMaximum length: 5000
network_tokenobjectOptional
network_token.numberstringOptionalMaximum length: 5000
numberstringRequired within parentMaximum length: 5000
objectstringOptionalOne of: card
Maximum length: 5000
swipe_datastringOptionalMaximum length: 5000
Create an account — response body — future requirements
FieldTypePresenceDescription and constraints
$objectRoot
alternativesJSONOptional
alternatives (anyOf 1)arrayAlternativeFields 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)[]ModelEach itemExpand Create an account — response body — requirements alternatives array item
alternatives (anyOf 2)nullAlternative
current_deadlineJSONOptional
current_deadline (anyOf 1)JSONAlternative
current_deadline (anyOf 1) (anyOf 1)integerAlternativeDate 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)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
current_deadline (anyOf 2)nullAlternative
currently_dueJSONOptional
currently_due (anyOf 1)arrayAlternativeFields 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)[]stringEach itemMaximum length: 5000
currently_due (anyOf 2)nullAlternative
disabled_reasonJSONOptional
disabled_reason (anyOf 1)stringAlternativeThis 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)nullAlternative
errorsJSONOptional
errors (anyOf 1)arrayAlternativeFields that are `currently_due` and need to be collected again because validation or verification failed.
errors (anyOf 1)[]ModelEach itemExpand Update an Account Capability — response body — requirements errors item
errors (anyOf 2)nullAlternative
eventually_dueJSONOptional
eventually_due (anyOf 1)arrayAlternativeFields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well.
eventually_due (anyOf 1)[]stringEach itemMaximum length: 5000
eventually_due (anyOf 2)nullAlternative
past_dueJSONOptional
past_due (anyOf 1)arrayAlternativeFields 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)[]stringEach itemMaximum length: 5000
past_due (anyOf 2)nullAlternative
pending_verificationJSONOptional
pending_verification (anyOf 1)arrayAlternativeFields 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)[]stringEach itemMaximum length: 5000
pending_verification (anyOf 2)nullAlternative

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
FieldTypePresenceDescription and constraints
$objectRoot
presentment_currencystringRequired within parentCurrency used for customer payments.
Maximum length: 5000

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"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.