0, 'pending' => 0, ]; // Clean merchants.json $merchants = $storage->get('merchants', []); $originalMerchantsCount = count($merchants); foreach ($merchants as $school => $info) { if (isset($info['merchant_id']) && strcasecmp($info['merchant_id'], $partnerMerchantId) === 0) { unset($merchants[$school]); $cleaned['merchants']++; } } if ($cleaned['merchants'] > 0) { $storage->set('merchants', $merchants); } // Clean pending_onboarding.json $pending = $storage->get('pending_onboarding', []); foreach ($pending as $trackId => &$entry) { if (!is_array($entry)) continue; if (isset($entry['merchant_id']) && strcasecmp($entry['merchant_id'], $partnerMerchantId) === 0) { // Remove the incorrect merchant_id and mark as incomplete unset($entry['merchant_id']); $entry['status'] = 'incomplete_onboarding'; $entry['note'] = 'Removed incorrect partner ID. Merchant needs to complete onboarding.'; $entry['cleaned_at'] = time(); $cleaned['pending']++; } } unset($entry); if ($cleaned['pending'] > 0) { $storage->set('pending_onboarding', $pending); } ?> Cleanup Utility - PayPal Integration

๐Ÿงน Data Cleanup Complete

0 || $cleaned['pending'] > 0): ?>

โœ… Cleanup Results

incorrect entries fixed:

โ„น๏ธ No Cleanup Needed

No incorrect merchant IDs found. Your data is clean!

โš ๏ธ About the Cleanup

This utility removed entries where your partner merchant ID () was incorrectly saved as a merchant's ID.

These merchants will need to:

  1. Click "Connect with PayPal" again
  2. Complete the ENTIRE PayPal business account setup
  3. Return to your application to get properly connected

๐Ÿ“Š Current Status

Total connected merchants:

Total pending entries:

0): ?>

Connected Merchants:

๐Ÿ”— Next Steps

Note: You can safely run this cleanup script multiple times. It only removes entries that match your partner merchant ID.