Set up a store affiliate program

Connect a Shopify, WooCommerce or BigCommerce store in one API call: webhooks, tracking script, product catalog and a starter rate card.

Embed
Preview of the card
<a href="https://referalli.com/guides/set-up-a-store-affiliate-program"><img src="https://referalli.com/guides/_api/public/orgs/07f432f4-34b9-46a7-aaad-c0e395d2e4f9/spaces/2d18b3a7-6f85-4e83-b889-e1a361196ad4/pages/002e6a3f-a364-4a5c-b9a2-0076ea7b3f64/social-card.svg?v=3e7ae33eec8b" alt="Set up a store affiliate program" width="600" height="315"></a>

If you sell products through Shopify, WooCommerce or BigCommerce, one call connects the store to a program. You use your own store credentials: Referalli has no app keys of its own and never needs a platform app install.

A listed Shopify App Store app (one-click install) would need a Shopify Partner account and Referalli app credentials. That is not available yet, so the steps below use a token you create in your own store.

1. Create a token in your store

  1. Shopify

    In the Shopify admin, open Settings, Apps and sales channels, Develop apps and create an app. Grant these Admin API scopes: read_orders, read_products and write_script_tags. Install it, then copy the Admin API access token (shpat_…) and the app's client secret, which signs the webhooks.

  2. WooCommerce

    In WooCommerce, Settings, Advanced, REST API add a key with Read/Write permission. Copy the consumer key (ck_…) and consumer secret (cs_…). The store must be served over https://.

  3. BigCommerce

    In Settings, API, Store-level API accounts create an account with Orders read-only, Products read-only, Content modify and Information and settings read-only. Copy the API token. The store hash is the part of the API path after stores/.

2. Make the call

Create the program first (or use an existing one), then call store setup with an API key:

curl -X POST https://referalli.com/v1/programs/$PROGRAM_ID/store-setup \
  -H "Authorization: Bearer $REFERALLI_KEY" -H "Content-Type: application/json" \
  -d '{
    "provider": "shopify",
    "shop": "your-store.myshopify.com",
    "credentials": { "accessToken": "shpat_…", "apiSecret": "…" }
  }'

For WooCommerce send "shop": "https://your-store.com" with consumerKey and consumerSecret. For BigCommerce send the store hash as shop with apiToken. Your credentials are used for this call only (BigCommerce's token is kept, sealed, so orders can be read).

The call is safe to repeat. It reuses the connection and webhooks, finds the script already added, refreshes the catalog and never replaces an existing commission rule.

3. Read the checklist

The answer lists each step with ok and a detail. GET /v1/programs/{id}/store-setup shows the same list from the current state.

Step

What it did

connection

Created or reused the store's billing connection for this program.

webhooks

Registered the order and refund webhooks, so paid orders become commissions and refunds reverse them.

tracking_script

Added aff.js to the storefront (Shopify and BigCommerce). WooCommerce has no script API: the detail gives the one <script> line to paste into your theme header.

catalog

Pulled your products so partners can search them and get product links.

rate_card

Published a starter rate card as a draft.

A step with ok: false never stops the others. It says what to fix, usually a missing token scope. Fix it and call again.

4. Review the rate card

The general_retail preset is a draft: it accrues nothing and is hidden from partners until you publish it. It pays 8% on apparel and beauty, 5% on home and toys, 4.5% on books, 3% on electronics, 2.5% on computers, 2% on grocery and 4% on any other category, holds commissions 30 days, and excludes gift cards. Items other than the linked product earn no indirect rate.

Edit the rates to fit your margins, then publish them without draft:

curl -X PUT https://referalli.com/v1/programs/$PROGRAM_ID/commission-rule \
  -H "Authorization: Bearer $REFERALLI_KEY" -H "Content-Type: application/json" \
  -d '{ "config": { "base": { "kind": "percent", "bps": 400 }, "holdDays": 30,
        "rateCard": { "rates": { "apparel": 800, "electronics": 300 }, "defaultBps": 400, "exclude": ["gift_cards"] } } }'

Pass "rateCardPreset": "none" in step 2 to skip the preset. If the program already has a rule, setup leaves it alone. See commission rules for every field.

Updated