Stripe: Update a coupon
Stripe coupons.postCouponsCoupon: arguments, response, policy and SDK examples.
← Coupons operations · Get started
Operation stripe.postcouponscoupon
Provider route: POST /v1/coupons/{coupon}. 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["coupons"]["postCouponsCoupon"]>[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.coupons.postCouponsCoupon(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.coupons.post_coupons_coupon(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.coupon | string | Required within parent | Maximum length: 5000 |
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.currency_options | object | Optional | Coupons defined in each available currency option (only supported if the coupon is amount-based). Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). Additional keys: see wildcard field |
body.currency_options.* | object | Additional keys | |
body.currency_options.*.amount_off | integer | Required within parent | |
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.name | string | Optional | Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set. Maximum length: 40 |
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 coupon — response body |
Referenced models: Create a coupon — response body
Schemas
Section titled “Schemas”Create a coupon — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to [subscriptions](https://docs.stripe.com/api#subscriptions), [invoices](https://docs.stripe.com/api#invoices), [checkout sessions](https://docs.stripe.com/api/checkout/sessions), [quotes](https://docs.stripe.com/api#quotes), and more. Coupons do not work with conventional one-off [charges](/api/charges/create) or [payment intents](https://docs.stripe.com/api/payment_intents). |
amount_off | JSON | Optional | |
amount_off (anyOf 1) | JSON | Alternative | |
amount_off (anyOf 1) (anyOf 1) | integer | Alternative | Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer. |
amount_off (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
amount_off (anyOf 2) | null | Alternative | |
applies_to | Model | Optional | Expand Create a coupon — response body — applies to |
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 | JSON | Optional | |
currency (anyOf 1) | string | Alternative | If `amount_off` has been set, the three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the amount to take off. Format: currency |
currency (anyOf 2) | null | Alternative | |
currency_options | object | Optional | Coupons defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). Additional keys: see wildcard field |
currency_options.* | Model | Additional keys | Expand Create a coupon — response body — currency options value |
duration | string | Required within parent | One of `forever`, `once`, or `repeating`. Describes how long a customer who applies this coupon will get the discount. Known values: forever, once, repeating |
duration_in_months | JSON | Optional | |
duration_in_months (anyOf 1) | JSON | Alternative | |
duration_in_months (anyOf 1) (anyOf 1) | integer | Alternative | If `duration` is `repeating`, the number of months the coupon applies. Null if coupon `duration` is `forever` or `once`. |
duration_in_months (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
duration_in_months (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`. |
max_redemptions | JSON | Optional | |
max_redemptions (anyOf 1) | JSON | Alternative | |
max_redemptions (anyOf 1) (anyOf 1) | integer | Alternative | Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid. |
max_redemptions (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
max_redemptions (anyOf 2) | null | Alternative | |
metadata | JSON | Optional | |
metadata (anyOf 1) | object | Alternative | 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. Additional keys: see wildcard field |
metadata (anyOf 1).* | string | Additional keys | Maximum length: 500 |
metadata (anyOf 2) | null | Alternative | |
name | JSON | Optional | |
name (anyOf 1) | string | Alternative | Name of the coupon displayed to customers on for instance invoices or receipts. 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: coupon |
percent_off | JSON | Optional | |
percent_off (anyOf 1) | JSON | Alternative | |
percent_off (anyOf 1) (anyOf 1) | number | Alternative | Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a $ (or local equivalent)100 invoice $ (or local equivalent)50 instead. |
percent_off (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
percent_off (anyOf 2) | null | Alternative | |
redeem_by | JSON | Optional | |
redeem_by (anyOf 1) | JSON | Alternative | |
redeem_by (anyOf 1) (anyOf 1) | integer | Alternative | Date after which the coupon can no longer be redeemed. Format: unix-time |
redeem_by (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
redeem_by (anyOf 2) | null | Alternative | |
times_redeemed | JSON | Required within parent | |
times_redeemed (anyOf 1) | integer | Alternative | Number of times this coupon has been applied to a customer. |
times_redeemed (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
valid | boolean | Required within parent | Taking account of the above properties, whether this coupon can still be applied to a customer. |
Referenced models: Create a coupon — response body — applies to, Create a coupon — response body — currency options value
Create a coupon — response body — applies to
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
products | array | Required within parent | A list of product IDs this coupon applies to |
products[] | string | Each item | Maximum length: 5000 |
Create a coupon — response body — currency options value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
amount_off | JSON | Required within parent | |
amount_off (anyOf 1) | integer | Alternative | Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer. |
amount_off (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: stripe.postcouponscoupon. Catalog operation: PostCouponsCoupon. 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"}