接入 RelayWonder

先选你的收款方式。订阅产品接 Stripe,独立站接 Shopify。接好后,伙伴带来的每一笔付款都会自动记佣金。

  1. 1

    放入追踪脚本

    放在每个页面的 <head> 里。它读取 ?via= 参数,在你自己的域名下写第一方 Cookie,并上报这次点击。

    html
    <script async src="https://cdn.relaywonder.com/rw.v1.js"
      data-program="prg_moody"></script>
  2. 2

    把归因 ID 传给 Stripe

    在服务端创建 Checkout Session 时,把追踪脚本写下的 Cookie(rw_ref)带上。这是点击和发票之间唯一的那根线。

    javascript
    // 服务端(Node / Stripe SDK)
    // rw_ref 是追踪脚本写在你自己域名下的第一方 Cookie
    const session = await stripe.checkout.sessions.create({
      mode: 'subscription',
      line_items: [{ price: 'price_xxx', quantity: 1 }],
      success_url: 'https://moodywonder.com/welcome',
    
      // 这一行就是点击与发票之间的那根线
      client_reference_id: req.cookies.rw_ref,
    })
  3. 3

    连接 Stripe

    一次 OAuth 授权。只读 + Webhook——我们碰不到你的余额,也无法发起转账。

我们监听的事件

  • checkout.session.completedBinds the visitor to a Stripe customer
  • invoice.paidCreates a commission — first payment and every renewal
  • charge.refundedWrites a negative commission record
  • charge.dispute.createdSame, for chargebacks
  • customer.subscription.deletedStops future recurring commission

验证是否生效

在你的网站地址后面加上 ?via=test 打开。如果 Cookie 写入成功、几秒内后台出现一条点击,就接好了。

用 WooCommerce、Paddle 或自建结账?目前还不支持,可以联系我们走 API 接入。

安装追踪:一段脚本加一行结账代码 · RelayWonder