DashForDevsDocs
DocsNewsAPI v1
dashfordevs.comSign in

© 2026 DashForDevs

DocsNewsdashfordevs.comLegalStatus
DocsDiscountsAffiliate Codes
Introduction
Getting Started
Authentication
Products
Categories
Cart
Checkout
Blog
Reviews
Webhooks
Customers
Orders
Inventory
Shipping
Discounts
Discount CodesAffiliate CodesBulk PricingValidate Code
Affiliates
Email
Media & Files
Analytics & Tracking
Locations
Tax
Global Data
SEO
Error Handling
Geography
Finance
Automations
Page Types
Surveys
Billing & Subscriptions
Storefront Payments
SDK Reference
REST API
Storefront Architecture
Notifications
Security
Team & Permissions
Migrations & Import
Calendar & Appointments
Contact Forms
AI Bots
Dashboard API
Deployment
Changelog
Troubleshooting
Recipes
CLI & Deployment
Image Pipeline
White-label Platforms
Records Engine
Platform Modules
Platform Security
Site Keys & Client Sites
Use Cases
Operations

Affiliate Codes

Discount codes tied to affiliate partners.

Updated March 29, 2026

On this page
  • Overview
  • How It Works
  • Creating Affiliate Codes
  • Applying Affiliate Codes
  • Next Steps

Overview

Affiliates can create their own discount codes that are linked to their affiliate account. When a customer uses an affiliate code, the affiliate earns a commission.

How It Works

  1. An approved affiliate creates a code from their affiliate dashboard
  2. The affiliate shares the code with potential customers
  3. A customer applies the code at checkout
  4. The affiliate earns commission on the sale

Creating Affiliate Codes

typescript
import dash from "@/lib/dash"

// Authenticated as an approved affiliate
const { success, discount_code } = await dash.affiliates.createCode({
  code: "JOHNS-CODE",  // 3-50 chars, alphanumeric + hyphens/underscores
})

Applying Affiliate Codes

From the customer's perspective, affiliate codes work exactly like regular discount codes:

typescript
await dash.cart.applyDiscount("JOHNS-CODE")

Next Steps

  • Affiliate Registration — Becoming an affiliate
  • Commission Tiers — Affiliate commission structure
  • Discount Codes — General discount codes
PreviousDiscount CodesNextBulk Pricing

On this page

  • Overview
  • How It Works
  • Creating Affiliate Codes
  • Applying Affiliate Codes
  • Next Steps