Skip to content

Stripe: Update an invoice

Stripe invoices.postInvoicesInvoice: arguments, response, policy and SDK examples.

← Invoices operations · Get started

Operation stripe.postinvoicesinvoice

Provider route: POST /v1/invoices/{invoice}. 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["invoices"]["postInvoicesInvoice"]>[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.invoices.postInvoicesInvoice(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.invoices.post_invoices_invoice(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.invoicestringRequired within parentMaximum length: 5000
headersobjectOptionalAdditional keys: not allowed
headers.Idempotency-KeystringOptionalMinimum length: 1
Maximum length: 255
bodyobjectOptionalAdditional keys: not allowed
body.account_tax_idsJSONOptionalThe account tax IDs associated with the invoice. Only editable when the invoice is a draft.
body.account_tax_ids (anyOf 1)arrayAlternative
body.account_tax_ids (anyOf 1)[]stringEach itemMaximum length: 5000
body.account_tax_ids (anyOf 2)stringAlternativeOne of:
body.application_fee_amountintegerOptionalA fee in cents (or local equivalent) that will be applied to the invoice 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/billing/invoices/connect#collecting-fees).
body.auto_advancebooleanOptionalControls whether Stripe performs [automatic collection](https://docs.stripe.com/invoicing/integration/automatic-advancement-collection) of the invoice.
body.automatic_taxobjectOptionalSettings for automatic tax lookup for this invoice.
body.automatic_tax.enabledbooleanRequired within parent
body.automatic_tax.liabilityobjectOptional
body.automatic_tax.liability.accountstringOptional
body.automatic_tax.liability.typestringRequired within parentOne of: account, self
body.automatically_finalizes_atintegerOptionalThe time when this invoice should be scheduled to finalize (up to 5 years in the future). The invoice is finalized at this time if it’s still in draft state. To turn off automatic finalization, set `auto_advance` to false.
Format: unix-time
body.collection_methodstringOptionalEither `charge_automatically` or `send_invoice`. This field can be updated only on `draft` invoices.
One of: charge_automatically, send_invoice
body.custom_fieldsJSONOptionalA list of up to 4 custom fields to be displayed on the invoice. If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. Pass an empty string to remove previously-defined fields.
body.custom_fields (anyOf 1)arrayAlternative
body.custom_fields (anyOf 1)[]objectEach item
body.custom_fields (anyOf 1)[].namestringRequired within parentMaximum length: 40
body.custom_fields (anyOf 1)[].valuestringRequired within parentMaximum length: 140
body.custom_fields (anyOf 2)stringAlternativeOne of:
body.days_until_dueintegerOptionalThe number of days from which the invoice is created until it is due. Only valid for invoices where `collection_method=send_invoice`. This field can only be updated on `draft` invoices.
body.default_payment_methodstringOptionalID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription’s default payment method, if any, or to the default payment method in the customer’s invoice settings.
Maximum length: 5000
body.default_sourceJSONOptionalID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription’s default source, if any, or to the customer’s default source.
body.default_source (anyOf 1)stringAlternativeMaximum length: 5000
body.default_source (anyOf 2)stringAlternativeOne of:
body.default_tax_ratesJSONOptionalThe tax rates that will apply to any line item that does not have `tax_rates` set. Pass an empty string to remove previously-defined tax rates.
body.default_tax_rates (anyOf 1)arrayAlternative
body.default_tax_rates (anyOf 1)[]stringEach itemMaximum length: 5000
body.default_tax_rates (anyOf 2)stringAlternativeOne of:
body.descriptionstringOptionalAn arbitrary string attached to the object. Often useful for displaying to users. Referenced as ‘memo’ in the Dashboard.
Maximum length: 1500
body.discountsJSONOptionalThe discounts that will apply to the invoice. Pass an empty string to remove previously-defined discounts.
body.discounts (anyOf 1)arrayAlternative
body.discounts (anyOf 1)[]objectEach item
body.discounts (anyOf 1)[].couponstringOptionalMaximum length: 5000
body.discounts (anyOf 1)[].discountstringOptionalMaximum length: 5000
body.discounts (anyOf 1)[].promotion_codestringOptionalMaximum length: 5000
body.discounts (anyOf 2)stringAlternativeOne of:
body.due_dateintegerOptionalThe date on which payment for this invoice is due. Only valid for invoices where `collection_method=send_invoice`. This field can only be updated on `draft` invoices.
Format: unix-time
body.effective_atJSONOptionalThe date when this invoice is in effect. Same as `finalized_at` unless overwritten. When defined, this value replaces the system-generated ‘Date of issue’ printed on the invoice PDF and receipt.
body.effective_at (anyOf 1)integerAlternativeFormat: unix-time
body.effective_at (anyOf 2)stringAlternativeOne of:
body.expandarrayOptionalSpecifies which fields in the response should be expanded.
body.expand[]stringEach itemMaximum length: 5000
body.footerstringOptionalFooter to be displayed on the invoice.
Maximum length: 5000
body.issuerobjectOptionalThe connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
body.issuer.accountstringOptional
body.issuer.typestringRequired within parentOne of: account, self
body.metadataJSONOptionalSet 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)objectAlternativeAdditional keys: see wildcard field
body.metadata (anyOf 1).*stringAdditional keys
body.metadata (anyOf 2)stringAlternativeOne of:
body.numberJSONOptionalSet the number for this invoice. If no number is present then a number will be assigned automatically when the invoice is finalized. In many markets, regulations require invoices to be unique, sequential and / or gapless. You are responsible for ensuring this is true across all your different invoicing systems in the event that you edit the invoice number using our API. If you use only Stripe for your invoices and do not change invoice numbers, Stripe handles this aspect of compliance for you automatically.
body.number (anyOf 1)stringAlternativeMaximum length: 26
body.number (anyOf 2)stringAlternativeOne of:
body.on_behalf_ofJSONOptionalThe account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the [Invoices with Connect](https://docs.stripe.com/billing/invoices/connect) documentation for details.
body.on_behalf_of (anyOf 1)stringAlternative
body.on_behalf_of (anyOf 2)stringAlternativeOne of:
body.payment_settingsModelOptionalExpand Create an invoice — request body — body payment settings
body.renderingModelOptionalExpand Create an invoice — request body — body rendering
body.shipping_costJSONOptionalSettings for the cost of shipping for this invoice.
body.shipping_cost (anyOf 1)ModelAlternativeExpand Create a Checkout Session — request body — body shipping options item
body.shipping_cost (anyOf 2)stringAlternativeOne of:
body.shipping_detailsJSONOptionalShipping details for the invoice. The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer.
body.shipping_details (anyOf 1)objectAlternative
body.shipping_details (anyOf 1).addressobjectRequired within parent
body.shipping_details (anyOf 1).address.citystringOptionalMaximum length: 5000
body.shipping_details (anyOf 1).address.countrystringOptionalMaximum length: 5000
body.shipping_details (anyOf 1).address.line1stringOptionalMaximum length: 5000
body.shipping_details (anyOf 1).address.line2stringOptionalMaximum length: 5000
body.shipping_details (anyOf 1).address.postal_codestringOptionalMaximum length: 5000
body.shipping_details (anyOf 1).address.statestringOptionalMaximum length: 5000
body.shipping_details (anyOf 1).namestringRequired within parentMaximum length: 5000
body.shipping_details (anyOf 1).phoneJSONOptional
body.shipping_details (anyOf 1).phone (anyOf 1)stringAlternativeMaximum length: 5000
body.shipping_details (anyOf 1).phone (anyOf 2)stringAlternativeOne of:
body.shipping_details (anyOf 2)stringAlternativeOne of:
body.statement_descriptorstringOptionalExtra information about a charge for the customer’s credit card statement. It must contain at least one letter. If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item’s product’s `statement_descriptor`.
Maximum length: 22
body.transfer_dataJSONOptionalIf specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice’s charge. This will be unset if you POST an empty value.
body.transfer_data (anyOf 1)objectAlternative
body.transfer_data (anyOf 1).amountintegerOptional
body.transfer_data (anyOf 1).destinationstringRequired within parent
body.transfer_data (anyOf 2)stringAlternativeOne of:

Referenced models: Create an invoice — request body — body payment settings, Create an invoice — request body — body rendering, Create a Checkout Session — request body — body shipping options item

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Pay an invoice — response body

Referenced models: Pay an invoice — response body

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

Create an invoice — request body — body payment settings
FieldTypePresenceDescription and constraints
$objectRootConfiguration settings for the PaymentIntent that is generated when the invoice is finalized.
default_mandateJSONOptional
default_mandate (anyOf 1)stringAlternativeMaximum length: 5000
default_mandate (anyOf 2)stringAlternativeOne of:
payment_method_optionsModelOptionalExpand Create an invoice — request body — body payment settings payment method options
payment_method_typesJSONOptional
payment_method_types (anyOf 1)arrayAlternative
payment_method_types (anyOf 1)[]stringEach itemOne of: ach_credit_transfer, ach_debit, acss_debit, affirm, alipay, amazon_pay, au_becs_debit, bacs_debit, bancontact, billie, blik, boleto, card, cashapp, crypto, custom, customer_balance, eps, fpx, giropay, grabpay, ideal, jp_credit_transfer, kakao_pay, klarna, konbini, kr_card, link, mb_way, multibanco, naver_pay, nz_bank_account, p24, pay_by_bank, payco, paynow, paypal, payto, pix, promptpay, revolut_pay, satispay, sepa_credit_transfer, sepa_debit, sofort, swish, twint, upi, us_bank_account, wechat_pay
payment_method_types (anyOf 2)stringAlternativeOne of:

Referenced models: Create an invoice — request body — body payment settings payment method options

Create an invoice — request body — body rendering
FieldTypePresenceDescription and constraints
$objectRootThe rendering-related settings that control how invoices render in customer-facing interfaces such as the PDF or hosted invoice page.
amount_tax_displaystringOptionalOne of: , exclude_tax, include_inclusive_tax
pdfobjectOptional
pdf.page_sizestringOptionalOne of: a4, auto, letter
templatestringOptionalMaximum length: 5000
template_versionJSONOptional
template_version (anyOf 1)integerAlternative
template_version (anyOf 2)stringAlternativeOne of:
Create a Checkout Session — request body — body shipping options item
FieldTypePresenceDescription and constraints
$objectRoot
shipping_ratestringOptionalMaximum length: 5000
shipping_rate_dataModelOptionalExpand Create an invoice — request body — body shipping cost shipping rate data

Referenced models: Create an invoice — request body — body shipping cost shipping rate data

Create a Location — response body — address
FieldTypePresenceDescription and constraints
$objectRoot
cityJSONOptional
city (anyOf 1)stringAlternativeCity, district, suburb, town, or village.
Maximum length: 5000
city (anyOf 2)nullAlternative
countryJSONOptional
country (anyOf 1)stringAlternativeTwo-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
Maximum length: 5000
country (anyOf 2)nullAlternative
line1JSONOptional
line1 (anyOf 1)stringAlternativeAddress line 1, such as the street, PO Box, or company name.
Maximum length: 5000
line1 (anyOf 2)nullAlternative
line2JSONOptional
line2 (anyOf 1)stringAlternativeAddress line 2, such as the apartment, suite, unit, or building.
Maximum length: 5000
line2 (anyOf 2)nullAlternative
postal_codeJSONOptional
postal_code (anyOf 1)stringAlternativeZIP or postal code.
Maximum length: 5000
postal_code (anyOf 2)nullAlternative
stateJSONOptional
state (anyOf 1)stringAlternativeState, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
Maximum length: 5000
state (anyOf 2)nullAlternative
Cancel a SetupIntent — response body — last_setup_error / value / type: api error, card error, idempotency error, invalid request error
FieldTypePresenceDescription and constraints
$objectRoot
advice_codestringOptionalFor card errors resulting from a card issuer decline, a short string indicating [how to proceed with an error](https://docs.stripe.com/declines/card#retrying-issuer-declines) if they provide one.
Maximum length: 5000
chargestringOptionalFor card errors, the ID of the failed charge.
Maximum length: 5000
codestringOptionalFor some errors that could be handled programmatically, a short string indicating the [error code](https://docs.stripe.com/error-codes) reported.
Maximum length: 5000
decline_codestringOptionalFor card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://docs.stripe.com/declines#issuer-declines) if they provide one.
Maximum length: 5000
doc_urlstringOptionalA URL to more information about the [error code](https://docs.stripe.com/error-codes) reported.
Maximum length: 5000
messagestringOptionalA human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
Maximum length: 40000
network_advice_codestringOptionalFor card errors resulting from a card issuer decline, a 2 digit code which indicates the advice given to merchant by the card network on how to proceed with an error.
Maximum length: 5000
network_decline_codestringOptionalFor payments declined by the network, an alphanumeric code which indicates the reason the payment failed.
Maximum length: 5000
paramstringOptionalIf the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.
Maximum length: 5000
payment_intentModelOptionalExpand Cancel a Payment Intent — response body
payment_methodModelOptionalExpand Create a Payment Method — response body
payment_method_typestringOptionalIf the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors.
Maximum length: 5000
request_log_urlstringOptionalA URL to the request log entry in your dashboard.
Maximum length: 5000
setup_intentModelOptionalExpand Cancel a Setup Intent — response body
sourceJSONOptionalThe [source object](https://docs.stripe.com/api/sources/object) for errors returned on a request involving a source.
source (anyOf 1)ModelAlternativeExpand Retrieve a bank account — response body
source (anyOf 2)ModelAlternativeExpand Retrieve a card — customers get Customers Customer Cards Id — response body
source (anyOf 3)ModelAlternativeExpand Create a source — response body
typestringRequired within parentThe type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error`
Known values: api_error, card_error, idempotency_error, invalid_request_error

Referenced models: Retrieve a bank account — response body, Retrieve a card — customers get Customers Customer Cards Id — response body, Cancel a Payment Intent — response body, Create a Payment Method — response body, Cancel a Setup Intent — response body, Create a source — response body

PostApplicationFeesIdRefund — response body — application / object: application
FieldTypePresenceDescription and constraints
$objectRoot
idstringRequired within parentUnique identifier for the object.
Maximum length: 5000
nameJSONOptional
name (anyOf 1)stringAlternativeThe name of the application.
Maximum length: 5000
name (anyOf 2)nullAlternative
objectstringRequired within parentString representing the object's type. Objects of the same type share the same value.
Known values: application
Pay an invoice — response body — issuer
FieldTypePresenceDescription and constraints
$objectRoot
accountJSONOptionalThe connected account being referenced when `type` is `account`.
account (anyOf 1)stringAlternativeMaximum length: 5000
account (anyOf 2)ModelAlternativeExpand Create an account — response body
typestringRequired within parentType of the account referenced.
Known values: account, self

Referenced models: Create an account — response body

Pay an invoice — response body — custom fields Custom fields displayed on the invoice item
FieldTypePresenceDescription and constraints
$objectRoot
namestringRequired within parentThe name of the custom field.
Maximum length: 5000
valuestringRequired within parentThe value of the custom field.
Maximum length: 5000

SDK function policy ID: stripe.postinvoicesinvoice. Catalog operation: PostInvoicesInvoice. 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.