NYVA Pay for WooCommerce

Description

This plugin adds “Pay with NYVA” as a WooCommerce payment method. When the customer chooses NYVA Pay and places the order:

  1. The plugin creates a payment session via the NyvaPay API (POST /api/merchant/payment-links).
  2. The customer is redirected to the NyvaPay hosted checkout page.
  3. 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)

  1. Build a zip file: from the repo root run ./woocommerce/build-plugin-zip.sh (or zip the nyva-pay-gateway folder yourself).
  2. In WordPress Admin: Plugins Add New Upload Plugin Choose File (select the zip).
  3. Click Install Now, then Activate.

Option B: Manual folder upload

  1. Copy the nyva-pay-gateway folder to your site’s /wp-content/plugins/ directory.
  2. In WordPress Admin: Plugins Installed Plugins Activate “NYVA Pay for WooCommerce”.

Configure the gateway

  1. Go to WooCommerce Settings Payments and enable “NYVA Pay”.
  2. Enter your Merchant email and API key from the NyvaPay merchant dashboard. You must have a Pro subscription to use the API.
  3. 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_Gateway and NYVAPAFO_Blocks_Support — never WC_ + a short brand prefix.
  • Functions / hooks: nyvapafo_* in the main bootstrap file (named functions, not anonymous closures).
  • Script handles: nyvapafo-checkout-blocks for the Blocks checkout script.
  • Order meta keys: _nyvapafo_payment_request_id, _nyvapafo_pay_url.
  • Payment method id: The WooCommerce gateway id stays nyva so existing orders, settings (woocommerce_nyva_settings), and the REST callback wc-api/nyva_callback remain stable.

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

  1. Enable WordPress debug logging: add to wp-config.php: define(‘WP_DEBUG’, true); define(‘WP_DEBUG_LOG’, true);
  2. Check wp-content/debug.log for the PHP error.
  3. Check WooCommerce Status Logs for “nyva-pay-for-woocommerce” entries.
  4. Ensure the site URL is correct in WordPress Settings General (the webhook URL is built from it).
  5. 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_DISPLAY to false so notices are not printed into the response. If it persists, temporarily switch theme / disable other plugins and inspect wp-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 or functions.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_KEY and 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.

Contributors

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_email filter (return true) to force-send the customer “processing order” email after payment_complete when 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_request Whop 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 longer open).

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 or WP_DEBUG_DISPLAY on production.

1.0.8

  • Critical: nyva-pay-gateway.php now 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 runs is_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 (never WC_ + brand). Bootstrap hooks use named functions nyvapafo_* (no anonymous callbacks in the main plugin file).
  • Assets: Blocks script handle is now nyvapafo-checkout-blocks (not a generic nyva-pay-* handle).
  • Order meta: Stores _nyvapafo_payment_request_id and _nyvapafo_pay_url (prefixed, private-style keys). Optional override constant NYVAPAFO_PAY_API_BASE_URL (legacy NYVA_PAY_API_BASE_URL still supported).

1.0.4

  • WordPress.org guidelines: Renamed gateway classes to use a distinct plugin prefix (NYVAPAFO_* instead of WC_NYVA_*) and prefixed bootstrap functions with nyvapafo_.

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=woo so 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.