Skip to content

Expert Answers to Your Magento, Shopify & Shopware Questions

Vendor-neutral, engineer-written explanations. Clear definitions first, then practical steps with real examples — no fluff.

Stagebit builds and maintains stores on Magento, Adobe Commerce, Shopify, Shopware, and Laravel, and this library holds the questions our own engineers get asked most often on each platform.

How do I build a Laravel B2B customer portal for an existing store?

SB
Written by Stagebit Engineering Team
Updated November 2026 10 min read Verified by engineers

You build a Laravel B2B customer portal beside your store, not in front of it. Business buyers log in to the portal to reorder, request quotes, track orders and manage their team. The store usually keeps running catalog, checkout and fulfillment. The two systems talk through the store’s API. Most of the build is deciding which system is authoritative for which data, and the steps below follow that order.

Quick answer

Build a standalone Laravel B2B customer portal, and give each type of business data one authoritative system, such as the store, an ERP or Laravel. Call the store synchronously when a buyer is waiting, for example for prices or order confirmation, and queue catalog syncs, bulk imports, notifications and webhook processing. Verify webhook signatures, record each event before acknowledging it, and submit orders to the store instead of keeping a second authoritative order record. Check the store’s native B2B features first, because Shopify and Adobe Commerce both offer them.

Should you build a B2B portal or use native B2B features?

Check this first, because every custom portal adds code, hosting, security work and upgrades that someone has to maintain. Shopify B2B is available on the Basic, Grow, Advanced and Plus plans, with companies, catalogs and net payment terms on each. Direct company catalogs and deposit payments need Plus. Adobe Commerce B2B is a set of modules that adds company accounts, shared catalogs, negotiable quotes and requisition lists. Adobe documents B2B as exclusive to Adobe Commerce, so a Magento Open Source store does not include it.

Use native B2B features when

  • Buyers mainly reorder, check order history and pay on net terms.
  • One store holds every catalog and price.
  • Your approval and quoting rules are close to what the platform already offers.

Build a Laravel portal when

  • Buyers order across several stores or brands and need one login.
  • Credit limits, account data or contract prices live in an ERP or CRM that the portal must read.
  • Your approval or quoting rules don’t fit the platform’s model.
  • You need a buyer interface that the storefront theme can’t deliver.

The right choice depends on the gap between native features and your workflows. Integration complexity, security requirements, development cost and ongoing maintenance matter too. Treat the lists above as starting points for that decision.

How to build a Laravel B2B customer portal, step by step

1. Audit the store and decide which system is authoritative for each piece of data

Start by listing what the store already does. Note the platform, where product and stock data live, how customer-specific prices work and which APIs and webhooks it offers. Also note how the store handles business customers and orders today, and whether an ERP or CRM holds any of that data.

Then assign each type of data one authoritative system. In a store-only setup, the store usually owns products, prices, stock, tax, payments and orders, and Laravel owns companies, buyer roles, approvals and quotes. If an ERP holds contract prices or credit limits, or a CRM holds account data, those systems own that data instead. If the platform already supports a B2B feature natively, use it rather than rebuilding it in Laravel. Duplicated data with no clear owner is where the portal and the other systems start to disagree.

Laravel B2B portal and store linked by API and webhooks, with the store owning orders and the portal owning company roles

2. Choose the integration surface your platform supports

Use the platform’s official API and never touch its database directly. Laravel’s HTTP client makes the calls, and API resources shape the data you return to the frontend.

Adobe Commerce offers REST and GraphQL APIs, but B2B coverage varies by module and operation. Adobe’s B2B REST documentation marks each B2B module as REST enabled or not, and some storefront-oriented B2B GraphQL operations ship in a separate compatibility package. Confirm that the exact operations your integration needs are available before you design around them. On WooCommerce, Shopware or another platform, check for an order API, signed webhooks and a customer model you can map companies to.

On Shopify, a headless B2B experience needs new customer accounts. The buyer completes Shopify’s customer account authorization, an OAuth 2.0 flow with PKCE that returns an access token for the Customer Account API. Query that API for the buyer’s company locations. Then pass the access token and the chosen company location ID to the Storefront API. Prices and quantity rules then match the buyer, as Shopify’s headless B2B guide describes. If a buyer belongs to several locations, add a location selector.

Your Laravel login and Shopify’s customer authorization are two separate sign-ins, so tie them together on the server. Run the OAuth exchange on the server, store the token securely, and save the Shopify customer ID on the matching Laravel buyer record. Never trust a company location ID just because the browser submitted it. Read the buyer’s locations from the Customer Account API with their token. Accept only a location that appears in that list and that your own permission rules allow.

Use the GraphQL Admin API for back-office syncing. That API limits calls by calculated query cost and caps any single query at 1,000 points.

3. Model companies, buyers and roles

A Laravel B2B customer portal needs a Company model and a Buyer model that belongs to it. The roles depend on the client, but a common set looks like this:

  • Company administrator: manages company details, users, addresses and permissions.
  • Purchasing manager: creates orders, requests quotes and approves orders.
  • Buyer: browses products and orders within assigned limits.
  • Finance user: views invoices, payment history and balances.

Treat company data isolation as a security requirement. Combine these measures:

  • Laravel policies and gates that check a buyer’s role and company for every action on an order, quote, invoice or address.
  • Queries that always start from the buyer’s own company, so a request for another company’s record returns nothing.
  • Server-side authorization on every request, because hiding records in the frontend does not protect them.
  • Automated tests that try to read another company’s data, covered in step 9.

