Stripe: Create a charge
Stripe charges.postCharges: arguments, response, policy and SDK examples.
← Charges operations · Get started
Operation stripe.postcharges
Provider route: POST /v1/charges. 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["charges"]["postCharges"]>[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.charges.postCharges(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.charges.post_charges(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
headers | object | Optional | Additional keys: not allowed |
headers.Idempotency-Key | string | Optional | Minimum length: 1 Maximum length: 255 |
body | object | Optional | Additional keys: not allowed |
body.amount | integer | Optional | Amount intended to be collected by this payment. A positive integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://docs.stripe.com/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). |
body.application_fee | integer | Optional | |
body.application_fee_amount | integer | Optional | A fee in cents (or local equivalent) that will be applied to the charge and transferred to the application owner’s Stripe account. The request must be made with an OAuth key or the `Stripe-Account` header in order to take an application fee. For more information, see the application fees [documentation](https://docs.stripe.com/connect/direct-charges#collect-fees). |
body.capture | boolean | Optional | Whether to immediately capture the charge. Defaults to `true`. When `false`, the charge issues an authorization (or pre-authorization), and will need to be [captured](https://docs.stripe.com/api#capture_charge) later. Uncaptured charges expire after a set number of days (7 by default). For more information, see the [authorizing charges and settling later](https://docs.stripe.com/charges/placing-a-hold) documentation. |
body.card | JSON | Optional | A token, like the ones returned by [Stripe.js](https://stripe.com/docs/js). |
body.card (anyOf 1) | Model | Alternative | Expand Create a charge — request body — body / card / object: card |
body.card (anyOf 2) | string | Alternative | Maximum length: 5000 |
body.currency | string | Optional | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Format: currency |
body.customer | string | Optional | The ID of an existing customer that will be charged in this request. Maximum length: 500 |
body.description | string | Optional | An arbitrary string which you can attach to a `Charge` object. It is displayed when in the web interface alongside the charge. Note that if you use Stripe to send automatic email receipts to your customers, your receipt emails will include the `description` of the charge(s) that they are describing. Maximum length: 40000 |
body.destination | JSON | Optional | |
body.destination (anyOf 1) | object | Alternative | |
body.destination (anyOf 1).account | string | Required within parent | Maximum length: 5000 |
body.destination (anyOf 1).amount | integer | Optional | |
body.destination (anyOf 2) | string | Alternative | |
body.expand | array | Optional | Specifies which fields in the response should be expanded. |
body.expand[] | string | Each item | Maximum length: 5000 |
body.metadata | JSON | 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`. |
body.metadata (anyOf 1) | object | Alternative | Additional keys: see wildcard field |
body.metadata (anyOf 1).* | string | Additional keys | |
body.metadata (anyOf 2) | string | Alternative | One of: |
body.on_behalf_of | string | Optional | The Stripe account ID for which these funds are intended. You can specify the business of record as the connected account using the `on_behalf_of` attribute on the charge. For details, see [Creating Separate Charges and Transfers](https://docs.stripe.com/connect/separate-charges-and-transfers#settlement-merchant). Maximum length: 5000 |
body.radar_options | object | Optional | Options to configure Radar. See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information. |
body.radar_options.session | string | Optional | Maximum length: 5000 |
body.receipt_email | string | Optional | The email address to which this charge’s [receipt](https://docs.stripe.com/dashboard/receipts) will be sent. The receipt will not be sent until the charge is paid, and no receipts will be sent for test mode charges. If this charge is for a [Customer](https://docs.stripe.com/api/customers/object), the email address specified here will override the customer’s email address. If `receipt_email` is specified for a charge in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails). |
body.shipping | Model | Optional | Expand Create a charge — request body — body shipping |
body.source | string | Optional | A payment source to be charged. This can be the ID of a [card](https://docs.stripe.com/api#cards) (i.e., credit or debit card), a [bank account](https://docs.stripe.com/api#bank_accounts), a [source](https://docs.stripe.com/api#sources), a [token](https://docs.stripe.com/api#tokens), or a [connected account](https://docs.stripe.com/connect/account-debits#charging-a-connected-account). For certain sources---namely, [cards](https://docs.stripe.com/api#cards), [bank accounts](https://docs.stripe.com/api#bank_accounts), and attached [sources](https://docs.stripe.com/api#sources)---you must also pass the ID of the associated customer. Maximum length: 5000 |
body.statement_descriptor | string | Optional | For a non-card charge, text that appears on the customer’s statement as the statement descriptor. This value overrides the account’s default statement descriptor. For information about requirements, including the 22-character limit, see [the Statement Descriptor docs](https://docs.stripe.com/get-started/account/statement-descriptors). For a card charge, this value is ignored unless you don’t specify a `statement_descriptor_suffix`, in which case this value is used as the suffix. Maximum length: 22 |
body.statement_descriptor_suffix | string | Optional | Provides information about a card charge. Concatenated to the account’s [statement descriptor prefix](https://docs.stripe.com/get-started/account/statement-descriptors#static) to form the complete statement descriptor that appears on the customer’s statement. If the account has no prefix value, the suffix is concatenated to the account’s statement descriptor. Maximum length: 22 |
body.transfer_data | object | Optional | An optional dictionary including the account to automatically transfer to as part of a destination charge. [See the Connect documentation](https://docs.stripe.com/connect/destination-charges) for details. |
body.transfer_data.amount | integer | Optional | |
body.transfer_data.description | string | Optional | Maximum length: 5000 |
body.transfer_data.destination | string | Required within parent | Maximum length: 5000 |
body.transfer_group | string | Optional | A string that identifies this transaction as part of a group. For details, see [Grouping transactions](https://docs.stripe.com/connect/separate-charges-and-transfers#transfer-options). |
Referenced models: Create a charge — request body — body / card / object: card, Create a charge — request body — body shipping
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 Create a charge — response body |
Referenced models: Create a charge — response body
Schemas
Section titled “Schemas”704 more schemas are linked from the tables above, on the schema pages.
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 a charge — request body — body shipping
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Shipping information for the charge. Helps prevent fraud on charges for physical goods. |
address | object | Required within parent | |
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.postal_code | string | Optional | Maximum length: 5000 |
address.state | string | Optional | Maximum length: 5000 |
carrier | string | Optional | Maximum length: 5000 |
name | string | Required within parent | Maximum length: 5000 |
phone | string | Optional | Maximum length: 5000 |
tracking_number | string | Optional | Maximum length: 5000 |
PostApplicationFeesIdRefund — response body — application / object: application
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
name | JSON | Optional | |
name (anyOf 1) | string | Alternative | The name of the application. Maximum length: 5000 |
name (anyOf 2) | null | Alternative | |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: application |
Post Application Fees Id Refund — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
account | JSON | Required within parent | ID of the Stripe account this fee was taken from. |
account (anyOf 1) | string | Alternative | Maximum length: 5000 |
account (anyOf 2) | Model | Alternative | Expand Create an account — response body |
amount | JSON | Required within parent | |
amount (anyOf 1) | integer | Alternative | Amount earned, in cents (or local equivalent). |
amount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
amount_refunded | JSON | Required within parent | |
amount_refunded (anyOf 1) | integer | Alternative | Amount in cents (or local equivalent) refunded (can be less than the amount attribute on the fee if a partial refund was issued) |
amount_refunded (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
application | JSON | Required within parent | ID of the Connect application that earned the fee. |
application (anyOf 1) | string | Alternative | Maximum length: 5000 |
application (anyOf 2) | Model | Alternative | Expand PostApplicationFeesIdRefund — response body — application / object: application |
balance_transaction | JSON | Optional | |
balance_transaction (anyOf 1) | JSON | Alternative | Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds). |
balance_transaction (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
balance_transaction (anyOf 1) (anyOf 2) | Model | Alternative | Expand Retrieve a balance transaction — balance get Balance History Id — response body |
balance_transaction (anyOf 2) | null | Alternative | |
charge | JSON | Required within parent | ID of the charge that the application fee was taken from. |
charge (anyOf 1) | string | Alternative | Maximum length: 5000 |
charge (anyOf 2) | Model | Alternative | Expand Create a charge — response body |
created | JSON | Required within parent | |
created (anyOf 1) | integer | Alternative | Time at which the object was created. Measured in seconds since the Unix epoch. Format: unix-time |
created (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
currency | string | Required within parent | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Format: currency |
fee_source | JSON | Optional | |
fee_source (anyOf 1) | JSON | Alternative | Polymorphic source of the application fee. Includes the ID of the object the application fee was created from. |
fee_source (anyOf 1) (anyOf 1) | Model | Alternative | Expand PostApplicationFeesIdRefund — response body — fee_source / value / type: charge, payout |
fee_source (anyOf 2) | null | Alternative | |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
livemode | boolean | Required within parent | If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`. |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: application_fee |
originating_transaction | JSON | Optional | |
originating_transaction (anyOf 1) | JSON | Alternative | ID of the corresponding charge on the platform account, if this fee was the result of a charge using the `destination` parameter. |
originating_transaction (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
originating_transaction (anyOf 1) (anyOf 2) | Model | Alternative | Expand Create a charge — response body |
originating_transaction (anyOf 2) | null | Alternative | |
refunded | boolean | Required within parent | Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false. |
refunds | object | Required within parent | A list of refunds that have been applied to the fee. |
refunds.data | array | Required within parent | Details about each object. |
refunds.data[] | Model | Each item | Expand Create an application fee refund — response body |
refunds.has_more | boolean | Required within parent | True if this list has another page of items after this one that can be fetched. |
refunds.object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Always has the value `list`. Known values: list |
refunds.url | string | Required within parent | The URL where this list can be accessed. Maximum length: 5000 |
Referenced models: Create an account — response body, PostApplicationFeesIdRefund — response body — application / object: application, Retrieve a balance transaction — balance get Balance History Id — response body, Create a charge — response body, Create an application fee refund — response body, PostApplicationFeesIdRefund — response body — fee_source / value / type: charge, payout
Create a charge — response body — fraud details Information on fraud assessments for the charge stripe report, user report
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
stripe_report | string | Optional | Assessments from Stripe. If set, the value is `fraudulent`. Maximum length: 5000 |
user_report | string | Optional | Assessments reported by you. If set, possible values of are `safe` and `fraudulent`. Maximum length: 5000 |
Delete a customer — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
deleted | boolean | Required within parent | Always true for a deleted object Known values: True |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: customer |
Create a Payment Method — response body — zip
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: stripe.postcharges. Catalog operation: PostCharges. 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"}