Documentation Integration for Payhip
WP plugin Integration for Payhip
What it does
Insight Integration for Payhip connects a WooCommerce product page to Payhip checkout. Payhip charges the buyer and sends the invoice. This plugin records the WordPress account and the WooCommerce order.
- The payment window opens on your page. The buyer does not leave it.
- Payhip is the merchant of record. Sales tax and VAT in the EU, the UK, the USA, and other countries are handled by Payhip.
- The plugin works for any WooCommerce product that has a Payhip code: a plugin, a theme, another digital file, or a physical product.
WooCommerce on its own
- You can use the plugin with WooCommerce without additional plugins like a license server.
- After a verified payment the plugin creates a WordPress account when the email is new, and a paid WooCommerce order for the amount Payhip charged.
- When you are selling digitalproducts, to license keys are created because that is not a part of WooCommerce.
- Downloadable product lists its file under Downloads.
WooCommerce and Insight License Server
When Insight License Server is on the same site, it treats the Payhip order like any other paid order.
- The buyer email comes with the Payhip payment. The plugin stores it on the new user and on the WooCommerce order, and that is the address the license key is tied to. Renewal mail and license mail use that same address.
- Leave the licensed zip, and any license keys, off the Payhip product. The license server delivers the key and the download from the WooCommerce order.
The shop on one site, the license server on another
The product page can live on site A. WooCommerce, and the license server if you use it, live on site B.
- Site A only opens the Payhip payment window. It does not create orders. On site A, turn on Payhip checkout only.
- Site B holds the webhook address, the webhook secret, the WooCommerce products, and the Payhip product codes. Payhip sends the paid notice to site B. The account, the order, the download, and the license key are created there.
How a sale moves
On your product page
- The buyer opens the product, chooses a variation when the product has one, and clicks the buy button.
- The Payhip payment window opens on top of the page (it looks like any other payment provider, the visitor doesn’t leave the product page)
- Inside that window the buyer enters an email and pays. The window is Payhip checkout, so it includes Payhip’s coupon field.
- The amount charged is the price of the Payhip product. That includes the tax, the way you set it on Payhip, and the shipping Payhip adds for a physical product.
- The price on the WooCommerce page is what you show the visitor. It is not the invoice amount.
Back on the WooCommerce site
Payhip then calls the webhook on the WooCommerce site.
- Payhip sends a paid notice, signed with your API key.
- The plugin checks that signature. A notice that does not match is refused.
- It reads the Payhip product code on each line and finds the WooCommerce product or variation that stores that code.
- It finds the WordPress user with that email, or creates one.
- It creates one paid WooCommerce order for that Payhip sale. The order total is the amount Payhip charged.
- With Insight License Server installed, that paid order follows the normal license flow. The key and the download email use the product and the variation on the line.
The buyer then receives:
- A VAT invoice from Payhip
- The WooCommerce email with the download, and the license key when the license server is in use
- For a new account, a WordPress email with a link to set a password
The buyer does not have to be logged in. The match is the email address. A later purchase with the same email is added to the same account. A different email uses a different account.
When the code does not match
- An unknown Payhip code creates no order. The Payhip settings screen logs it.
- If one sale contains several products and only some codes match, the order is created for the lines that match. The others are logged.
- If two WooCommerce products store the same code, the plugin uses the product with the lowest id and logs that.
- A second notice for the same Payhip sale does not create a second order.
A purchase made on Payhip
- A buyer can pay on Payhip itself, without opening your product page. Payhip sends the same paid notice to the webhook.
- When the product code matches a WooCommerce product, the account, and the order are created in the same way. Payhip still sends the invoice.
- The WooCommerce email still goes out. With the license server, the license email goes out too. All of them use the buyer email from that payment.
Coupons, referrals, and Payhip product settings
Coupons
A Payhip coupon can be entered in the payment window. The WooCommerce order stores the amount Payhip charged after that coupon. You do not create a matching WooCommerce coupon.
Referrals
Payhip referrals can be used. Payhip records the referral, because the checkout is Payhip’s. This plugin has no referral field of its own.
License keys and updates on the Payhip product
- On the Payhip product, leave the license key feature off. If keys are already uploaded, remove them and turn the feature off.
- Leave Payhip’s update feature off. That switch is in the product’s Marketing section. File updates belong to WooCommerce and, when you use it, the Insight License Server.
- You can still put a file on the Payhip product, such as a banner or a short PDF with instructions. That file is not the licensed download.
A refund
- In the Payhip API (developer section), turn on the refunded event as well as the paid event.
- A Payhip refund cancels the WooCommerce order that stores that sale id. The order and the account stay. Insight License Server treats that cancelled order as a cancelled key. An unknown sale is only logged.
What the order stores
- The WooCommerce order is marked as coming from Payhip. The payment method is Payhip. An order note stores the Payhip sale id.
- The billing email and name come from Payhip. The currency is the one Payhip sent. When that is missing, the shop currency is used. Payhip sends the price in cents, and the plugin turns that into the normal order amount.
- When a sale has more than one matched product, the Payhip amount is placed on the first line. The other lines are zero, so the buyer is not charged twice.
- With Insight License Server active, the order line stores the license length of the matched tier: a number of days, or LTD.
- For a physical product, Payhip collects the address and the shipping cost in the payment window. WooCommerce does not offer its own shipping to the customer; Payhip already did that. The order total includes the shipping Payhip added.
Set up
Connect Payhip to the WooCommerce site
- Do this on the site that creates the orders. A shop that only opens the payment window does not get a webhook address or a secret.
The API key
- In Payhip, open Settings, then Developer. Copy the API key. After you have saved it in WordPress, do not generate a new one.
- In WordPress, open WooCommerce, then Payhip. Paste the key into Payhip webhook secret and save.
- On a later visit, leave that field blank to keep the saved key. The screen tells you when a secret is saved. It does not show the key again.
- Payhip signs each notice with this key. The plugin checks the signature before it creates an order.
The webhook address
- On that same screen, copy Webhook URL. It has this shape:
https://yourdomain.com/wp-json/insight-integration-for-payhip/v1/webhook
- In Payhip, under Settings, then Developer, paste it into Webhook Endpoint.
The events
- On that Payhip page, under Select webhook events to listen for, turn on Paid and Refunded. Save.
The Payhip product
- Create the product in Payhip and set its price. Choose whether that price includes tax. For business sales, a price excluding tax is the usual choice.
- Leave the license key feature off, and leave the update feature off under Marketing.
- A digital product is the usual choice when Insight License Server delivers the file. Another Payhip product type is fine when you only need the WooCommerce order.
The WooCommerce product
- Each product or variation that Payhip sells has a field called Payhip product code.
- You can enter the short code, or a full Payhip URL. The plugin stores the code only. A product address looks like
https://payhip.com/b/CODE. The code is the part after/b/. - An empty field means that product or variation is not sold through Payhip.
A simple product
- Edit the product. Under Product data, open the General tab, and fill in Payhip product code.
- There is no variation to choose. The buy button can open Payhip straight away.
A product with variations
- Under Product data, open Variations. Each variation has its own Payhip product code. One variation can use Payhip while another stays empty.
- The buyer chooses a variation first. Until then the page says Please select your plan first, and Payhip does not open. A variation with an empty code says This plan is not sold through Payhip.
The variation and the license tier
- The variation the buyer selects is the variation on the WooCommerce order line.
- Insight License Server uses that variation id to choose the tier. On the license server, set that same variation id on the tier, so the key matches the plan that was paid.
The price on the page
The WooCommerce price is the price shown on the product page. Payhip charges the price of the Payhip product. The invoice and the order total follow Payhip.
Notices and uninstall
- WooCommerce, then Payhip, lists the latest notices: a created order, a missing code, a refused signature, a refund. The list keeps 50 rows. The time is GMT.
- Uninstall removes the settings and this list. Orders and user accounts stay.
What the site needs
- WordPress 6.0 or newer
- PHP 7.4 or newer
- WooCommerce, on the site that creates the orders
- HTTPS on that site, so Payhip can call the webhook
- Insight License Server on that same site, when you want license keys and updates
A second site that only opens the payment window does not need WooCommerce.
The button and the popup
- The buy control belongs on the product page. Related products, upsells, and product loops keep the normal WooCommerce button.
- You can use the WooCommerce button, a button you design, or the Buy block. All three open the same Payhip window and send the same paid notice.
The WooCommerce button
- Under WooCommerce, then Payhip, choose the Default buy button.
- On a classic theme and on a block theme, the plugin uses the WooCommerce add-to-cart button itself. The variation choices and Clear stay as they are. You do not add a second button, and you do not add CSS for this.
- The quantity on the WooCommerce form is not sent to Payhip. Payhip uses the quantity from its own checkout.
A button you design
- Choose Design your own.
- Put the class
iipay-buyon your button in the single product template. Do not give that button a URL. The class works in a classic theme and in a block theme. - With no variation selected, the page shows Please select your plan first and does not open Payhip.
- While you use your own button, the WooCommerce button would still add the product to the cart. Hide that button.
- On a classic theme, turn on Hide Woo Buy button. The variation choices stay visible.
- On a block theme, hide it in Additional CSS, or in a snippet. For the default WooCommerce button:
.wp-block-woocommerce-add-to-cart-form .single_add_to_cart_button,
.wp-block-woocommerce-add-to-cart-form .quantity {
display: none;
}
- For another buy block, add the class
iipay-hide-woo-buyto that block, and use:
.iipay-hide-woo-buy .single_add_to_cart_button,
.iipay-hide-woo-buy button[name="add-to-cart"],
.iipay-hide-woo-buy .quantity {
display: none;
}
- Leave the
.quantitylines out when the quantity field should stay.
The Buy block
- The plugin adds a Buy block. Usually this is the best choice.
- On a variable product the block shows the variation choice and a button. On a simple product it shows the button only. The button does not add the product to the cart.
- In the block settings you can set the label, normal or bold text, the corner radius, and the colours.
- Use this block when you want a buy area that does not depend on the theme’s add-to-cart block.
A link that opens the payment window
- Use a link when the page is not the WooCommerce product, or when this site only opens Payhip checkout.
The address
- The link is:
https://payhip.com/buy?link=CODE
- Replace CODE with the Payhip product code. An example is
https://payhip.com/buy?link=G01qF. - Put that address on a button, in a menu, or in a custom field. The plugin reads
linkand opens the payment window on the current page. - The code may contain letters, numbers, hyphens, and underscores. The address uses
https://payhip.com/buy.
Payhip checkout only
- On the shop site, open the Payhip screen and turn on Payhip checkout only. When WooCommerce is installed, that screen is under WooCommerce. Without WooCommerce, Payhip is its own menu.
- The webhook secret and the webhook URL stay empty here. They belong on the WooCommerce store. In Payhip, the webhook URL is that store.
- Without WooCommerce, the full order flow cannot run. Payhip checkout only still opens the payment window from these links.
Basics
- The plugin adds a field in the product or product variation with a payhip url or just the product code (few characters) of the Payhip product-code.
- When a visitor selects the correct product or product variation, clicks on a custom buy button (I change the Woo product template)
- The Payhip payment layout comes up in a modal, so the visitor doesn’t leave the page.
- The visitor enters the email address etc, and pays the amount.
The advanced part:
- After the payment Insight License Server uses the Payhip API and gets the details from the buyer:
- Email, name, etc.
- The user’s order will be automatically added to WooCommerce orders after completing the payment.
- If the user is not a member of my website, the Insight License Server will automatically register the user.
Results:
- Payments done by Payhip
- Sales-tax VAT remittance in the EU, USA, UK, and other countries is taken care of by Payhip
- Payhip is the Merchant of Record (MoR).
- Client and order registered on your WooCommerce website.
- The client can log in, download zips and see the purchased keys.
Client workflow
- The customer goes to the WooCommerce shop page.
- The customer clicks the “Purchase” button (or whatever label you have used).
- Instead of adding the item to the cart, a modal (pop-up) opens, displaying the Payhip payment interface—which includes a field for coupons. The customer doesn’t leave the age, essential for a good customer experience.
- The customer completes the checkout process.
- Subsequently, the customer receives:
- A VAT invoice (payment receipt) from Payhip (het bedrag van het Payhip product wordt gebruikt, niet wat op WooCommerce staat.
- An email containing the WooCommerce license key and the download link.
- An email from the WordPress website with some account details and a link to set a password.
License key handling
- The buyer e-mail comes with the Payhip payment. The server stores it on the new user and on the WooCommerce order, and that is the address the license key is tied to.
- Existing renewal and license emails use that same address.
Connect Payhip and WooCommerce
- Go to your Payhip account > Account/ Settings / Developer,
- Copy Your API Key (don’t generate a new one after that) it looks like: c0ec21d56d690cad8cps9e3f37e7a76edc006e7
- Go to WooCommerce / Payhip.
- Paste the API key in the Payhip webhook secret and Save settings.
- Copy the Web URL (looks like https://yourdomain.com/wp-json/insight-integration-for-payhip/v1/webhook)
- Go to your Payhip account > Account/ Settings / Developer.
- Paste the Web URL in the Webhook Endpoint field.
- On that same page you’ll see ‘Select webhook events to listen for’.
- Turn on ‘Paid’ and ‘Refunded’
- Save settings.
Other Settings
- Go to WooCommerce / Payhip.
- Select the type of Buy button you wish to use.
- See the instructions at the Buy button section.
Settings in Payhip products
- Digital product.
- Set a price and decide if it is inclusive of exclusive taxes (for business transactions excluding is the norm).
- Upload a nice downloadable file, like a banner or a PDF with instructions.
- Don’t use the license key feature and do not upload license keys. If they are already there, remove them and disable to license key feature.
Buy button
- The Buy button belongs on the product page only.
Placement of the button
- You have two choices at WooCommerce, Payhip, under the Buy button.
- Default buy button
- Design your own
- Plugin default buy button
- This is shown on classic themes only.
- The plugin adds its Buy now button on the product page. It does not take over the WooCommerce add-to-cart button.
- Buy now opens the Payhip overlay, or shows “Please select your plan first” when no variation is selected.
- Removal of the Buy now on classic themes
- Woo’s own button still adds the product to the cart, so if you don’t want that, see below.
- Settings offers you the choice to remove the WooCommerce Buy Now button on classic themes, since it is abundant.
- Removal of the Buy now on FSE block themes
- Woo’s own button still adds the product to the cart, so if you don’t want that, see the CSS code examples
- For the default WooCommerce Buy now block:
- .wp-block-woocommerce-add-to-cart-form .single_add_to_cart_button, .wp-block-woocommerce-add-to-cart-form .quantity { display: none; }
- For third party Buy now blocks
- Add the class
iipay-hide-woo-buyto that block. - Put the snippet in the theme’s Additional CSS of a snippet manager.
- Add the class
- .iipay-hide-woo-buy .single_add_to_cart_button, .iipay-hide-woo-buy button[name=”add-to-cart”], .iipay-hide-woo-buy .quantity { display: none; }
- For both CSS snippets: Leave the
.quantitylines out if the quantity field should stay.
- For both CSS snippets: Leave the
- Custom design button instruction
- Design your own button in the single product template.
- Put the class
iipay-buyon your button. No URL. That works in a classic theme and in an FSE template. - With no variation selected, the page shows “Please select your plan first” and does not open Payhip.
Product with variations
- With no variation selected it shows “Please select your plan first” and does not open Payhip.
- Once a variation is selected, that variation ID is already the tier’s variation ID, so the paid notice can create the WooCommerce order for that product and that variation, and the existing license flow attaches the key to that tier.
Simple product
- A simple product has no variation step, so the button can open Payhip immediately.
Placement of the Payhip buy code
- For a variation: go to Product Data > Variations and locate the “Payhip product code” field. The code is the part following “/b/” in a URL like ‘payhip.com/b/CODE’ (you may also enter the full URL). Leaving this field blank indicates that the product is not managed via Payhip.
- For a simple product, this same field can be found under the “General” tab.
- The price displayed in WooCommerce remains the price shown to the user, but is not used in the invoice.
- Webhook: ‘/wp-json/insight-integration-for-payhip/v1/webhook’
- The full URL can be found under WooCommerce > Payhip.
- Enter this URL in your Payhip account under “Developer” settings, and ensure the “paid” event is enabled.
- The webhook secret is your Payhip API key.
- Once a payment is verified, the plugin will create an account on WordPress / WooCommerce (if the email address is new) and generate a paid WooCommerce order reflecting the amount from Payhip.
- The Insight License Server will then process this order just like any other paid order. If an unrecognized code is provided, no order will be created.
- On the product page, the “Buy now” button triggers the Payhip overlay. If no variation has been selected, the message “Please select your plan first” will appear.
WooCommerce, Payhip and account creation
- If a user buys another product, maybe even without login first, Woo and the integration plugin still connect the new purchase with the existing account, as long as the same email is used.
- The match is the email address, not a login. If that email already belongs to an account, the new Payhip payment is added to that account as a WooCommerce order. If the email is new, an account is created. The customer does not have to be logged in. A different email creates or uses a different account.
Setting of the Payhip field in the WooCommerce products of variations
- For a variation: go to Product Data > Variations and locate the “Payhip product code” field. The code is the part following “/b/” in a URL like `payhip.com/b/CODE` (you may also enter the full URL). Leaving this field blank indicates that the product is not managed via Payhip.
- For a simple product, this same field can be found under the “General” tab. The price displayed in WooCommerce remains the price shown to the user.
- Webhook: `/wp-json/insight-integration-for-payhip/v1/webhook`
- The full URL can be found under WooCommerce > Payhip. Enter this URL in your Payhip account under “Developer” settings, and ensure the “paid” event is enabled. The webhook secret is your Payhip API key.
- Once a payment is verified, the plugin creates an account (if the email address is new) and generates a paid WooCommerce order reflecting the amount from Payhip. The Insight License Server processes this order just like any other paid order. If an unrecognized code is provided, no order will be created. On the product page, the “Buy now” button triggers the Payhip overlay. If no variation has been selected, the message “Please select your plan first” will appear.
Refunds
- A Payhip refund will cancel the matching WooCommerce order, so the license key stops. The paid-sale path stays as it is.
- A Payhip refund cancels the WooCommerce order with that sale id. The order and the account stay. Insight License Server treats that cancelled order as a cancelled key. An unknown sale is only logged. Turn on the refund event in Payhip as well as the paid event. Payhip sends it as a type refunded.

