Hi everyone,
I’m building an embedded Shopify app that acts as an affiliate marketplace. Merchants connect their store, their products are displayed on our marketplace, and when a customer clicks “Buy”, they’re redirected to the merchant’s Shopify store via a cart permalink with a storefront access token.
I want to charge a 5% commission on sales attributed to my app.
My current implementation plan:
- Billing setup: Use appSubscriptionCreate with usagePricingDetails
- Order attribution: Use storefront access token + cart permalink so orders have my app as the source/sales channel
- Charging commissions: Call appUsageRecordCreate for each order attributed to my app
- Order detection:
- orders/paid webhook, filter by source_name
My questions:
- Is this the right approach for usage-based affiliate commissions? Or is there a better pattern?
- Order attribution: How do I reliably detect that an order came from my app? I’m using cart permalinks
- Billing flow UX: After appSubscriptionCreate, I redirect to the confirmationUrl using
window.top.location.href (App Bridge v4). - When to create the subscription?
- Webhook vs Polling ?