WooCommerce plugin
The TapPay plugin for WooCommerce opens a hosted checkout session for each order and marks the order as paid when TapPay confirms the payment. If you prefer to connect your shop with code, follow the checkout guide instead.
Requirements
| Plugin version | Minimum platform | Minimum runtime |
|---|---|---|
0.1.0 | WordPress 6.9, WooCommerce 10.0 | PHP 8.1 |
- A WooCommerce shop with the currency set to MNT. The plugin offers TapPay only for orders in MNT.
- A merchant account in TapPay, with at least one terminal. With one-click connect, the plugin gets its key and webhook for you. For manual setup, you need a sandbox secret key. The key needs the
checkout:write,payments:writeandrefunds:writescopes. Thewebhooks:managescope is optional: with it, the plugin can also check your webhook endpoint. - A public HTTPS address for your shop, so that TapPay can send webhooks to it.
Install
The plugin is not in the WordPress.org plugin directory yet. Download it from the merchant portal.
- In the merchant portal, open Connections › TapPay systems › Online store and choose Download plugin (.zip) for WooCommerce. You get the file
tappay-for-woocommerce.zip. - In WordPress, open Plugins > Add New Plugin > Upload Plugin, choose the zip file, then Install Now and Activate.
- Open WooCommerce > Settings > Payments > TapPay.
The plugin works with the classic checkout and with the WooCommerce Checkout block, and with High-Performance Order Storage.
Configure
Connect in one click
- In the TapPay settings, choose Connect to TapPay for the
sandboxmode. - The merchant portal opens. Sign in if it asks. The
sandboxmode opens the sandbox portal, and theproductionmode opens the production portal. - Check the site address on the page. The connection belongs to one terminal: if your business has several, choose one.
- Choose Approve. In production, the portal may ask for two-step verification first. After it, choose Approve again.
- The portal sends you back to the plugin. The plugin saves the keys and shows Connected.
The connection creates a secret key with the checkout:write, payments:write, refunds:write and webhooks:manage scopes. It also creates a webhook endpoint with the events that the plugin needs. To approve, you need the permissions to manage API keys and webhooks.
To go live, choose Connect to TapPay for the production mode, then switch Mode to production. The production connection is separate from the sandbox one.
To disconnect, choose Disconnect in the plugin, or open the system under Developers › API keys & webhooks in the merchant portal and choose Disable. Both revoke the key and disable the webhook endpoint.
Manual setup (fallback)
Use these steps when you cannot use one-click connect. In the plugin settings, the fields are under Manual setup.
- Sign in to the merchant portal in the sandbox and create a secret key. Your sandbox key looks like
sk_test_YOUR_SECRET_KEY, and it starts withsk_test_. - In the plugin settings, copy the Webhook URL. It has the form
https://your-shop.example/?wc-api=tappay, and it is the same whatever your permalink settings are. - In the merchant portal, open Developers › API keys & webhooks and create a webhook endpoint. Paste the URL exactly as the plugin shows it. Do not change the scheme, host, path or query. Choose these events:
payment.succeeded,payment.overpaid,payment.failed,payment.processing,invoice.expired,invoice.partially_paid,refund.succeededandrefund.failed. - Copy the webhook secret of the endpoint. It starts with
whsec_and the portal shows it once. - In the plugin settings, keep Mode on
sandbox, enter the sandbox secret key and the sandbox webhook secret, and save. The plugin refuses a key with the wrong prefix, such as ask_live_key in the sandbox field. - Choose Check connection. The plugin reads your account with the key. If the key has the
webhooks:managescope, it also looks for an active webhook endpoint with exactly the URL of the plugin.
Optional fields: the Terminal ID (needed when your key does not belong to one terminal) and the Request signing secret (needed when TapPay signs requests for your account).
After you save, the plugin shows a secret only as •••• and its last four characters. Leave a secret field empty to keep the saved value.
You can keep the secrets out of the database by defining constants in wp-config.php. A field with a constant is read-only in the settings.
define( 'TAPPAY_SANDBOX_SECRET_KEY', 'sk_test_YOUR_SECRET_KEY' );
define( 'TAPPAY_SANDBOX_WEBHOOK_SECRET', 'whsec_YOUR_WEBHOOK_SECRET' );
define( 'TAPPAY_PRODUCTION_SECRET_KEY', 'sk_live_YOUR_SECRET_KEY' );
define( 'TAPPAY_PRODUCTION_WEBHOOK_SECRET', 'whsec_YOUR_PRODUCTION_WEBHOOK_SECRET' );
The constants TAPPAY_SANDBOX_SIGNING_SECRET, TAPPAY_PRODUCTION_SIGNING_SECRET and TAPPAY_TERMINAL_ID work in the same way.
Go live
When the sandbox works, switch the plugin to production. The go-live checklist applies:
- Create a production secret key, and enter it in the production field.
- Create a separate production webhook endpoint with the same URL and the same events. Enter its own webhook secret. The sandbox secret does not work in production.
- Add the outgoing IP address of your server to the system’s IP restriction under Developers › API keys & webhooks in the merchant portal.
- If your account uses request signing, enter the request signing secret.
- Switch Mode to
production, save, and choose Check connection.
The plugin does not take the page that the customer sees after paying as proof of payment. It sends an Idempotency-Key with every request, so you do nothing more for those two points.
Test in sandbox
- Add a product to the cart and choose TapPay at checkout.
- On the hosted page, pay with the test card
4242 4242 4242 4242. The testing page lists more cards, and the simulator lets you create other outcomes. - After the redirect to your shop, the order moves to Processing. The payment id is the transaction id of the order.
- If the order stays in Pending payment, the webhook has not arrived. See Troubleshooting below.
Refunds
A refund starts on the order: open it, choose Refund, enter the amount, and choose Refund via TapPay. It is asynchronous: WooCommerce shows the refund at once, and TapPay confirms it with the refund.succeeded webhook. If TapPay sends refund.failed, the plugin removes the refund from the order and adds an order note. When the full amount is refunded, the order becomes Refunded. See the refunds guide for the rules of the API.
Troubleshooting
- The order stays in “Pending payment”. The webhook URL in the portal does not equal the URL in the plugin settings. Copy it again, exactly, including the
?wc-api=tappayquery. Also check that the endpoint has the events listed above, and that the webhook secret is the one of this endpoint and this mode. See the webhooks guide. - “Invalid key” or error
EVT-206orEVT-207. The key belongs to the other mode. Use ask_test_key and a sandbox endpoint insandboxmode, and ask_live_key inproductionmode. - TapPay is not offered at checkout. The plugin works only with orders in MNT. Set the shop currency to MNT.
- The webhook returns
401. The webhook secret is wrong, or a proxy changes the body of the request. Enter the secret of this endpoint again. - “Repeat the same refund”. A refund is asynchronous. After a temporary error (a timeout, or a
5xx,429or403answer), the plugin remembers the refund. Repeat it with exactly the same amount. The plugin rejects a different amount, so that the customer is not refunded twice. - “An earlier TapPay refund … was never confirmed”. The plugin repeats a remembered refund only within 23 hours, because TapPay keeps an idempotency key for 24 hours. After that it stops, so that the customer is not refunded twice. Check the payment in the TapPay dashboard. If the refund is not there, open the order, choose the order action TapPay: clear unconfirmed refund attempt, and refund again.
- “The development override is active”. The
TAPPAY_API_BASE_OVERRIDEconstant is for TapPay platform developers only. Remove it fromwp-config.php.
Changelog
The latest version is shown in the table in Requirements. The full history is in the CHANGELOG.md file of the plugin repository, and on the Changelog tab of the plugin page.