['card'], 'line_items' => [[ 'price_data' => [ 'currency' => $currency, 'product_data' => [ 'name' => 'Sample Product', ], 'unit_amount' => $price_in_cents, // Price in cents ], 'quantity' => 1, ]], 'mode' => 'payment', 'success_url' => 'http://localhost/sonetel/pages/success.php?session_id={CHECKOUT_SESSION_ID}', 'cancel_url' => 'http://localhost/sonetel/pages/cancel.php', ]); // Return the session ID to frontend echo json_encode(['sessionId' => $session->id]); } catch (Exception $e) { http_response_code(500); echo json_encode(['error' => $e->getMessage()]); } ?>