Connect Shopify
This article shows you how to send your Shopify store's paid orders, refunds and cancellations to PlayerMagick, so each sale is matched to the play that sold it.
Available on: Pro, Business and Agency plans.
How it works
You create three webhooks in your Shopify admin with PlayerMagick's address. Shopify signs each one with a key unique to your store; PlayerMagick checks the signature with the same key, so nobody else can send you fake orders. You don't install an app and PlayerMagick never gets access to your store.
The match is exact when the order carries PlayerMagick's code:
- Cart links. When the player's button points to a Shopify cart link (
https://your-store.com/cart/VARIANT_ID:1), PlayerMagick addsattributes[pm]=…to it. Shopify keeps it on the order (you see it in the order's notes) and sends it back. - The player on your store. When the video plays on a page of your Shopify store (or a funnel there shows its offer), PlayerMagick also saves the code in the visitor's cart as a private attribute, so an order placed with your own Add to cart button carries it too.
- Links to a product page. PlayerMagick adds
pm=…; Shopify remembers the address the visit started on, so the code comes back when the visitor arrives on your store through that link.
Orders without the code are matched by the buyer's email (a viewer who gave the same address and watched in the 7 days before), or counted as not matched.
Refunds subtract the money refunded for the products (without tax and shipping). A cancellation is shown in the log and doesn't change your sales by itself: the refund that comes with it does.
Before you start
- You need to be able to open Settings → Notifications in your Shopify admin (the store owner, or staff with that permission).
Step 1: Connect Shopify in PlayerMagick
- Go to Settings → Sales platforms and click Connect a platform.
- Next to Shopify, click Connect, then Connect again.
- The setup page shows your receiver address. Copy it now: PlayerMagick shows it only once.
Step 2: Create the webhooks in Shopify
- In your Shopify admin, open Settings → Notifications → Webhooks and click Create webhook.
- Choose the event for paid orders (Order payment), format JSON, the newest webhook API version, and paste the receiver address as the URL. Click Save.
- Create two more webhooks with the same address: one for refunds (Refund create) and one for cancelled orders (Order cancellation).
- Copy the key your webhooks are signed with. Shopify shows it with your webhooks: letters and numbers unique to your store.
Step 3: Save the key in PlayerMagick
On the setup page, paste it into Webhook signing key and click Save.
Step 4: Check it works
- Click Send a test sale on the setup page. The result says what a real sale would be matched to. Test sales never count.
- In Shopify, click Send test in a webhook's … menu. It appears under Recent notifications as a test.
- Orders placed with a test payment gateway show as tests and never count.
Keep the code on your checkout links
- Use cart links for the player's buttons where you can:
https://your-store.com/cart/VARIANT_ID:1(or…/cart/VARIANT_ID:1,OTHER_VARIANT_ID:1for several products). Cart links can't add subscription products; use a product page link for those. - If your link already has its own
attributes[pm], PlayerMagick leaves it alone and addspm=…instead. - A buy button outside the player doesn't carry the code: those orders are matched by email or counted as not matched.
Troubleshooting
- Refused: the signature didn't match the saved secret. Copy the signing key again from Settings → Notifications → Webhooks. If you changed it, Shopify can take up to an hour to sign with the new one.
- Ignored: refund without money (restock only). The refund returned items to stock without refunding money, so your sales don't change.
- Ignored: orders/updated (or another topic). Only paid orders, refunds and cancellations are used; remove other webhooks with PlayerMagick's address.
- A webhook disappeared from Shopify. Shopify removes webhooks that keep failing. Check that the connection isn't removed in PlayerMagick, then create the webhook again.