Description
MyOTP Phone Verification sends a one-time code to a visitor’s phone and checks it before they can continue. It uses the MyOTP.App API (https://myotp.app), one key for SMS, WhatsApp and Telegram.
What it does:
- WooCommerce checkout: a Send code button under the billing phone. The order cannot be placed until the billing number is verified. Optionally only for guests.
- WordPress registration: a phone field with the same flow on wp-login.php?action=register. The verified number is saved as user meta
myotp_verified_phone. - Shortcode
[myotp_verify]: the same widget on any page. Fires amyotp:verifiedevent ondocumentwith the number inevent.detail.phone. - Settings page (Settings > MyOTP): API key, channel, code length, validity, brand, and a Send test code button.
How it stays safe:
- The API key never leaves the server. The browser talks to admin-ajax.php only.
- Every AJAX call carries a nonce. Admin actions check
manage_options. - Send limits, enforced together with atomic counters: 5 codes per visitor, 10 per client IP, 3 per destination number, each per 10 minutes, plus a site-wide ceiling (default 100, setting and
myotp_pv_site_hourly_capfilter). The site-wide count uses a fixed one-hour window that starts at the first send, so up to twice the ceiling can go out across a window boundary. It exists to bound what an attacker with many addresses and many numbers can make the site spend. A code that was not billed (provider answered 409 or a server error) is not counted against it. - A visitor can only verify the code they requested: the challenge reference from the provider is stored with the pending record and sent back on every check. If the provider still has an active code that this visitor did not request, a fresh code is sent for this visitor instead (still within every send limit).
- 5 wrong codes put this visitor on a 15-minute cooldown for that number. Sending and checking are both refused for that visitor while it lasts; other visitors are not affected, and nothing is keyed on the phone number alone, so nobody can lock a number’s owner out. Only a provider answer of “wrong code” counts; an expired code, a network failure or a provider error never does.
- A verification is valid for 30 minutes and is claimed by exactly one checkout or one registration at validation time, then consumed when the order or account exists. If checkout fails after validation (a declined payment, for example) the visitor verifies again.
- Phone numbers are reduced to digits before they are sent. Leading zeros are kept.
Not in this version: the WooCommerce block checkout. The classic shortcode checkout is supported.
External service
This plugin sends the phone number a visitor enters to the MyOTP.App API at https://api.myotp.app to deliver a one-time code and to check the code the visitor types. No other data is sent. MyOTP.App privacy policy: https://myotp.app/privacy-policy/. Terms: https://myotp.app/term-condition/.
Data stored on your site
- A cookie
myotp_pv_sid(random id, one day) so a guest’s verification can be tied to their browser. - Rows in the options table (
myotp_pv_kv_prefix, not autoloaded): rate-limit counters (a row lives for one window after the last send it counted: 10 minutes, site-wide 1 hour), the pending number with its code reference and attempt count (kept for the configured code validity, at most 4 hours), a 15-minute per-visitor cooldown row after five wrong codes, and the verified number (30 minutes). Expired rows are removed on the next read of that row and by a daily WP-Cron sweep (myotp_pv_sweep). WP-Cron runs on page visits, so on a quiet site the sweep can run later than scheduled. - Order meta
_myotp_verified_phoneon each verified WooCommerce order. - User meta
myotp_verified_phoneon each account registered through the verified form.
Uninstalling removes the settings, the scheduled sweep, the counters, the pending records and the verified records. Order meta and user meta are part of your customer records and are kept. The plugin registers suggested text for your privacy policy under Settings > Privacy.
Installation
- Upload the
myotp-phone-verificationfolder to/wp-content/plugins/, or upload the zip from Plugins > Add New > Upload Plugin. - Activate the plugin.
- Sign up at https://myotp.app/sign-up/ and copy an API key from User API Keys in the dashboard.
- Go to Settings > MyOTP, paste the key, pick a channel and save.
- Send a test code to your own number from the same page.
FAQ
-
What format do phone numbers need?
-
Country code first, digits only, no plus sign. 14155550123, not +1 (415) 555-0123. The plugin strips spaces, dashes and the plus sign before sending.
-
Does it work with the WooCommerce block checkout?
-
No. This version hooks the classic checkout (the
[woocommerce_checkout]shortcode page). Block checkout support is planned. -
Can logged-in customers skip verification?
-
Yes. Tick “Only for guests” under WooCommerce checkout in Settings > MyOTP.
-
How do I react to a successful verification from the shortcode?
-
Listen for the event:
document.addEventListener('myotp:verified', function (e) { console.log(e.detail.phone); }); -
I am behind a reverse proxy or CDN. Does the per-IP limit work?
-
The plugin reads REMOTE_ADDR only, because forwarding headers can be forged by the client. Behind a proxy that address may be the proxy itself, so every visitor shares one per-IP bucket and the site-wide hourly ceiling is the real backstop. If your host guarantees a trusted header, return the real address from the
myotp_pv_client_ipfilter. -
Does each test send cost credits?
-
Yes. A test send is a real send.
-
Where does the API key live?
-
In the
myotp_pv_optionsoption, on the server only. It is shown masked on the settings page and removed on uninstall.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“MyOTP Phone Verification” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “MyOTP Phone Verification” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0.0
- First release. WooCommerce classic checkout, registration form,
[myotp_verify]shortcode, settings page with test send.