A global scope on company-owned models can add an extra safeguard where it fits, but it cannot be your only protection. Any query can remove it, for example with withoutGlobalScopes().

Save the store’s customer or company ID on each record as an external reference. Do not use it as your primary key.

4. Authenticate buyers in Laravel

Use Laravel’s built-in authentication through a starter kit for the portal login. Add Sanctum only if a separate single-page app or mobile app calls your portal’s API. Reach for Passport only when you must act as an OAuth2 server. Never reuse store staff credentials for buyers.

5. Show the right catalog and prices for each company

Companies often see different products, negotiated prices, minimum order quantities and quantity increments. Retrieve them from the system that owns pricing, usually the store, through its supported integration methods. Do not build a second pricing engine in Laravel.

The portal can check minimum quantities and increments before submission, so buyers get fast feedback. The store remains the authority, so treat its response as final.

Never cache B2B prices in a shared cache

Shopify’s headless B2B guide warns that cached responses contextualized with a buyer token and company location can show one customer’s pricing to another. In Laravel, key any cached price by company or location ID, or skip caching it.

6. Build ordering, quote and approval workflows

Business buyers need more than a standard cart. Depending on the client, the portal may add:

  • Quick order forms and CSV upload for bulk ordering.
  • Quote requests, so buyers can ask for negotiated prices before committing.
  • Order approval, where a purchaser’s order waits for a manager.
  • Purchase order numbers attached to each order.
  • Reordering from past purchases.
  • Payment terms such as pay on account or net 30, where the store and finance systems support them.

Treat approval as a state in the Laravel database. A purchaser submits an order, the portal saves it as pending approval and notifies the manager. Laravel sends the order to the store only after approval. Wait for the store’s confirmation before showing the order as accepted, and never calculate a different total in the portal.

At checkout, create the order through the store’s API or pass the cart to the store’s checkout with the buyer’s company context. On Shopify headless, the cart carries the buyer identity and the company location ID.

Keep a local representation of each order in the portal: the store order ID, a status snapshot, the PO number and sync metadata such as the last update time. Never create a second, independent order record. The commerce platform stays authoritative for the order itself.

7. Show orders, invoices and balances

Buyers should find their purchase history without contacting the sales team. The portal can show whatever the store’s API exposes. That typically means order history with fulfillment status, order details, invoice PDFs, outstanding balances, payment history, saved addresses and shipment tracking. Refresh statuses from webhooks.

Never store raw card details in Laravel. Leave payment processing with the payment provider.

8. Sync with queued jobs, webhooks and reconciliation

Not every store call belongs in a queue. Call the store synchronously when a buyer is waiting for the result. Examples are prices for the page they are viewing and confirmation of an order they just submitted. Queue the work nobody is waiting for: catalog syncs, bulk imports, notifications and webhook processing. In your Laravel B2B customer portal, wrap every store call in one service class, so one class handles timeouts and retries.

Subscribe to order and product webhooks to catch changes. Shopify signs each HTTPS webhook with an HMAC of the raw request body, sent in the X-Shopify-Hmac-SHA256 header and keyed with your app’s client secret. In Laravel, read that body with $request->getContent() and verify the signature before you touch the payload. Other platforms use their own signing schemes, so follow their documentation.

Record the webhook before you acknowledge it. Shopify treats any 200-series response as success and retries only failed deliveries, up to eight times over four hours. If Laravel returns 200 and then fails before it saves or queues the event, Shopify has no reason to retry, and you lose the update. Return 200 only after you have durably stored the event or successfully queued it, then process it in the background. Shopify also expects a response within five seconds, which is another reason to keep the processing itself out of the request.

Deduplicate at two levels. Shopify can deliver the same webhook more than once, so skip any delivery whose X-Shopify-Webhook-Id you have already stored. Separate webhook subscriptions can also receive the same merchant action as different deliveries, each with its own X-Shopify-Webhook-Id but a shared X-Shopify-Event-Id. So make the business update itself idempotent. Applying the same order status twice should leave the order unchanged.

Webhooks can arrive late, twice or not at all, so never treat them as your only source of truth. Run a periodic reconciliation job that compares the portal’s order references with the store and repairs any missed events. When you create orders, use idempotency keys where the store’s API supports them. A retried request then cannot create a duplicate order.

9. Secure and test the portal

Keep API credentials and webhook secrets in environment configuration or a secrets manager. Use HTTPS for every connection. Add request validation and rate limiting, and keep audit records of order approvals, account changes and permission updates.

Then test with several company accounts and roles. A single admin account hides permission bugs. Cover these cases:

  • Each company sees its own products and negotiated prices.
  • A buyer from company A cannot read company B’s orders, quotes, invoices or addresses, even by changing an ID in a URL.
  • A buyer cannot submit a company location ID that belongs to another company.
  • Minimum quantities and quantity increments apply correctly.
  • A retried order request does not create a duplicate.
  • The same webhook delivered twice changes the order only once.
  • Webhook failures and API timeouts fail safely.

What should you build first?

Start your Laravel B2B customer portal with the smallest useful slice: buyer login, company scoping and read-only order history. Add ordering and approvals once the sync layer has handled real order traffic. If you want a second opinion on native B2B versus a custom build, or help scoping the integration, see Stagebit’s Laravel development services.

Was this answer helpful?

Your feedback helps us improve our answers.

Still need help?

Questions about building a B2B portal?

If you're weighing native B2B features against a custom Laravel build, we're happy to walk through your requirements and what the integration would involve.

Talk to Laravel Experts