-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaystack-proxy.php
More file actions
35 lines (27 loc) · 856 Bytes
/
Copy pathpaystack-proxy.php
File metadata and controls
35 lines (27 loc) · 856 Bytes
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
<?php
// SmartPaystack Proxy
$paystackSecret = ""; // Paste your Paystack secret key here later
$token = "SMARTPAYSTACK_TOKEN_2025_XYZ987654321";
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
echo json_encode(['error' => 'Method not allowed']);
exit;
}
if (!isset($_POST['token']) || $_POST['token'] !== $token) {
http_response_code(403);
echo json_encode(['error' => 'Invalid token']);
exit;
}
$url = "https://api.paystack.co/transaction/initialize";
$data = $_POST['data'] ?? [];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $paystackSecret",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>