![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/private_html/ |
<?php
/**
* Verify Stripe Price IDs
* Checks if Price IDs in config match actual Stripe prices
*/
session_start();
require_once 'config/database.php';
// Check admin access
if (!isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
die("Admin access required");
}
$plans_config = require __DIR__ . '/config/subscription_plans.php';
$stripe_secret = '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';
$results = [];
foreach ($plans_config as $plan_key => $plan) {
$price_id = $plan['stripe_price_id'];
// Skip placeholder Price IDs
if (strpos($price_id, 'price_') !== 0 || strlen($price_id) < 20) {
$results[$plan_key] = [
'status' => 'not_configured',
'price_id' => $price_id,
'error' => 'Price ID not configured or invalid format'
];
continue;
}
// Fetch price from Stripe
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.stripe.com/v1/prices/{$price_id}");
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $stripe_secret]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_code === 200) {
$price_data = json_decode($response, true);
$stripe_amount = $price_data['unit_amount'] / 100; // Convert from cents
$stripe_interval = $price_data['recurring']['interval'] ?? 'N/A';
$product_id = $price_data['product'];
// Get product name
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.stripe.com/v1/products/{$product_id}");
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $stripe_secret]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$product_response = curl_exec($ch);
curl_close($ch);
$product_data = json_decode($product_response, true);
$product_name = $product_data['name'] ?? 'N/A';
$results[$plan_key] = [
'status' => 'verified',
'price_id' => $price_id,
'config_price' => $plan['price'],
'stripe_price' => $stripe_amount,
'stripe_interval' => $stripe_interval,
'product_name' => $product_name,
'matches' => abs($plan['price'] - $stripe_amount) < 0.01 // Allow small floating point differences
];
} else {
$error_data = json_decode($response, true);
$results[$plan_key] = [
'status' => 'error',
'price_id' => $price_id,
'error' => $error_data['error']['message'] ?? 'Unknown error',
'http_code' => $http_code
];
}
}
$page_title = 'Verify Stripe Prices';
include 'includes/header.php';
?>
<main style="max-width: 1000px; margin: 40px auto; padding: 20px;">
<div style="background: #2a2a2a; border-radius: 12px; padding: 40px;">
<h1 style="color: white; margin-bottom: 20px;">🔍 Verify Stripe Price IDs</h1>
<p style="color: #a0aec0; margin-bottom: 30px;">
This tool verifies that the Price IDs in your config match the actual prices in Stripe.
</p>
<table style="width: 100%; border-collapse: collapse; color: white;">
<thead>
<tr style="border-bottom: 2px solid #444; background: #1a1a1a;">
<th style="padding: 15px; text-align: left;">Plan</th>
<th style="padding: 15px; text-align: left;">Price ID</th>
<th style="padding: 15px; text-align: left;">Config Price</th>
<th style="padding: 15px; text-align: left;">Stripe Price</th>
<th style="padding: 15px; text-align: left;">Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($results as $plan_key => $result):
$plan = $plans_config[$plan_key];
?>
<tr style="border-bottom: 1px solid #333;">
<td style="padding: 15px;">
<strong style="color: <?= $plan['color'] ?>;"><?= htmlspecialchars($plan['name']) ?></strong>
</td>
<td style="padding: 15px; font-family: monospace; font-size: 0.9rem;">
<?= htmlspecialchars($result['price_id']) ?>
</td>
<td style="padding: 15px;">
$<?= number_format($plan['price'], 2) ?>/month
</td>
<td style="padding: 15px;">
<?php if ($result['status'] === 'verified'): ?>
$<?= number_format($result['stripe_price'], 2) ?>/<?= $result['stripe_interval'] ?>
<br>
<small style="color: #a0aec0;"><?= htmlspecialchars($result['product_name']) ?></small>
<?php else: ?>
<span style="color: #e53e3e;">N/A</span>
<?php endif; ?>
</td>
<td style="padding: 15px;">
<?php if ($result['status'] === 'verified'): ?>
<?php if ($result['matches']): ?>
<span style="color: #48bb78; font-weight: bold;">✅ Match</span>
<?php else: ?>
<span style="color: #e53e3e; font-weight: bold;">❌ MISMATCH!</span>
<br>
<small style="color: #ffc107;">
Config: $<?= number_format($plan['price'], 2) ?><br>
Stripe: $<?= number_format($result['stripe_price'], 2) ?>
</small>
<?php endif; ?>
<?php elseif ($result['status'] === 'not_configured'): ?>
<span style="color: #ffc107;">⚠️ Not Configured</span>
<?php else: ?>
<span style="color: #e53e3e;">❌ Error</span>
<br>
<small style="color: #e53e3e;"><?= htmlspecialchars($result['error']) ?></small>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div style="margin-top: 30px; padding: 20px; background: #1a1a1a; border-radius: 8px;">
<h3 style="color: white; margin-bottom: 15px;">📝 What to Check</h3>
<ul style="color: #a0aec0; line-height: 1.8;">
<li><strong style="color: #48bb78;">✅ Match:</strong> Price ID is correct and matches config</li>
<li><strong style="color: #e53e3e;">❌ Mismatch:</strong> Price ID exists but amount is wrong - fix in Stripe or config</li>
<li><strong style="color: #ffc107;">⚠️ Not Configured:</strong> Price ID is placeholder - run setup script</li>
<li><strong style="color: #e53e3e;">❌ Error:</strong> Price ID doesn't exist in Stripe - check if it was deleted</li>
</ul>
</div>
</div>
</main>
<?php include 'includes/footer.php'; ?>