🔍 Orders.json Structure Verification

This tool checks if your orders.json file is set up correctly for the success.php integration.

1️⃣ File Exists?

✅ PASS - orders.json found at:

/home/urbanet/www/backend/../data/orders.json

2️⃣ JSON Format Valid?

✅ PASS - Valid JSON format

Total orders in file: 12

3️⃣ Order Structure Analysis

Analyzing first order (most recent):

order_number
ORD-20251217-185504-7990
session_id
cs_test
customer_name
customer_email
estimated_delivery
2025-12-22
status
confirmed
created_at
2025-12-17T18:55:04+01:00
locale
en

4️⃣ ⭐ CRITICAL CHECK: stripe_session_id

❌ FAIL - Missing or Empty

The stripe_session_id field is either missing or empty.

This means:

🔧 HOW TO FIX:

Edit your stripe-webhook.php and find the section where you save orders to JSON.

It should look something like:

$orderData = [
    'order_number' => $orderNumber,
    'customer_name' => $session->customer_details->name,
    'customer_email' => $session->customer_details->email,
    'status' => 'confirmed',
    // ... other fields
];

ADD THIS LINE:

'stripe_session_id' => $session->id,

So it becomes:

$orderData = [
    'order_number' => $orderNumber,
    'stripe_session_id' => $session->id,    // ← ADD THIS
    'customer_name' => $session->customer_details->name,
    'customer_email' => $session->customer_details->email,
    'status' => 'confirmed',
    // ... other fields
];

After editing, make another test payment and check again.

5️⃣ Other Important Fields

order_number ✅ Present
customer_name ✅ Present
customer_email ✅ Present
status ✅ Present
created_at ✅ Present

6️⃣ Next Steps

🚫 Cannot proceed yet

First, fix your webhook to save stripe_session_id:

  1. Edit stripe-webhook.php
  2. Add 'stripe_session_id' => $session->id, to order data
  3. Make another test payment
  4. Refresh this page
  5. Check again - should show ✅ PASS

7️⃣ Full orders.json Content (Last 3 orders)

Showing last 3 order(s):

[
    {
        "order_number": "ORD-BHSKN6HH",
        "email": "stripe@example.com",
        "name": "Jenny Rosen",
        "status": "confirmed"
    },
    {
        "order_number": "ORD-T5SX11SZ",
        "stripe_session_id": "cs_test_a1yuPQndYgKjFgYCV520lTy66ulolaHCcnnVVmAGKser1xcSOCT5SX11sZ",
        "customer_name": "jjjj",
        "customer_email": "rpetrucci@graphema.fr",
        "shipping_country": "FR",
        "status": "confirmed",
        "estimated_delivery": "2025-12-24",
        "created_at": "2025-12-19T19:51:56+01:00",
        "locale": "fr"
    },
    {
        "order_number": "ORD-AYIRG1BY",
        "stripe_session_id": "cs_test_a1UqqktTzJd5mwoeFvvXfg7oH2eGsKoZFkt1rY7jdx3LZjxtY5AyiRG1by",
        "customer_name": "kkkk",
        "customer_email": "rpetrucci@graphema.fr",
        "shipping_country": "FR",
        "status": "confirmed",
        "estimated_delivery": "2025-12-24",
        "created_at": "2025-12-19T20:03:19+01:00",
        "locale": "fr"
    }
]

⚠️ Security Note

DELETE THIS FILE AFTER TESTING

Once you've verified your setup is correct, delete verify-orders-structure.php from your server for security reasons.

This file shows sensitive order information and should not be left on a live server.