Skip to main content
Dub

discount_code.created

2 min read

Occurs whenever a discount code is created for a partner.

Tip

This event is sent when a discount code is created via the API, the dashboard, or auto-provisioning when a partner joins a group.

If the discount uses the custom provider, listen to this webhook to create the corresponding promo code in your own system. For Stripe and Shopify discounts, Dub creates the code in the connected provider automatically.

Response body parameters

All webhook payloads follow a consistent top-level structure with event-specific data nested within the data object.

idstring#
The event ID.
eventstring#
The event type that triggered the webhook (e.g., discount_code.created).
createdAtstring#
ISO 8601 timestamp when the webhook event was created.
dataobject#
Event-specific data containing detailed information about the event. The data object for the discount_code.created event contains the following parameters:
Show object parameters
idstring#

Unique identifier for the discount code (e.g. dcode_...).

codestring#

The alphanumeric discount code customers can apply at checkout.

partnerIdstring#

ID of the partner this discount code is assigned to.

linkIdstring#

ID of the partner's referral link this discount code is associated with.

disabledAtstring | null#

ISO 8601 timestamp when the code was disabled, or null if it is active.

discountobject | null#

The discount this code belongs to.

Show discount object
idstring#

Unique identifier for the discount.

amountnumber#

Discount amount. For percentage discounts this is the percent off (e.g. 10 = 10% off). For flat discounts this is the amount in cents (e.g. 500 = $5.00).

typestring#

Discount type: percentage or flat.

maxDurationnumber | null#

Maximum duration in months. 0 is one-time, null is lifetime.

providerstring#

Discount provider: stripe, shopify, or custom.