Skip to content
Proud to collaborate with Microsoft for Startups

stripe.promotion_codes.create_code ​

Create a Stripe promotion code for an existing coupon

Create the string a shopper actually types at checkout, pointing at an existing coupon. Omit code and Stripe generates one.

Acts on the CUSTOMER'S OWN Stripe account, authenticated via the org-scoped Stripe connection selected by cloud_connection_uuid.

Inputs:

  • cloud_connection_uuid: Org-scoped Stripe connection (customer's own account).
  • coupon_id: Coupon this code applies.
  • code: Customer-facing code (generated when omitted) (optional).
  • max_redemptions: How many times this code can be used (optional).
  • expires_at: Unix timestamp after which the code stops working (optional).
  • active: Whether the code is usable (default: true) (optional).

Outputs (terminal state_data):

  • promotion_code_id: str
  • code: str
  • coupon_id: str
  • active: bool

Connection required: cloud_connection_uuid — the organization's own Stripe account credentials; there is no platform-key fallback.

Overview ​

PropertyValue
Workflow typeAtomic
LibraryApp-stripe
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
cloud_connection_uuiduuidYes—Org-scoped Stripe connection (customer's own account)
coupon_idstringYes—Coupon this code applies
codestringNo—Customer-facing code (generated when omitted)
max_redemptionsintegerNo—How many times this code can be used
expires_atintegerNo—Unix timestamp after which the code stops working
activebooleanNo—Whether the code is usable (default: true)

Output Schema ​

FieldTypeRequiredDefaultDescription
promotion_code_idstringNo——
codestringNo——
coupon_idstringNo——
activebooleanNo——
cloud_connection_uuiduuidNo——
max_redemptionsintegerNo——
expires_atintegerNo——
failure_reasonstringNo——
failure_typestringNo——
failed_actionstringNo——
failed_at_statestringNo——
failed_stepstringNo——
errorstringNo——
error_typestringNo——
failed_layerintegerNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—execute—
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
pendingexecutecompleted—
* (any state)failfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "stripe.promotion_codes.create_code",
  "initial_data": {
    "cloud_connection_uuid": "value",
    "coupon_id": "value"
  }
}