|
| 1 | +--- |
| 2 | +title: discount_code.deleted |
| 3 | +icon: ticket |
| 4 | +--- |
| 5 | + |
| 6 | +import { WebhookResponseBodyParameters } from "/snippets/webhook-response-body-parameters.mdx"; |
| 7 | + |
| 8 | +Event triggered when a [discount code is deleted](/docs/api-reference/discount-codes/delete). |
| 9 | + |
| 10 | +<Tip> |
| 11 | + This event is also sent when a discount code is removed automatically — for |
| 12 | + example when a partner is banned or deactivated, a linked referral link is |
| 13 | + deleted, or a partner is moved to a group without an equivalent discount. |
| 14 | + |
| 15 | +If the discount uses the **custom** provider, listen to this webhook to |
| 16 | +disable the corresponding promo code in your own system. For Stripe |
| 17 | +and Shopify discounts, Dub disables the code in the connected provider |
| 18 | +automatically. |
| 19 | + |
| 20 | +</Tip> |
| 21 | + |
| 22 | +<WebhookResponseBodyParameters type="discount_code.deleted"> |
| 23 | + <ParamField body="id" type="string"> |
| 24 | + Unique identifier for the discount code (e.g. <code>dcode_...</code>). |
| 25 | + </ParamField> |
| 26 | + <ParamField body="code" type="string"> |
| 27 | + The alphanumeric discount code that was deleted. |
| 28 | + </ParamField> |
| 29 | + <ParamField body="partnerId" type="string"> |
| 30 | + ID of the partner this discount code was assigned to. |
| 31 | + </ParamField> |
| 32 | + <ParamField body="linkId" type="string"> |
| 33 | + ID of the partner's referral link this discount code was associated with. |
| 34 | + </ParamField> |
| 35 | + <ParamField body="disabledAt" type="string | null"> |
| 36 | + ISO 8601 timestamp when the code was disabled. Set when a partner is banned |
| 37 | + or deactivated; otherwise <code>null</code>. |
| 38 | + </ParamField> |
| 39 | + <ParamField body="discount" type="object | null"> |
| 40 | + The discount this code belonged to. |
| 41 | + |
| 42 | + <Expandable title="discount object"> |
| 43 | + <ParamField body="id" type="string"> |
| 44 | + Unique identifier for the discount. |
| 45 | + </ParamField> |
| 46 | + <ParamField body="amount" type="number"> |
| 47 | + Discount amount. For <code>percentage</code> discounts this is the |
| 48 | + percent off (e.g. <code>10</code> = 10% off). For <code>flat</code> |
| 49 | + discounts this is the amount in cents (e.g. <code>500</code> = $5.00). |
| 50 | + </ParamField> |
| 51 | + <ParamField body="type" type="string"> |
| 52 | + Discount type: <code>percentage</code> or <code>flat</code>. |
| 53 | + </ParamField> |
| 54 | + <ParamField body="maxDuration" type="number | null"> |
| 55 | + Maximum duration in months. <code>0</code> is one-time, |
| 56 | + <code>null</code> is lifetime. |
| 57 | + </ParamField> |
| 58 | + <ParamField body="provider" type="string"> |
| 59 | + Discount provider: <code>stripe</code>, <code>shopify</code>, or |
| 60 | + <code>custom</code>. |
| 61 | + </ParamField> |
| 62 | + </Expandable> |
| 63 | + |
| 64 | + </ParamField> |
| 65 | +</WebhookResponseBodyParameters> |
| 66 | + |
| 67 | +<ResponseExample> |
| 68 | + |
| 69 | +```json Response |
| 70 | +{ |
| 71 | + "id": "evt_64dv6vxYVgltzJBKc9ujJ1ghL", |
| 72 | + "event": "discount_code.deleted", |
| 73 | + "createdAt": "2026-08-19T10:48:15.468Z", |
| 74 | + "data": { |
| 75 | + "id": "dcode_1K39DGZG3MHY9RP4PD0AS2C5P", |
| 76 | + "code": "STEVEN10OFF", |
| 77 | + "partnerId": "pn_1K9BZE1K285BSTX4W6MPKXJFZ", |
| 78 | + "linkId": "link_5myDHLqhIQvUmUPjchVygF9R", |
| 79 | + "disabledAt": null, |
| 80 | + "discount": { |
| 81 | + "id": "disc_1KEC01MXC5H50XQMSN83VCW65", |
| 82 | + "amount": 10, |
| 83 | + "type": "percentage", |
| 84 | + "maxDuration": 6, |
| 85 | + "provider": "custom" |
| 86 | + } |
| 87 | + } |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +</ResponseExample> |
0 commit comments