Affiliate Codes
Discount codes tied to affiliate partners.
Updated
On this page
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
- An approved affiliate creates a code from their affiliate dashboard
- The affiliate shares the code with potential customers
- A customer applies the code at checkout
- The affiliate earns commission on the sale
Creating Affiliate Codes
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:
await dash.cart.applyDiscount("JOHNS-CODE")
Next Steps
- Affiliate Registration — Becoming an affiliate
- Commission Tiers — Affiliate commission structure
- Discount Codes — General discount codes