Skip to content

Sell a B2B Subscription End-to-End

This recipe walks through the entire purchase pipeline: creating a WooCommerce product, mapping it to an Entitlement Class, a customer purchasing it, and verifying that the entitlement and all downstream resources were created correctly. Use this recipe to prove the system works from end to end.

Prerequisites

  • WordPress admin access with WooCommerce active.
  • MIDDAG Account plugin installed and activated.
  • At least one Organization already onboarded and verified. See Onboard an Organization if needed.
  • A Stripe account connected in plugin settings (BR or GLOBAL, depending on the Organization's billing entity).

Steps

Part A: Create the WooCommerce product

Step 1. Go to WooCommerce > Products > Add New in the WordPress admin sidebar.

Step 2. Enter a product name (e.g., "MIDDAG Pro Plugin -- Annual License").

Step 3. In the Product data section, select "Simple product" (or "Simple subscription" if using WooCommerce Subscriptions for recurring billing).

Step 4. Set the price. For BR entity products, use BRL. For GLOBAL entity products, use USD.

Step 5. Scroll to the MIDDAG Account tab in the product data panel.

Step 6. In the Entitlement Class dropdown, select the class that matches the product:

Product typeSelect this class
WordPress plugin or softwarePLG
Managed hosting environmentENV
Consulting, development, projectSVC
Generic purchaseORD
Affiliate/partner membershipAFL
Training or courseEDU

For this example, choose PLG.

Step 7. Configure class-specific settings:

  • For PLG: set the maximum number of site activations (e.g., 3 sites).
  • For ENV: no additional settings at product level.
  • For SVC: select the lifecycle (ongoing or project) and the service type.

Step 8. In the Entity Routing section, select which billing entity this product belongs to (MIDDAG BR or MIDDAG GLOBAL). This determines which Stripe account processes payments.

Step 9. Click Publish to make the product available.

Part B: Create and send a quote

Step 10. Go to MIDDAG Account > Quotes in the admin sidebar. Click New Quote.

Step 11. Select the target Organization from the dropdown.

Step 12. The billing entity auto-fills from the Organization's settings. Verify it matches the product's entity.

Step 13. Click Add Line Item. Search for the product you created in Part A and add it. Set quantity.

Step 14. Set the Valid Until date (default: 30 days from today).

Step 15. Click Save as Draft to review, then click Send to Customer.

Step 16. The quote status changes from draft to sent. The customer receives an email notification with a link to view the quote in the portal.

Part C: Customer accepts and pays

Step 17. The customer logs in to the portal and navigates to Quotes.

Step 18. The customer opens the quote (status transitions from sent to viewed automatically).

Step 19. The customer clicks Accept Quote, confirms in the dialog, and is redirected to the payment page.

Step 20. The customer pays using the available method for their entity:

  • BR: Credit card (Stripe), Pix, or Boleto (Banco Inter).
  • GLOBAL: Credit card (Stripe).

Step 21. On successful payment, the system executes the pipeline automatically:

  1. Quote status transitions to paid, then fulfilled.
  2. A WooCommerce order is created and marked as paid.
  3. An entitlement is provisioned based on the product's Entitlement Class.

Part D: Verify the entitlement

Step 22. Go to MIDDAG Account > Entitlements in the admin sidebar.

Step 23. Search for the Organization name or the entitlement code prefix (e.g., PLG-).

Step 24. Open the entitlement. Verify:

  • Status is active.
  • Class matches what you configured (PLG).
  • Organization is correct.
  • Linked Order points to the WooCommerce order created in step 21.

Step 25. Check downstream resources based on the class:

ClassWhat to verify
PLGA License was created. Go to Licenses and find the key linked to this entitlement.
ENVAn Environment record exists. Go to Environments and check status is provisioning.
SVCA Service, Contract, and CreditBalance were created. Check each under the entitlement detail.
ORDAn Invoice was generated via Stripe. Check Invoices for a matching record.

Step 26. For PLG entitlements: verify the customer can see the license in the portal under My Products, and that the Download link is available if the product has downloadable files.

Expected result

  • The WooCommerce product is mapped to the correct Entitlement Class.
  • The quote-to-payment pipeline completed without manual intervention after the customer accepted.
  • An entitlement with status active exists, linked to the Organization and the originating order.
  • Downstream resources (license, environment, service, or invoice) were created automatically based on the class.
  • The customer can see their new entitlement in the portal.

Troubleshooting

  • Entitlement not created after payment: Check that the product has an Entitlement Class assigned in the product data panel. Also verify the Stripe webhook is configured and reachable at /webhooks/stripe/br or /webhooks/stripe/llc.
  • Wrong entity: If the product entity and Organization entity do not match, the payment may fail. Verify both are set to the same entity (BR or GLOBAL).
  • Quote stuck at accepted: The WooCommerce order may not have been created. Check the admin logs under MIDDAG Account > Logs for errors in the quote-to-order conversion.

Further reading