Description
This plugin adds “Pay with NYVA” as a WooCommerce payment method. When the customer chooses NYVA Pay and places the order:
- The plugin creates a payment session via the NyvaPay API (POST /api/merchant/payment-links).
- The customer is redirected to the NyvaPay hosted checkout page.
- After payment, NyvaPay sends a webhook to your site; the plugin marks the order as paid and WooCommerce sends the order confirmation email.
Requirements
- WordPress 5.0 or later
- WooCommerce 4.0 or later (tested with WooCommerce 8.x)
- PHP 7.4 or later
- A NyvaPay merchant account with Pro subscription and an API key from the NyvaPay dashboard
API used
- Create payment session:
POST {base_url}/api/merchant/payment-links - Headers:
X-Merchant-Email,X-API-Key,Content-Type: application/json - Body: amount, currency, product_name, order (WooCommerce order ID), webhook_url, success_redirect_url, customer_email, customer_name, optional metadata
- Response: pay_url (redirect URL), payment_request_id
Webhook
When payment completes, NyvaPay POSTs to your webhook URL with a JSON body:
- Event:
payment.succeeded - Fields: order (your WooCommerce order ID), amount, currency, payment_request_id, transaction_id, status (“paid”), product_name, customer_email, customer_name, metadata
The plugin registers the webhook at: https://yoursite.com/wc-api/nyva_callback/ (WooCommerce builds this from your site URL). You do not need to configure this URL in NyvaPay; the plugin sends it automatically when creating each payment.
Installation
Option A: Install like a normal plugin (recommended)
- Build a zip file: from the repo root run
./woocommerce/build-plugin-zip.sh(or zip thenyva-pay-gatewayfolder yourself). - In WordPress Admin: Plugins Add New Upload Plugin Choose File (select the zip).
- Click Install Now, then Activate.
Option B: Manual folder upload
- Copy the
nyva-pay-gatewayfolder to your site’s/wp-content/plugins/directory. - In WordPress Admin: Plugins Installed Plugins Activate “NYVA Pay for WooCommerce”.
Configure the gateway
- Go to WooCommerce Settings Payments and enable “NYVA Pay”.
- Enter your Merchant email and API key from the NyvaPay merchant dashboard. You must have a Pro subscription to use the API.
- Save changes. The webhook URL is sent automatically with each payment request; no manual webhook configuration is required.
FAQ
-
How does the plugin avoid name collisions (WordPress.org guidelines)?
-
- PHP classes:
NYVAPAFO_GatewayandNYVAPAFO_Blocks_Support— neverWC_+ a short brand prefix. - Functions / hooks:
nyvapafo_*in the main bootstrap file (named functions, not anonymous closures). - Script handles:
nyvapafo-checkout-blocksfor the Blocks checkout script. - Order meta keys:
_nyvapafo_payment_request_id,_nyvapafo_pay_url. - Payment method id: The WooCommerce gateway id stays
nyvaso existing orders, settings (woocommerce_nyva_settings), and the REST callbackwc-api/nyva_callbackremain stable.
- PHP classes:
-
Do I need to set a webhook URL in NyvaPay?
-
No. The plugin sends the WooCommerce webhook URL (wc-api/nyva_callback) when creating each payment, so NyvaPay knows where to send the payment.succeeded callback.
-
Orders stay “On hold” after payment
-
Check that your site is reachable from the internet at the URL WooCommerce uses for the webhook. Logs are in WooCommerce Status Logs (source: nyva-pay-for-woocommerce).
-
500 error when clicking Place Order
-
- Enable WordPress debug logging: add to wp-config.php: define(‘WP_DEBUG’, true); define(‘WP_DEBUG_LOG’, true);
- Check wp-content/debug.log for the PHP error.
- Check WooCommerce Status Logs for “nyva-pay-for-woocommerce” entries.
- Ensure the site URL is correct in WordPress Settings General (the webhook URL is built from it).
- If using a staging URL (e.g. tbb.317.mytemp.website), ensure it is reachable from the internet so NyvaPay can send the webhook.
-
“Unable to fix malformed JSON” in the browser console (e.g. with FunnelKit)
-
WooCommerce block and classic checkouts both expect only JSON in checkout AJAX responses. Extra PHP output (notices, HTML, or BOM) before that JSON breaks parsing. Use plugin 1.0.9+ (output buffering around NYVA Pay processing on classic checkout, plus safer block payment data in 1.0.7+). On production set
WP_DEBUG_DISPLAYto false so notices are not printed into the response. If it persists, temporarily switch theme / disable other plugins and inspectwp-content/debug.log. -
Customer “processing order” email not sent after NYVA Pay (FunnelKit, SMTP, etc.)
-
WooCommerce should send emails when the order moves to processing after
payment_complete(). If another plugin suppresses that, add to a small custom plugin orfunctions.php:add_filter( 'nyvapafo_trigger_processing_order_email', '__return_true' );This asks NYVA Pay to also trigger WooCommerce’s Customer processing order email right after the Nyva webhook marks the order paid. Remove the filter once you have fixed the conflicting plugin.
-
NyvaPay merchant “sale received” email (dashboard)
-
That email is sent by Nyva’s servers (not WordPress) when a payment link is paid. The store owner must have email notifications enabled in NyvaPay Settings (“Payment received”), a valid account email, and the Nyva deployment must have Resend configured (
RESEND_API_KEYand a verified sending domain). If sales complete in WooCommerce but you never get the Nyva sale email, check NyvaPay logs/support — WordPress SMTP plugins do not affect that path.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“NYVA Pay for WooCommerce” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “NYVA Pay for WooCommerce” 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.10
- Branding: Checkout and Blocks UI now use the same Nyva app icon as nyvapay.com (
nyva-brand-icon.png, copied from the main product icon). Removed the old standalone SVG mark to avoid drift. - WooCommerce emails: Optional
nyvapafo_trigger_processing_order_emailfilter (return true) to force-send the customer “processing order” email afterpayment_completewhen another plugin suppresses core mail (e.g. some funnel/SMTP stacks). See FAQ. - Nyva merchant notifications: When a logged-in customer pays a payment link (
payment_requestWhop path), the platform now sends the merchant “sale received” email/push even though the ledger path marks the request paid before the legacy transfer helper runs (that helper skipped notifications when status was no longeropen).
1.0.9
- Classic checkout / FunnelKit: Wraps payment processing in output buffering so stray PHP notices or whitespace from this gateway’s code path cannot corrupt the AJAX JSON response (fixes browser console “Unable to fix malformed JSON #1” when placing an order). Check WooCommerce Status Logs (
nyva-pay-for-woocommerce) if warnings are logged about suppressed output — often indicates another plugin orWP_DEBUG_DISPLAYon production.
1.0.8
- Critical:
nyva-pay-gateway.phpnow includes a full WordPress plugin header (Plugin Name,Version, etc.). WordPress disables plugins without a valid header; older releases only had a comment stub on this legacy filename. - UX: The legacy bootstrap file is hidden from the Plugins list (via
all_plugins) so you still see a single “NYVA Pay for WooCommerce” row when both PHP entry files exist in the folder.
1.0.7
- Blocks / FunnelKit: Payment method data for the block checkout no longer calls
get_available_payment_gateways()(which runsis_available()on every gateway and can break JSON responses when other gateways or funnel plugins log notices). Single-method detection now uses enabled toggles only. - Blocks: Title and description sent to the checkout block script are normalized to plain UTF-8 text (tags stripped) so payloads stay valid JSON.
1.0.6
- Compliance: Replaced remote icon URL references with bundled local icon assets for gateway + blocks.
- Compliance: Added standard main plugin entrypoint file
nyva-pay-for-woocommerce.php. - Build: Standardized zip output name to
nyva-pay-for-woocommerce.zip.
1.0.5
- Naming / collisions: All PHP classes use the
NYVAPAFO_prefix (neverWC_+ brand). Bootstrap hooks use named functionsnyvapafo_*(no anonymous callbacks in the main plugin file). - Assets: Blocks script handle is now
nyvapafo-checkout-blocks(not a genericnyva-pay-*handle). - Order meta: Stores
_nyvapafo_payment_request_idand_nyvapafo_pay_url(prefixed, private-style keys). Optional override constantNYVAPAFO_PAY_API_BASE_URL(legacyNYVA_PAY_API_BASE_URLstill supported).
1.0.4
- WordPress.org guidelines: Renamed gateway classes to use a distinct plugin prefix (
NYVAPAFO_*instead ofWC_NYVA_*) and prefixed bootstrap functions withnyvapafo_.
1.0.3
- Subscription support: With WooCommerce Subscriptions, NYVA Pay now supports recurring payments. Balance subscriptions charge the customer’s NYVA wallet each billing period; webhooks (subscription.payment_succeeded, subscription.payment_failed, subscription.cancelled) update renewal orders and subscription status automatically.
1.0.2
- Order summary: Sends line items (name, qty, total, product image URL) in metadata so the NYVA Pay checkout page can show multiple products with thumbnails when the cart has more than one item.
1.0.1
- WooCommerce checkout UX: Redirect URL now includes
source=wooso the NYVA Pay page loads the payment form directly (no “Pay as Guest” step) and shows “Pay with NYVA balance if you have an account” at the top. Merchants should update to this version for the improved store checkout experience.
1.0.0
- Initial release. Register NYVA Pay gateway, create payment via merchant API, redirect to pay_url, handle payment.succeeded webhook and complete order.