Running Whop as the checkout on a Shopify store
Shopify stays your storefront, catalog and order system. Whop takes the payment. A small Cloudflare Worker sits in between and connects the two. Plan about a day for the first store.
How it fits together
Whop cannot be added as a payment gateway inside Shopify's own checkout, so the checkout button is pointed at your own pay page instead.
checkout.yourstore.com, showing the order summary and Whop's payment form.What you need before starting
checkout. on the store's domain, or on a second domain you own.Setup steps
Do them in this order. Each one depends on the one before.
Set up the Whop business
- Create the business in the Whop dashboard as a physical product seller and finish identity and business verification.
- Add a payout method and mark it as default. Pick a payout schedule.
- Set the statement descriptor so the card statement shows your store name.
- Turn off Whop's customer emails. Shopify will send the receipt.
- Decide the sales tax setting on purpose. New businesses can default to Whop adding tax at checkout, which changes the total the shopper sees.
Create a Whop API key
In the Whop dashboard under Developer, create a company API key with these permissions:
- Plans: create and read
- Checkout configurations: create and read
- Payments: read
- Webhooks: manage
- Member email: read
Note your company id (it starts with biz_). The API lives at https://api.whop.com/api/v1. Check the key works by calling the account endpoint and confirming it returns your business.
Create a Shopify app for your store
Create an app for your own store (Shopify Dev Dashboard, or a custom app in the admin) and install it. It needs two things:
- Admin API access with scopes
read_products,read_orders,write_orders,read_customers,write_customers,read_themes,write_themes. - A Storefront API token, used only to price carts.
Build and deploy the Worker
One Cloudflare Worker with one KV namespace for storage. It needs these routes:
| Route | What it does |
|---|---|
POST /checkout | Receives the cart (variant ids and quantities) from the store. Builds a cart through Shopify's Storefront API to get real prices, discounts and currency. Saves a session and returns the pay page link. |
GET /pay/:id | The pay page: logo, order summary, shipping cost, total, email and address fields, and Whop's embedded checkout. |
POST /pay/:id/confirm | Creates a Whop checkout configuration for the exact session total (one-time price, your company id, the session id in metadata, a redirect back to the thanks page) and hands its id to the page. |
POST /webhooks/whop | Receives payment events from Whop and creates the Shopify order. |
GET /thanks/:id | Order confirmation page. |
GET /.well-known/apple-developer-merchantid-domain-association | Serves the Apple Pay file (step 7). |
Rules the Worker has to follow or orders will go wrong:
- Prices come from Shopify, never from the browser. The browser only sends variant ids and quantities.
- Shipping is read from your Shopify shipping zones so the pay page charges what the store advertises.
- Verify the webhook signature on every Whop event before acting on it.
- One order per payment. Store each handled payment id and skip repeats, because webhooks get re-sent.
- Collect the email on your own page. Apple Pay and Google Pay do not pass the payer's email back to you.
- Always send a last name to Shopify. Shopify silently drops an address with an empty last name. Strip emoji from names for the same reason.
- Only allow your store's domain to call
/checkout.
Store the Whop API key, Whop webhook secret and Shopify credentials as Worker secrets, not in the code.
Put the Worker on your subdomain
Add the domain to Cloudflare and attach checkout.yourstore.com to the Worker as a custom domain. Wait until it loads over HTTPS before going further, since Whop and Apple both check it.
Create the Whop webhook
Deploy the Worker first, because Whop tests the address. Then create a webhook pointing at https://checkout.yourstore.com/webhooks/whop and subscribe it to:
- Payment succeeded and payment failed
- Refund events
- Dispute events
Save the webhook's signing secret as a Worker secret.
Turn on Apple Pay
- Register your checkout hostname with Whop as a payment method domain (
POST /payment_method_domains). - Serve Apple's domain association file from the well-known path on that hostname. Use the file Whop publishes for platform integrators at
https://whop.com/.well-known/apple-platform-integrator/apple-developer-merchantid-domain-association. - Ask Whop to verify the domain (
POST /payment_method_domains/{id}/verify). On a new domain this can take a few tries over half an hour.
How the Shopify order is created
When the payment succeeded event arrives, the Worker loads the session named in the payment's metadata and creates the order through the Shopify Admin API with:
- Line items by variant id, with the prices from the session
- Customer email, shipping address, billing address and phone
- The shipping line and any discount
- Financial status paid, plus a successful sale transaction for the full amount
- Inventory set to decrement
- Receipt sending on, so Shopify emails the confirmation
- The Whop payment id in the order note or tags, so support can match the two
For refund and dispute events, tag the Shopify order so you see it in the admin. Refunds themselves are issued in Whop.
Add the checkout script to the theme
Work on a duplicate of your live theme first. Add one small script, loaded on every page, that:
- Catches taps on every checkout button: cart page, cart drawer, and any Buy now buttons.
- Reads the cart from Shopify's
/cart.js. - Posts it to
https://checkout.yourstore.com/checkoutand sends the shopper to the pay page link it gets back. - Falls back to Shopify's normal checkout if the Worker does not answer.
Test with a real payment
Go live
Publish the theme with the script. Keep a backup of the old theme so you can switch back in one click. Watch the first real orders arrive in Shopify, and for the first days compare Whop's payments list against Shopify orders to confirm every payment has an order.
Good to know
- Money lands in your Whop balance and pays out on your schedule. Refunds need available balance.
- Payment methods are card, Apple Pay and Google Pay. Others depend on what Whop enables for your account.
- Most failed payments are bank declines, which is normal for any processor.
- Update your store's policy and contact pages so the statement descriptor and support email match what buyers see.
Build brief
Paste this to your developer or AI coding tool along with your own keys.
Build a Cloudflare Worker (with one KV namespace) that lets my Shopify store take payment through Whop instead of Shopify checkout. Read the current Whop API docs (docs.whop.com) and Shopify Admin and Storefront API docs before writing code.
Inputs I will provide as Worker secrets and vars:
- Shopify store domain, Admin API credentials (scopes: read_products, read_orders, write_orders, read_customers, write_customers, read_themes, write_themes), Storefront API token
- Whop company API key, Whop company id (biz_...), Whop webhook secret
- Store name, logo URL, store URL, support email, checkout hostname
Routes:
1. POST /checkout: accept {items:[{variant_id, quantity}], discount_code?} only from my store's origin. Create a cart with Shopify's Storefront API to get authoritative prices, discounts and currency. Read shipping rates from my Shopify shipping zones. Save a session in KV. Return the pay page URL.
2. GET /pay/:id: render a mobile-first branded page with order summary, shipping, total, email field, shipping address fields and Whop's embedded checkout.
3. POST /pay/:id/confirm: save the email and address to the session, then create a Whop checkout configuration with a one-time plan priced at the exact session total in the session currency, my company id, metadata containing the session id, and a redirect URL to /thanks/:id. Return the configuration id for the embed.
4. POST /webhooks/whop: verify the signature. On payment succeeded, load the session from the payment metadata and create a Shopify order: line items by variant id, customer email, shipping and billing address, phone, shipping line, discount, financial_status paid with a successful sale transaction, inventory decrement, send_receipt true, Whop payment id in note and tags. Be idempotent per payment id. On refund and dispute events, tag the Shopify order.
5. GET /thanks/:id: confirmation page showing the order number once the order exists.
6. GET /.well-known/apple-developer-merchantid-domain-association: serve Whop's platform integrator association file.
Requirements:
- Never trust prices from the browser.
- Email is collected on my page and required before payment, because wallet payments do not return it.
- Guarantee a non-empty last name and strip emoji from names before sending to Shopify.
- If the webhook cannot create the order, store the failure so it can be retried, and never create two orders for one payment.
- Sessions expire after a few days, not hours.
Also deliver:
- A small theme script that intercepts every checkout button (cart page, drawer, buy now), reads /cart.js, calls POST /checkout and redirects, with a fallback to native checkout on error.
- A setup script or steps for: creating the Whop webhook (payment, refund, dispute events), registering and verifying the checkout hostname as a Whop payment method domain for Apple Pay.
- A test plan using a hidden $1 product.