B2B WooCommerce Customer Portal with NetSuite — Syncing Invoices, Credit Limits, and Order History
- A B2B customer portal in WooCommerce allows wholesale buyers to view their open invoices, credit balance, and order history — data that lives in NetSuite, not WooCommerce.
- The portal requires a real-time (or near-real-time) read path from NetSuite to WooCommerce — not the scheduled sync used for inventory.
- Credit limit enforcement must happen at cart/checkout in WooCommerce, but the credit data lives in NetSuite — requiring a synchronous API call at checkout time.
- Invoice payment via the portal means WooCommerce processing a payment and then writing the receipt back to NetSuite against the correct Invoice record.
A self-service B2B portal in WooCommerce is one of the highest-value use cases for NetSuite integration. Wholesale buyers can log in, see their account standing, view open invoices, pay outstanding balances, and place new orders — all without emailing or calling your sales team. The technical challenge is that all the financial data (invoices, credit, payment history) lives in NetSuite, while the UI and payment processing happen in WooCommerce.
Portal Data Architecture
WooCommerce B2B Portal (customer logged in)
│
├── My Invoices page
│ └── RESTlet: GET /customer/{id}/invoices
│ → NetSuite returns: open invoices, amounts, due dates
│
├── Account Overview widget
│ └── RESTlet: GET /customer/{id}/account
│ → NetSuite returns: credit limit, credit used, available
│
├── Order History page
│ └── WooCommerce orders (local) + NetSuite SOs (via RESTlet)
│
└── Pay Invoice (payment gateway)
└── On payment success:
POST to RESTlet: apply payment to NetSuite Invoice
→ creates Customer Payment record in NetSuite
→ marks Invoice as Paid or Partially Paid
Credit Limit Enforcement at Checkout
When a B2B customer places a new order, WooCommerce must check whether the order total would exceed their available credit in NetSuite before allowing checkout to complete. This requires a synchronous API call during WooCommerce’s checkout validation — not a cached value from a previous sync.
Making a live NetSuite API call on every cart page load is too slow (adds 800–1500ms). Cache the credit data per customer for 5 minutes in WooCommerce transients. Make a fresh call only at the moment of checkout order submission. A 5-minute cache means a customer whose credit limit was just reduced by a payment received during their session may get a stale value — acceptable for most B2B use cases.
Invoice Payment Write-Back
When a customer pays an invoice through the portal, the payment flow is: WooCommerce processes the card via Stripe/PayPal → WooCommerce order is created as “paid” → your integration creates a NetSuite Customer Payment record linked to the specific open Invoice → the Invoice is marked fully or partially paid. The critical data to pass: Invoice internal ID (the NetSuite record being paid), payment method, payment date, and exact amount. Do not round the amount — partial payments must match to the cent.
References
- SuiteScript RESTlet for Data AggregationOracle NetSuite Help — RESTlet framework used to return aggregated customer financial data in a single call.
- WooCommerce Payment Gateway APIWooCommerce.com — payment processing API that triggers the NetSuite payment write-back on successful payment.
- NetSuite Customer Payment RecordOracle NetSuite Help — Customer Payment record creation via SuiteScript for invoice payment write-back.
Leave a Reply