Ton hébergeur ne t'aider pas, c'est à toi de te débrouiller.Je dois voir avec l'hébergeur où et comment installer l'API coté serveur
<?php
// webhook.php
//
// Use this sample code to handle webhook events in your integration.
//
// 1) Paste this code into a new file (webhook.php)
//
// 2) Install dependencies
// composer require stripe/stripe-php
//
// 3) Run the server on http://localhost:4242
// php -S localhost:4242
require 'vendor/autoload.php';
// This is your Stripe CLI webhook secret for testing your endpoint locally.
$endpoint_secret = 'xxxxxxxxxxxxx';
$payload = @file_get_contents('php://input');
$sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
$event = null;
try {
$event = \Stripe\Webhook::constructEvent(
$payload, $sig_header, $endpoint_secret
);
} catch(\UnexpectedValueException $e) {
// Invalid payload
http_response_code(400);
exit();
} catch(\Stripe\Exception\SignatureVerificationException $e) {
// Invalid signature
http_response_code(400);
exit();
}
// Handle the event
switch ($event->type) {
case 'cash_balance.funds_available':
$cashBalance = $event->data->object;
// ... handle other event types
default:
echo 'Received unknown event type ' . $event->type;
}
http_response_code(200);
?>
// Handle the event
switch ($event->type) {
case 'payment_intent.succeeded':
$paymentIntent = $event->data->object; // contains a \Stripe\PaymentIntent
header('Location:maj_bonus.php');
exit;
case 'cash_balance.funds_available':
$cashBalance = $event->data->object;
// ... handle other event types
header('Location:maj_bonus.php');
exit;
case 'checkout.session.async_payment_succeeded':
$session = $event->data->object;
header('Location:maj_bonus.php');
exit;
case 'checkout.session.completed':
$session = $event->data->object;
header('Location:maj_bonus.php');
exit;
// ... handle other event types
default:
echo 'Received unknown event type ' . $event->type;
}