Sample - Stripe API
POST/v1/sources

Create a source

Creates a new source payment instrument. Supply the source type and any type-specific details required by the selected payment flow, such as amount for single-use sources or redirect.return_url for redirect authentication. You can attach the source to a customer or provide an original_source when cloning an existing source.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.
  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

16 body fields

Source creation parameters, including payment-method details, ownership information, and flow-specific options.

amountintegeroptional
Amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for `single_use` sources. Not supported for `receiver` type sources, where charge amount may not be specified until funds land.
currencystringoptional
Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) associated with the source. This is the currency for which the source will be chargeable once ready.
customerstringoptional
The `Customer` to whom the original source is attached to. Must be set when the original source is not a `Source` (e.g., `Card`).
expandarray<string>optional
Specifies which fields in the response should be expanded.
flowstringoptional
The authentication `flow` of the source to create. `flow` is one of `redirect`, `receiver`, `code_verification`, `none`. It is generally inferred unless a type supports multiple flows.
Allowed:code_verificationnonereceiverredirect
mandateobjectoptional
Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status.
metadataobjectoptional
Key-value pairs to attach to the source.
original_sourcestringoptional
The source to share.
ownerobjectoptional
Information about the owner of the payment instrument that may be used or required by particular source types.
receiverobjectoptional
Optional parameters for the receiver flow. Can be set only if the source is a receiver (`flow` is `receiver`).
redirectobjectoptional
Parameters required for the redirect flow. Required if the source is authenticated by a redirect (`flow` is `redirect`).
source_orderobjectoptional
Information about the items and shipping associated with the source. Required for transactional credit (for example Klarna) sources before you can charge it.
statement_descriptorstringoptional
An arbitrary string to be displayed on your customer's statement. As an example, if your website is `RunClub` and the item you're charging for is a race ticket, you may want to specify a `statement_descriptor` of `RunClub 5K race ticket.` While many payment types will display this information, some may not display it at all.
tokenstringoptional
An optional token used to create the source. When passed, token properties will override source parameters.
typestringoptional
The `type` of the source to create. Required unless `customer` and `original_source` are specified (see the [Cloning card Sources](https://docs.stripe.com/sources/connect#cloning-card-sources) guide)
usagestringoptional
Allowed:reusablesingle_use

2 status codes
200Returns the created source object, including its identifier, status, flow, currency, creation time, and client secret.
ach_credit_transferobjectoptional
ach_debitobjectoptional
acss_debitobjectoptional
alipayobjectoptional
allow_redisplaystringoptional
This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”.
Allowed:alwayslimitedunspecified
amountintegeroptional
A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for `single_use` sources.
au_becs_debitobjectoptional
bancontactobjectoptional
cardobjectoptional
card_presentobjectoptional
client_secretstringrequired
The client secret of the source. Used for client-side retrieval using a publishable key.
code_verificationobjectoptional
createdintegerrequired
Time at which the object was created. Measured in seconds since the Unix epoch.
currencystringoptional
Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) associated with the source. This is the currency for which the source will be chargeable once ready. Required for `single_use` sources.
customerstringoptional
The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer.
epsobjectoptional
flowstringrequired
The authentication `flow` of the source. `flow` is one of `redirect`, `receiver`, `code_verification`, `none`.
giropayobjectoptional
idstringrequired
Unique identifier for the object.
idealobjectoptional
klarnaobjectoptional
livemodebooleanrequired
If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
metadataobjectoptional
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.
multibancoobjectoptional
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
Allowed:source
ownerobjectoptional
Information about the owner of the payment instrument that may be used or required by particular source types.
p24objectoptional
receiverobjectoptional
redirectobjectoptional
sepa_debitobjectoptional
sofortobjectoptional
source_orderobjectoptional
statement_descriptorstringoptional
Extra information about a source. This will appear on your customer's statement every time you charge the source.
statusstringrequired
The status of the source, one of `canceled`, `chargeable`, `consumed`, `failed`, or `pending`. Only `chargeable` sources can be used to create a charge.
three_d_secureobjectoptional
typestringrequired
The `type` of the source. The `type` is a payment method, one of `ach_credit_transfer`, `ach_debit`, `alipay`, `bancontact`, `card`, `card_present`, `eps`, `giropay`, `ideal`, `multibanco`, `klarna`, `p24`, `sepa_debit`, `sofort`, `three_d_secure`, or `wechat`. An additional hash is included on the source with a name matching this value. It contains additional information specific to the [payment method](https://docs.stripe.com/sources) used.
Allowed:ach_credit_transferach_debitacss_debitalipayau_becs_debitbancontactcardcard_presentepsgiropayidealklarna
usagestringoptional
Either `reusable` or `single_use`. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned.
wechatobjectoptional
defaultReturns an error object containing details about the failed source request.
errorobjectrequired

Error handling

Provide type unless both customer and original_source are specified. flow must be one of code_verification, none, receiver, or redirect; when flow is redirect, redirect.return_url must be provided, and receiver parameters can be used only with the receiver flow. currency must be a three-letter currency code, and amount is required for single_use sources.