Public preview
Adds support for script coupons Public preview
What’s new
You can now customize business logic on Stripe using scripts. With scripts, you can define custom logic expressed as code that runs on our infrastructure, extending Stripe’s core functionality. Use scripts to customize business login on Stripe logic using Stripe’s Coupon object. Currently, you can only associate a script with this specific type of object.
Custom discounting logic
To support the customization of discounting logic with scripts, we added a new script parameter on the Coupon create method. With this new parameter, you can configure a Coupon to use the custom discounting logic.
The script parameter has two required nested parameters: id and configuration. id is the script ID and configuration is any input parameter to the script.
The following example illustrates how to set up a coupon that gives the buyer 20% off up to 100 USD:
Command Line
Select a language
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
Changes
| Parameter | Change | Resources or endpoints |
|---|---|---|
| script | Added | Coupon#create Coupon |
Upgrade
- View your current API version in Workbench.
- If you use an SDK, upgrade to the corresponding SDK version for this API version.
- If you don’t use an SDK, update your API requests to include Stripe-Version: 2025-04-30. preview
- Upgrade the API version used for webhook endpoints .
- Test your integration against the new version.
- If you use Connect, test your Connect integration .
- In Workbench, perform the upgrade . You can roll back the version for 72 hours.
Learn more about Stripe API upgrades.
