Skip to content

Stripe: Create a webhook endpoint

Stripe webhookEndpoints.postWebhookEndpoints: arguments, response, policy and SDK examples.

← Webhook endpoints operations · Get started

Operation stripe.postwebhookendpoints

Provider route: POST /v1/webhook_endpoints. 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["webhookEndpoints"]["postWebhookEndpoints"]>[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.webhookEndpoints.postWebhookEndpoints(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.webhook_endpoints.post_webhook_endpoints(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
headersobjectOptionalAdditional keys: not allowed
headers.Idempotency-KeystringOptionalMinimum length: 1
Maximum length: 255
bodyobjectRequired within parentAdditional keys: not allowed
body.api_versionstringOptionalEvents sent to this endpoint will be generated with this Stripe Version instead of your account’s default Stripe Version.
One of: 2011-01-01, 2011-06-21, 2011-06-28, 2011-08-01, 2011-09-15, 2011-11-17, 2012-02-23, 2012-03-25, 2012-06-18, 2012-06-28, 2012-07-09, 2012-09-24, 2012-10-26, 2012-11-07, 2013-02-11, 2013-02-13, 2013-07-05, 2013-08-12, 2013-08-13, 2013-10-29, 2013-12-03, 2014-01-31, 2014-03-13, 2014-03-28, 2014-05-19, 2014-06-13, 2014-06-17, 2014-07-22, 2014-07-26, 2014-08-04, 2014-08-20, 2014-09-08, 2014-10-07, 2014-11-05, 2014-11-20, 2014-12-08, 2014-12-17, 2014-12-22, 2015-01-11, 2015-01-26, 2015-02-10, 2015-02-16, 2015-02-18, 2015-03-24, 2015-04-07, 2015-06-15, 2015-07-07, 2015-07-13, 2015-07-28, 2015-08-07, 2015-08-19, 2015-09-03, 2015-09-08, 2015-09-23, 2015-10-01, 2015-10-12, 2015-10-16, 2016-02-03, 2016-02-19, 2016-02-22, 2016-02-23, 2016-02-29, 2016-03-07, 2016-06-15, 2016-07-06, 2016-10-19, 2017-01-27, 2017-02-14, 2017-04-06, 2017-05-25, 2017-06-05, 2017-08-15, 2017-12-14, 2018-01-23, 2018-02-05, 2018-02-06, 2018-02-28, 2018-05-21, 2018-07-27, 2018-08-23, 2018-09-06, 2018-09-24, 2018-10-31, 2018-11-08, 2019-02-11, 2019-02-19, 2019-03-14, 2019-05-16, 2019-08-14, 2019-09-09, 2019-10-08, 2019-10-17, 2019-11-05, 2019-12-03, 2020-03-02, 2020-08-27, 2022-08-01, 2022-11-15, 2023-08-16, 2023-10-16, 2024-04-10, 2024-06-20, 2024-09-30.acacia, 2024-10-28.acacia, 2024-11-20.acacia, 2024-12-18.acacia, 2025-01-27.acacia, 2025-02-24.acacia, 2025-03-01.dashboard, 2025-03-31.basil, 2025-04-30.basil, 2025-05-28.basil, 2025-06-30.basil, 2025-07-30.basil, 2025-08-27.basil, 2025-09-30.clover, 2025-10-29.clover, 2025-11-17.clover, 2025-12-15.clover, 2026-01-28.clover, 2026-02-25.clover, 2026-03-25.dahlia, 2026-04-22.dahlia, 2026-05-27.dahlia, 2026-06-24.dahlia, 2026-07-29.dahlia, 2026-08-26.dahlia, 2026-09-30.endive
Maximum length: 5000
body.connectbooleanOptionalWhether this endpoint should receive events from connected accounts (`true`), or from your account (`false`). Defaults to `false`.
body.descriptionJSONOptionalAn optional description of what the webhook is used for.
body.description (anyOf 1)stringAlternativeMaximum length: 5000
body.description (anyOf 2)stringAlternativeOne of:
body.enabled_eventsarrayRequired within parentThe list of events to enable for this endpoint. You may specify `[’*’]` to enable all events, except those that require explicit selection.
body.enabled_events[]stringEach itemOne of: *, account.application.authorized, account.application.deauthorized, account.external_account.created, account.external_account.deleted, account.external_account.updated, account.updated, application_fee.created, application_fee.refund.updated, application_fee.refunded, apps.install.created, apps.install.deleted, apps.install.updated, balance.available, balance_settings.updated, billing.alert.triggered, billing.credit_balance_transaction.created, billing.credit_grant.created, billing.credit_grant.updated, billing.meter.created, billing.meter.deactivated, billing.meter.reactivated, billing.meter.updated, billing_portal.configuration.created, billing_portal.configuration.updated, billing_portal.session.created, capability.updated, cash_balance.funds_available, charge.captured, charge.dispute.closed, charge.dispute.created, charge.dispute.funds_reinstated, charge.dispute.funds_withdrawn, charge.dispute.updated, charge.expired, charge.failed, charge.pending, charge.refund.updated, charge.refunded, charge.succeeded, charge.updated, checkout.session.async_payment_failed, checkout.session.async_payment_succeeded, checkout.session.completed, checkout.session.expired, climate.order.canceled, climate.order.created, climate.order.delayed, climate.order.delivered, climate.order.product_substituted, climate.product.created, climate.product.pricing_updated, coupon.created, coupon.deleted, coupon.updated, credit_note.created, credit_note.updated, credit_note.voided, customer.created, customer.deleted, customer.discount.created, customer.discount.deleted, customer.discount.updated, customer.source.created, customer.source.deleted, customer.source.expiring, customer.source.updated, customer.subscription.created, customer.subscription.deleted, customer.subscription.paused, customer.subscription.pending_update_applied, customer.subscription.pending_update_expired, customer.subscription.resumed, customer.subscription.trial_will_end, customer.subscription.updated, customer.tax_id.created, customer.tax_id.deleted, customer.tax_id.updated, customer.updated, customer_cash_balance_transaction.created, entitlements.active_entitlement_summary.updated, file.created, financial_connections.account.account_numbers_updated, financial_connections.account.created, financial_connections.account.deactivated, financial_connections.account.disconnected, financial_connections.account.expected_deactivation_date_updated, financial_connections.account.reactivated, financial_connections.account.refreshed_balance, financial_connections.account.refreshed_ownership, financial_connections.account.refreshed_transactions, financial_connections.account.supported_payment_method_types_updated, financial_connections.account.upcoming_account_number_expiry, financial_connections.account.upcoming_deactivation, financial_connections.authorization.expected_deactivation_date_updated, financial_connections.authorization.upcoming_deactivation, identity.verification_session.canceled, identity.verification_session.created, identity.verification_session.processing, identity.verification_session.redacted, identity.verification_session.requires_input, identity.verification_session.verified, invoice.created, invoice.deleted, invoice.finalization_failed, invoice.finalized, invoice.marked_uncollectible, invoice.overdue, invoice.overpaid, invoice.paid, invoice.payment_action_required, invoice.payment_attempt_required, invoice.payment_failed, invoice.payment_succeeded, invoice.sent, invoice.upcoming, invoice.updated, invoice.voided, invoice.will_be_due, invoice_payment.paid, invoiceitem.created, invoiceitem.deleted, issuing_authorization.created, issuing_authorization.request, issuing_authorization.updated, issuing_card.created, issuing_card.updated, issuing_cardholder.created, issuing_cardholder.updated, issuing_dispute.closed, issuing_dispute.created, issuing_dispute.funds_reinstated, issuing_dispute.funds_rescinded, issuing_dispute.submitted, issuing_dispute.updated, issuing_personalization_design.activated, issuing_personalization_design.deactivated, issuing_personalization_design.rejected, issuing_personalization_design.updated, issuing_token.created, issuing_token.updated, issuing_transaction.created, issuing_transaction.purchase_details_receipt_updated, issuing_transaction.updated, mandate.updated, payment_intent.amount_capturable_updated, payment_intent.canceled, payment_intent.created, payment_intent.partially_funded, payment_intent.payment_failed, payment_intent.processing, payment_intent.requires_action, payment_intent.succeeded, payment_link.created, payment_link.updated, payment_method.attached, payment_method.automatically_updated, payment_method.detached, payment_method.updated, payout.canceled, payout.created, payout.failed, payout.paid, payout.reconciliation_completed, payout.updated, person.created, person.deleted, person.updated, plan.created, plan.deleted, plan.updated, price.created, price.deleted, price.updated, product.created, product.deleted, product.updated, promotion_code.created, promotion_code.updated, quote.accepted, quote.canceled, quote.created, quote.finalized, radar.early_fraud_warning.created, radar.early_fraud_warning.updated, refund.created, refund.failed, refund.updated, reporting.report_run.failed, reporting.report_run.succeeded, reporting.report_type.updated, reserve.hold.created, reserve.hold.updated, reserve.plan.created, reserve.plan.disabled, reserve.plan.expired, reserve.plan.updated, reserve.release.created, review.closed, review.opened, setup_intent.canceled, setup_intent.created, setup_intent.requires_action, setup_intent.setup_failed, setup_intent.succeeded, sigma.scheduled_query_run.created, source.canceled, source.chargeable, source.failed, source.mandate_notification, source.refund_attributes_required, source.transaction.created, source.transaction.updated, subscription_schedule.aborted, subscription_schedule.canceled, subscription_schedule.completed, subscription_schedule.created, subscription_schedule.expiring, subscription_schedule.released, subscription_schedule.updated, tax.settings.updated, tax_rate.created, tax_rate.updated, terminal.reader.action_failed, terminal.reader.action_succeeded, terminal.reader.action_updated, test_helpers.test_clock.advancing, test_helpers.test_clock.created, test_helpers.test_clock.deleted, test_helpers.test_clock.internal_failure, test_helpers.test_clock.ready, topup.canceled, topup.created, topup.failed, topup.reversed, topup.succeeded, transfer.created, transfer.reversed, transfer.updated, treasury.credit_reversal.created, treasury.credit_reversal.posted, treasury.debit_reversal.completed, treasury.debit_reversal.created, treasury.debit_reversal.initial_credit_granted, treasury.financial_account.closed, treasury.financial_account.created, treasury.financial_account.features_status_updated, treasury.inbound_transfer.canceled, treasury.inbound_transfer.created, treasury.inbound_transfer.failed, treasury.inbound_transfer.succeeded, treasury.outbound_payment.canceled, treasury.outbound_payment.created, treasury.outbound_payment.expected_arrival_date_updated, treasury.outbound_payment.failed, treasury.outbound_payment.posted, treasury.outbound_payment.returned, treasury.outbound_payment.tracking_details_updated, treasury.outbound_transfer.canceled, treasury.outbound_transfer.created, treasury.outbound_transfer.expected_arrival_date_updated, treasury.outbound_transfer.failed, treasury.outbound_transfer.posted, treasury.outbound_transfer.returned, treasury.outbound_transfer.tracking_details_updated, treasury.received_credit.created, treasury.received_credit.failed, treasury.received_credit.succeeded, treasury.received_debit.created
body.expandarrayOptionalSpecifies which fields in the response should be expanded.
body.expand[]stringEach itemMaximum length: 5000
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.urlstringRequired within parentThe URL of the webhook endpoint.

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

FieldTypePresenceDescription and constraints
$ModelRootExpand Create a webhook endpoint — response body

Referenced models: Create a webhook endpoint — response body

Create a webhook endpoint — response body
FieldTypePresenceDescription and constraints
$objectRootYou can configure [webhook endpoints](https://docs.stripe.com/webhooks/) via the API to be
notified about events that happen in your Stripe account or connected
accounts.

Most users configure webhooks from [the dashboard](https://dashboard.stripe.com/webhooks), which provides a user interface for registering and testing your webhook endpoints.

Related guide: [Setting up webhooks](https://docs.stripe.com/webhooks/configure)
api_versionJSONOptional
api_version (anyOf 1)stringAlternativeThe API version that events are rendered as for this webhook endpoint. You can't change this value after you create the endpoint.
api_version (anyOf 2)nullAlternative
applicationJSONOptional
application (anyOf 1)stringAlternativeThe ID of the associated Connect application.
Maximum length: 5000
application (anyOf 2)nullAlternative
createdJSONRequired within parent
created (anyOf 1)integerAlternativeTime at which the object was created. Measured in seconds since the Unix epoch.
Format: unix-time
created (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
descriptionJSONOptional
description (anyOf 1)stringAlternativeAn optional description of what the webhook is used for.
Maximum length: 5000
description (anyOf 2)nullAlternative
enabled_eventsarrayRequired within parentThe list of events to enable for this endpoint. `['*']` indicates that all events are enabled, except those that require explicit selection.
enabled_events[]stringEach itemMaximum length: 5000
idstringRequired within parentUnique identifier for the object.
Maximum length: 5000
livemodebooleanRequired within parentIf the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
metadataobjectRequired within parentSet 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.
Additional keys: see wildcard field
metadata.*stringAdditional keysMaximum length: 500
objectstringRequired within parentString representing the object's type. Objects of the same type share the same value.
Known values: webhook_endpoint
secretstringOptionalThe endpoint's secret, used to generate [webhook signatures](https://docs.stripe.com/webhooks/signatures). Only returned at creation.
Maximum length: 5000
statusstringRequired within parentThe status of the webhook. It can be `enabled` or `disabled`.
Maximum length: 5000
urlstringRequired within parentThe URL of the webhook endpoint.
Maximum length: 5000

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