기여도 산정 방식
- 사용자에 대한 제휴사 레코드를 생성한 다음 오버라이드를 추가합니다. 각 오버라이드는
product_direct_link및checkout_direct_link필드를 반환합니다. 이는 제휴사가 공유하는 추천 URL입니다(?a=<username>이 포함됨). - 구매자가 링크를 사용합니다. Whop은 제휴사 쿠키를 저장합니다(기본 기여 기간은 30일).
- 구매자가 기간 내에 결제합니다. 일치하는 오버라이드가 커미션을 계산합니다:
standard(변형별, 비율 또는 고정 수수료) 또는rev_share(수익 비율, 상품별 또는 계정 전체). - Whop은 커미션을 제휴사에 귀속시키고 오버라이드의
total_referral_earnings_usd필드에 반영합니다.
환불 시 커미션이 취소됩니다. 구매자가 기간 내에 환불하면 해당 판매에 대한 제휴사의 수익이 자동으로 회수됩니다.
제휴사 생성하기
user_identifier는 유연하게 확인됩니다. 사용자 이름, 이메일, 사용자 ID 또는 Discord ID를 전달하세요. 해당 계정과 사용자 쌍에 대한 제휴사 레코드가 이미 있으면 Whop은 기존 레코드를 반환합니다(멱등성).
import { WhopClient } from "@whop/sdk";
const client = new WhopClient({ token: process.env.WHOP_API_KEY });
const affiliate = await client.affiliates.create({
account_id: "biz_xxxxxxxxxxxxx",
user_identifier: "johndoe", // username, email, usr_xxx, or Discord ID
});
console.log(`Affiliate ${affiliate.id} created`);
import os
from whop_sdk import Whop
client = Whop(token=os.environ["WHOP_API_KEY"])
affiliate = client.affiliates.create(
account_id="biz_xxxxxxxxxxxxx",
user_identifier="johndoe",
)
print(f"Affiliate {affiliate.id} created")
use whop_sdk::prelude::*;
let config = ClientConfig {
token: Some(std::env::var("WHOP_API_KEY").unwrap()),
..Default::default()
};
let client = Whop::new(config).expect("Failed to build client");
let affiliate = client
.affiliates
.create(
&CreateAffiliatesRequest {
account_id: "biz_xxxxxxxxxxxxx".to_string(),
user_identifier: "johndoe".to_string(), // username, email, usr_xxx, or Discord ID
},
None,
)
.await?;
println!("Affiliate {} created", affiliate.id);
import (
"context"
"fmt"
"log"
"os"
whopsdk "github.com/whopio/whopsdk-go/v2"
"github.com/whopio/whopsdk-go/v2/client"
"github.com/whopio/whopsdk-go/v2/option"
)
client := client.NewWhop(option.WithToken(os.Getenv("WHOP_API_KEY")))
affiliate, err := client.Affiliates.Create(context.TODO(), &whopsdk.CreateAffiliatesRequest{
AccountID: "biz_xxxxxxxxxxxxx",
UserIdentifier: "johndoe", // username, email, usr_xxx, or Discord ID
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Affiliate %s created\n", affiliate.ID)
커미션 오버라이드 추가하기
제휴사 레코드 자체는 커미션을 정의하지 않습니다. 오버라이드를 추가하여 제휴사가 받을 금액을 결정하세요.| 오버라이드 유형 | 기능 | 필수 필드 |
|---|---|---|
standard | 변형별 커미션, 비율 또는 고정 수수료 | plan_id, commission_type, commission_value, applies_to_payments |
rev_share | 비율 기반 수익 공유, 상품별 또는 계정 전체 | commission_value(항상 비율) 및 선택 사항인 product_id |
표준(변형별)
const override = await client.affiliates.overrides.create({
id: affiliate.id,
body: {
id: affiliate.id,
override_type: "standard",
plan_id: "plan_xxxxxxxxxxxxx",
commission_type: "percentage", // "percentage" or "flat_fee"
commission_value: 40, // 40% (or $40 if flat_fee)
applies_to_payments: "first_payment" // "first_payment" or "all_payments"
},
});
// Share these with the affiliate
console.log(override.product_direct_link);
console.log(override.checkout_direct_link);
override = client.affiliates.overrides.create(
affiliate.id,
request={
"override_type": "standard",
"plan_id": "plan_xxxxxxxxxxxxx",
"commission_type": "percentage", # "percentage" or "flat_fee"
"commission_value": 40, # 40% (or $40 if flat_fee)
"applies_to_payments": "first_payment",
},
)
print(override.product_direct_link)
print(override.checkout_direct_link)
let created = client
.affiliates
.overrides
.create(
&"aff_xxxxxxxxxxxxx".to_string(),
// (applies_to_payments, commission_type, commission_value, affiliate_id, plan_id)
&CreateOverridesRequestBody::standard_with_commission_type(
Some(AffiliateAppliesToPayments::FirstPayment),
AffiliatePayoutTypes::Percentage, // percentage or flat_fee
40.0, // 40% (or $40 if flat_fee)
"aff_xxxxxxxxxxxxx".to_string(),
"plan_xxxxxxxxxxxxx".to_string(),
),
None,
)
.await?;
// Share these with the affiliate
println!("{:?}", created.product_direct_link);
println!("{:?}", created.checkout_direct_link);
created, err := client.Affiliates.Overrides.Create(context.TODO(), &affiliates.CreateOverridesRequest{
ID: "aff_xxxxxxxxxxxxx",
Body: &affiliates.CreateOverridesRequestBody{
Standard: &affiliates.CreateOverridesRequestBodyStandard{
ID: "aff_xxxxxxxxxxxxx",
PlanID: "plan_xxxxxxxxxxxxx",
CommissionType: whopsdk.AffiliatePayoutTypesPercentage.Ptr(), // percentage or flat_fee
CommissionValue: 40, // 40% (or $40 if flat_fee)
AppliesToPayments: whopsdk.AffiliateAppliesToPaymentsFirstPayment.Ptr(),
},
},
})
if err != nil {
log.Fatal(err)
}
// Share these with the affiliate
fmt.Println(*created.ProductDirectLink)
fmt.Println(*created.CheckoutDirectLink)
commission_value 규칙:
"percentage": 1–100 사이의 정수(40= 40%)."flat_fee": 달러 금액(10= $10).
applies_to_payments:
"first_payment": 제휴사는 최초 구매에 대해서만 수익을 받습니다."all_payments": 제휴사는 모든 반복 결제에 대해서도 수익을 받습니다.
수익 공유(수익 비율)
수익 공유 오버라이드는 항상 비율 기반입니다.commission_type: "flat_fee"를 전달하지 마세요.
// Product-specific: affiliate earns 30% on sales of this product
await client.affiliates.overrides.create({
id: affiliate.id,
body: {
id: affiliate.id,
override_type: "rev_share",
product_id: "prod_xxxxxxxxxxxxx",
commission_value: 30,
},
});
// Account-wide: affiliate earns 15% on every product
await client.affiliates.overrides.create({
id: affiliate.id,
body: {
id: affiliate.id,
override_type: "rev_share",
commission_value: 15,
},
});
# Product-specific: affiliate earns 30% on sales of this product
client.affiliates.overrides.create(
affiliate.id,
request={
"override_type": "rev_share",
"product_id": "prod_xxxxxxxxxxxxx",
"commission_value": 30,
},
)
# Account-wide: affiliate earns 15% on every product
client.affiliates.overrides.create(
affiliate.id,
request={
"override_type": "rev_share",
"commission_value": 15,
},
)
// Product-specific: affiliate earns 30% on sales of this product
client
.affiliates
.overrides
.create(
&"aff_xxxxxxxxxxxxx".to_string(),
// (commission_type, commission_value, affiliate_id, product_id, revenue_basis)
&CreateOverridesRequestBody::rev_share_with_product_id(
None,
30.0,
"aff_xxxxxxxxxxxxx".to_string(),
"prod_xxxxxxxxxxxxx".to_string(),
None,
),
None,
)
.await?;
// Account-wide: affiliate earns 15% on every product
client
.affiliates
.overrides
.create(
&"aff_xxxxxxxxxxxxx".to_string(),
&CreateOverridesRequestBody::rev_share(15.0, "aff_xxxxxxxxxxxxx".to_string()),
None,
)
.await?;
// Product-specific: affiliate earns 30% on sales of this product
_, err := client.Affiliates.Overrides.Create(context.TODO(), &affiliates.CreateOverridesRequest{
ID: "aff_xxxxxxxxxxxxx",
Body: &affiliates.CreateOverridesRequestBody{
RevShare: &affiliates.CreateOverridesRequestBodyRevShare{
ID: "aff_xxxxxxxxxxxxx",
ProductID: whopsdk.String("prod_xxxxxxxxxxxxx"),
CommissionValue: 30,
},
},
})
if err != nil {
log.Fatal(err)
}
// Account-wide: affiliate earns 15% on every product
_, err = client.Affiliates.Overrides.Create(context.TODO(), &affiliates.CreateOverridesRequest{
ID: "aff_xxxxxxxxxxxxx",
Body: &affiliates.CreateOverridesRequestBody{
RevShare: &affiliates.CreateOverridesRequestBodyRevShare{
ID: "aff_xxxxxxxxxxxxx",
CommissionValue: 15,
},
},
})
if err != nil {
log.Fatal(err)
}
오버라이드 관리하기
// List all overrides for an affiliate
const overrides = await client.affiliates.overrides.list({ id: "aff_xxxxxxxxxxxxx" });
// Filter by type
const standardOnly = await client.affiliates.overrides.list({
id: "aff_xxxxxxxxxxxxx",
override_type: "standard",
});
// Retrieve one
const o = await client.affiliates.overrides.retrieve({
id: "aff_xxxxxxxxxxxxx",
override_id: "aovr_xxxxxxxxxxxxx",
});
// Update
await client.affiliates.overrides.update({
id: "aff_xxxxxxxxxxxxx",
override_id: "aovr_xxxxxxxxxxxxx",
commission_value: 50,
applies_to_payments: "all_payments",
});
// Delete (for standard overrides, this also removes the affiliate from that variant)
await client.affiliates.overrides.delete({
id: "aff_xxxxxxxxxxxxx",
override_id: "aovr_xxxxxxxxxxxxx",
});
# List all overrides for an affiliate
overrides = client.affiliates.overrides.list("aff_xxxxxxxxxxxxx")
# Filter by type
standard_only = client.affiliates.overrides.list(
"aff_xxxxxxxxxxxxx",
override_type="standard",
)
# Retrieve one
o = client.affiliates.overrides.retrieve("aff_xxxxxxxxxxxxx", "aovr_xxxxxxxxxxxxx")
# Update
client.affiliates.overrides.update(
"aff_xxxxxxxxxxxxx",
"aovr_xxxxxxxxxxxxx",
commission_value=50,
applies_to_payments="all_payments",
)
# Delete (for standard overrides, this also removes the affiliate from that variant)
client.affiliates.overrides.delete("aff_xxxxxxxxxxxxx", "aovr_xxxxxxxxxxxxx")
// List all overrides for an affiliate
let overrides = client
.affiliates
.overrides
.list(
&"aff_xxxxxxxxxxxxx".to_string(),
&AffiliatesOverridesListQueryRequest::default(),
None,
)
.await?;
// Filter by type
let standard_only = client
.affiliates
.overrides
.list(
&"aff_xxxxxxxxxxxxx".to_string(),
&AffiliatesOverridesListQueryRequest {
override_type: Some(AffiliateOverrideRoles::Standard),
..Default::default()
},
None,
)
.await?;
// Retrieve one
let single = client
.affiliates
.overrides
.retrieve(
&"aff_xxxxxxxxxxxxx".to_string(),
&"aovr_xxxxxxxxxxxxx".to_string(),
None,
)
.await?;
// Update
client
.affiliates
.overrides
.update(
&"aff_xxxxxxxxxxxxx".to_string(),
&"aovr_xxxxxxxxxxxxx".to_string(),
&UpdateOverridesRequest {
commission_value: Some(50.0),
applies_to_payments: Some(AffiliateAppliesToPayments::AllPayments),
..Default::default()
},
None,
)
.await?;
// Delete (for standard overrides, this also removes the affiliate from that variant)
client
.affiliates
.overrides
.delete(
&"aff_xxxxxxxxxxxxx".to_string(),
&"aovr_xxxxxxxxxxxxx".to_string(),
None,
)
.await?;
// List all overrides for an affiliate
overridesList, err := client.Affiliates.Overrides.List(context.TODO(), &affiliates.ListOverridesRequest{
ID: "aff_xxxxxxxxxxxxx",
})
if err != nil {
log.Fatal(err)
}
_ = overridesList
// Filter by type
standardOnly, err := client.Affiliates.Overrides.List(context.TODO(), &affiliates.ListOverridesRequest{
ID: "aff_xxxxxxxxxxxxx",
OverrideType: whopsdk.AffiliateOverrideRolesStandard.Ptr(),
})
if err != nil {
log.Fatal(err)
}
_ = standardOnly
// Retrieve one
single, err := client.Affiliates.Overrides.Retrieve(context.TODO(), &affiliates.RetrieveOverridesRequest{
ID: "aff_xxxxxxxxxxxxx",
OverrideID: "aovr_xxxxxxxxxxxxx",
})
if err != nil {
log.Fatal(err)
}
_ = single
// Update
_, err = client.Affiliates.Overrides.Update(context.TODO(), &affiliates.UpdateOverridesRequest{
ID: "aff_xxxxxxxxxxxxx",
OverrideID: "aovr_xxxxxxxxxxxxx",
CommissionValue: whopsdk.Float64(50),
AppliesToPayments: whopsdk.AffiliateAppliesToPaymentsAllPayments.Ptr(),
})
if err != nil {
log.Fatal(err)
}
// Delete (for standard overrides, this also removes the affiliate from that variant)
_, err = client.Affiliates.Overrides.Delete(context.TODO(), &affiliates.DeleteOverridesRequest{
ID: "aff_xxxxxxxxxxxxx",
OverrideID: "aovr_xxxxxxxxxxxxx",
})
if err != nil {
log.Fatal(err)
}
제휴사 관리하기
// List, optionally filtered by status. The page is async-iterable and
// fetches the next page for you as you consume it.
const affiliates = await client.affiliates.list({
account_id: "biz_xxxxxxxxxxxxx",
status: "active",
});
for await (const affiliate of affiliates) {
console.log(affiliate);
}
const single = await client.affiliates.retrieve({ id: "aff_xxxxxxxxxxxxx" });
// Archive blocks the affiliate from earning further commissions
await client.affiliates.archive({ id: "aff_xxxxxxxxxxxxx" });
await client.affiliates.unarchive({ id: "aff_xxxxxxxxxxxxx" });
# List, optionally filtered by status. Iterating the pager fetches
# the next page for you as you consume it.
for affiliate in client.affiliates.list(
account_id="biz_xxxxxxxxxxxxx",
status="active",
):
print(affiliate)
single = client.affiliates.retrieve("aff_xxxxxxxxxxxxx")
# Archive blocks the affiliate from earning further commissions
client.affiliates.archive("aff_xxxxxxxxxxxxx")
client.affiliates.unarchive("aff_xxxxxxxxxxxxx")
// List, optionally filtered by status. Iterate the returned page's `data`.
let affiliates = client
.affiliates
.list(
&AffiliatesListQueryRequest {
account_id: "biz_xxxxxxxxxxxxx".to_string(),
status: Some(Status::Active),
..Default::default()
},
None,
)
.await?;
for affiliate in affiliates.data {
println!("{affiliate:?}");
}
let single = client
.affiliates
.retrieve(&"aff_xxxxxxxxxxxxx".to_string(), None)
.await?;
// Archive blocks the affiliate from earning further commissions
client.affiliates.archive(&"aff_xxxxxxxxxxxxx".to_string(), None).await?;
client.affiliates.unarchive(&"aff_xxxxxxxxxxxxx".to_string(), None).await?;
// List, optionally filtered by status. The page auto-fetches the next page as you iterate.
page, err := client.Affiliates.List(context.TODO(), &whopsdk.ListAffiliatesRequest{
AccountID: "biz_xxxxxxxxxxxxx",
Status: whopsdk.StatusActive.Ptr(),
})
if err != nil {
log.Fatal(err)
}
iter := page.Iterator()
for iter.Next(context.TODO()) {
fmt.Println(iter.Current())
}
if err := iter.Err(); err != nil {
log.Fatal(err)
}
single, err := client.Affiliates.Retrieve(context.TODO(), &whopsdk.RetrieveAffiliatesRequest{
ID: "aff_xxxxxxxxxxxxx",
})
if err != nil {
log.Fatal(err)
}
_ = single
// Archive blocks the affiliate from earning further commissions
if _, err := client.Affiliates.Archive(context.TODO(), &whopsdk.ArchiveAffiliatesRequest{ID: "aff_xxxxxxxxxxxxx"}); err != nil {
log.Fatal(err)
}
if _, err := client.Affiliates.Unarchive(context.TODO(), &whopsdk.UnarchiveAffiliatesRequest{ID: "aff_xxxxxxxxxxxxx"}); err != nil {
log.Fatal(err)
}
계정 수준 제휴사 설정
세 가지 계정 필드가 Whop이 사용자에게 제휴 프로그램을 표시하는 방식을 제어합니다. Account 리소스를 통해 업데이트하세요.await client.accounts.update({
id: "biz_xxxxxxxxxxxxx",
affiliate_instructions: "Share your link on social. 30-day cookie window.",
affiliate_application_required: true,
featured_affiliate_product_id: "prod_xxxxxxxxxxxxx",
});
client.accounts.update(
"biz_xxxxxxxxxxxxx",
affiliate_instructions="Share your link on social. 30-day cookie window.",
affiliate_application_required=True,
featured_affiliate_product_id="prod_xxxxxxxxxxxxx",
)
client
.accounts
.update(
&"biz_xxxxxxxxxxxxx".to_string(),
&UpdateAccountsRequest {
affiliate_instructions: Some(
"Share your link on social. 30-day cookie window.".to_string(),
),
affiliate_application_required: Some(true),
featured_affiliate_product_id: Some("prod_xxxxxxxxxxxxx".to_string()),
..Default::default()
},
None,
)
.await?;
_, err := client.Accounts.Update(context.TODO(), &whopsdk.UpdateAccountsRequest{
ID: "biz_xxxxxxxxxxxxx",
AffiliateInstructions: whopsdk.String("Share your link on social. 30-day cookie window."),
AffiliateApplicationRequired: whopsdk.Bool(true),
FeaturedAffiliateProductID: whopsdk.String("prod_xxxxxxxxxxxxx"),
})
if err != nil {
log.Fatal(err)
}
| 필드 | 설명 |
|---|---|
affiliate_instructions | 이 계정을 홍보하는 제휴사에게 표시되는 가이드라인 |
affiliate_application_required | 사용자가 제휴사가 되기 전에 신청하고 승인을 받아야 하는지 여부 |
featured_affiliate_product_id | 제휴 홍보에 추천할 상품 |
수익 추적하기
각 오버라이드에는 해당 오버라이드의 누적 수익(미국 달러 기준)을 반영하는total_referral_earnings_usd 필드가 포함됩니다. 현재 합계를 확인하려면 오버라이드를 다시 가져오거나 제휴사의 오버라이드 목록을 조회하세요.
v1에는 전용
affiliate.* 웹훅이 없으며, 공개 payment 스키마는 제휴사 연결 정보를 노출하지 않습니다. 지급 일정에 맞춰 affiliates.overrides.list를 폴링하고 최신 total_referral_earnings_usd 값을 마지막으로 저장한 값과 비교하세요.오버라이드 응답 필드
| 필드 | 설명 |
|---|---|
override_type | "standard" or "rev_share" |
commission_type | "percentage" or "flat_fee" |
commission_value | 비율(1–100) 또는 달러 단위 고정 수수료 |
applies_to_payments | "first_payment" or "all_payments"(standard 전용, rev-share의 경우 null) |
plan_id | 변형 ID, plan_ 접두사 유지(standard 전용) |
product_id | 상품 ID(rev-share 전용, 계정 전체인 경우 null) |
applies_to_products | "single_product" or "all_products"(rev-share 전용) |
product_direct_link | 상품 페이지로 연결되는 추천 링크(standard 전용) |
checkout_direct_link | 체크아웃 페이지로 연결되는 추천 링크(standard 전용) |
total_referral_earnings_usd | 이 오버라이드의 누적 수익 |
다음 단계
제휴사 수익 지급하기
누적된 커미션을 잔액에서 제휴사 계정으로 이체합니다.
결제 받기
추천 쿠키가 설정되어 있으면 체크아웃 구성이 판매를 자동으로 귀속시킵니다.
웹훅 수신하기
일반 판매 원격 측정에는
payment.succeeded를 사용하세요. 제휴사 기여도는 여전히 폴링으로 확인합니다.Affiliates API 레퍼런스
전체 리소스입니다. 엔드포인트, 필드, 오버라이드 스키마를 다룹니다.

