Repository navigation
Expand file tree
/
Copy pathsucesso.php
More file actions
72 lines (62 loc) · 1.92 KB
/
Copy pathsucesso.php
File metadata and controls
72 lines (62 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
session_start();
$config = require_once 'includes/config.php';
// Proteção de acesso
if (!isset($_SESSION['user_logged_in']) || $_SESSION['user_logged_in'] !== true) {
header('Location: index.php');
exit;
}
// Verifica se o session_id foi passado
if (!isset($_GET['session_id'])) {
echo "ID da sessão de pagamento não informado.";
exit;
}
require_once 'stripe-php-6.43.1/init.php'; // Caminho correto do seu Stripe SDK
\Stripe\Stripe::setApiKey($config['stripe_private_key'] ?? '');
try {
$session = \Stripe\Checkout\Session::retrieve($_GET['session_id']);
$paymentIntent = \Stripe\PaymentIntent::retrieve($session->payment_intent);
$charName = $session->metadata->char_name ?? 'Desconhecido';
$email = $session->customer_details->email ?? 'Não informado';
$amount = number_format($session->amount_total / 100, 2, ',', '.');
$status = $paymentIntent->status;
} catch (Exception $e) {
echo "Erro ao buscar dados do pagamento: " . $e->getMessage();
exit;
}
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Pagamento Realizado com Sucesso</title>
<style>
body {
background-color: #121212;
color: #fff;
font-family: Arial, sans-serif;
text-align: center;
padding: 50px;
}
.box {
background-color: #1e1e1e;
padding: 30px;
border-radius: 12px;
display: inline-block;
box-shadow: 0 0 10px #333;
}
h1 {
color: #00c853;
}
</style>
</head>
<body>
<div class="box">
<h1>✅ Pagamento Aprovado!</h1>
<p><strong>Personagem:</strong> <?= htmlspecialchars($charName) ?></p>
<p><strong>Email:</strong> <?= htmlspecialchars($email) ?></p>
<p><strong>Valor:</strong> R$ <?= $amount ?></p>
<p><strong>Status:</strong> <?= ucfirst($status) ?></p>
</div>
</body>
</html>