Create a promotion code

Changed on

A promotion code points to an underlying promotion. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.

post/v1/promotion_codes

Request

  • Base URL: https://api.stripe.com
  • URL: https://api.stripe.com/v1/promotion_codes
  • Auth: one of:
    • HTTP basic
    • HTTP bearer

Request body application/x-www-form-urlencoded

activeboolean

Whether the promotion code is currently active.

codestring

The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), digits (0-9), and dashes (-).

If left blank, we will generate one automatically.

customerstring

The customer who can use this promotion code. If not set, all customers can use the promotion code.

customer_accountstring

The account representing the customer who can use this promotion code. If not set, all customers can use the promotion code.

expandstring[]

Specifies which fields in the response should be expanded.

expires_atinteger

The timestamp at which this promotion code will expire. If the coupon has specified a redeems_by, then this value cannot be after the coupon's redeems_by.

max_redemptionsinteger

A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a max_redemptions, then this value cannot be greater than the coupon's max_redemptions.

metadataobject

Set of key-value pairs 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.

Response

Successful response.

activeboolean required

Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid.

codestring required

The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), digits (0-9), and dashes (-).

createdinteger required

Time at which the object was created. Measured in seconds since the Unix epoch.

customer_accountstring nullable

The account representing the customer who can use this promotion code.

expires_atinteger nullable

Date at which the promotion code can no longer be redeemed.

idstring required

Unique identifier for the object.

livemodeboolean required

If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.

max_redemptionsinteger nullable

Maximum number of times this promotion code can be redeemed.

metadataobject nullable

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

object'promotion_code' required

String representing the object's type. Objects of the same type share the same value.

times_redeemedinteger required

Number of times this promotion code has been used.

Changes

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ////////// to the response with the status

Some revisions have not been checked yet.