Skip to main content

Sandbox Testing

The MLM Platform provides sandbox environments for safe testing without affecting production data.

Overview

Sandbox environments allow you to:
  • Test API integrations without real transactions
  • Simulate purchases and commission flows
  • Create test users and hierarchies
  • Reset data for clean test runs

Creating a Sandbox

  1. Navigate to Settings > Environments in the Admin Dashboard
  2. Click Create Sandbox
  3. Enter a label (e.g., “Development”, “QA”)
  4. Optionally connect Stripe test mode
  5. Click Create
You can create up to 3 sandbox environments per tenant.

Sandbox API Keys

Each sandbox has its own API keys:
  1. Go to Settings > API Keys
  2. Click Create API Key
  3. Select your sandbox environment
  4. Copy the key (prefix: mlm_sandbox_)

Simulating Purchases

Use your sandbox API key to record purchase events safely:
Response:

Creating Test Users

Create test users for building hierarchies:

Resetting Sandbox Data

To reset your sandbox, use the Admin Dashboard to reset or recreate your sandbox environment.

Cloning Configuration

Copy your production commission rules to sandbox:
This copies:
  • Commission rules and rates
  • Tier configurations
  • Payout settings
It does not copy:
  • User data
  • Commission history
  • API keys or credentials

Testing Stripe Integration

Connect Stripe Test Mode

  1. Go to Settings > Environments
  2. Select your sandbox
  3. Click Connect Stripe
  4. Use Stripe test mode credentials

Test payout paths (sandbox only)

On Tenant Admin → Payouts (/tenant-admin/payouts):
  1. Configure Stripe → Wise auto top-up (Stripe external account ID + Wise balance ID)
  2. Ensure sandbox Stripe keys, Wise sandbox profile, and test members with payout accounts exist
  3. Use Test Wise payout path or Test Stripe Connect payout path to exercise the full automated pipeline
These buttons invoke the sandbox-payout-e2e-test edge function and record step-by-step results.

Commission clearing in sandbox

Commissions clear from PENDINGCLEARED when:
  • Purchase metadata has no stripe_payment_intent_id (clears on next sync), or
  • Stripe reports the linked PaymentIntent’s balance transaction as available
Clearing is triggered by sync-stripe-commission-clearing (daily cron). Manual payout runs on Payouts invoke ensure-wise-balance then resolve-payouts. Calls8 integrations should pass stripe_payment_intent_id in purchase metadata so card-funded commissions wait for Stripe settlement.

Test Card Numbers

Test Webhooks

Use Stripe CLI to forward test webhooks:

Environment Detection

Verify you’re in sandbox mode:

Best Practices

Separate Test Data

  • Use distinct email patterns: test-*@example.com
  • Use recognizable product names: [TEST] Product Name
  • Add metadata: { "test": true, "scenario": "happy-path" }

Automated Testing

CI/CD Integration