Fix: Corriger le type PDO dans StripeService et retirer getConnection()
This commit is contained in:
60
api/test_stripe_simple.php
Normal file
60
api/test_stripe_simple.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Test simple de Stripe sans base de données
|
||||
*/
|
||||
|
||||
echo "================================\n";
|
||||
echo "Test Simple Stripe\n";
|
||||
echo "================================\n\n";
|
||||
|
||||
// Test direct avec les clés
|
||||
$publicKey = 'pk_test_51QwoVN00pblGEgsXkf8qlXmLGEpxDQcG0KLRpjrGLjJHd7AVZ4Iwd6ChgdjO0w0n3vRqwNCEW8KnHUe5eh3uIlkV00k07kCBmd';
|
||||
$secretKey = 'sk_test_51QwoVN00pblGEgsXnvqi8qfYpzHtesWWclvK3lzQjPNoHY0dIyOpJmxIkoLqsbmRMEUZpKS5MQ7iFDRlSqVyTo9c006yWetbsd';
|
||||
|
||||
echo "1. Clés configurées:\n";
|
||||
echo " Public: " . substr($publicKey, 0, 20) . "...***\n";
|
||||
echo " Secret: " . substr($secretKey, 0, 20) . "...***\n\n";
|
||||
|
||||
echo "2. Test de connexion Stripe...\n";
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
try {
|
||||
\Stripe\Stripe::setApiKey($secretKey);
|
||||
|
||||
// Récupérer le balance
|
||||
$balance = \Stripe\Balance::retrieve();
|
||||
|
||||
echo "✅ Connexion réussie!\n";
|
||||
echo " Devise par défaut: " . strtoupper($balance->available[0]->currency ?? 'eur') . "\n";
|
||||
|
||||
// Tester la création d'un PaymentIntent
|
||||
echo "\n3. Test création PaymentIntent...\n";
|
||||
$paymentIntent = \Stripe\PaymentIntent::create([
|
||||
'amount' => 1000, // 10€
|
||||
'currency' => 'eur',
|
||||
'payment_method_types' => ['card'],
|
||||
'metadata' => [
|
||||
'test' => 'true',
|
||||
'created_by' => 'test_script'
|
||||
]
|
||||
]);
|
||||
|
||||
echo "✅ PaymentIntent créé!\n";
|
||||
echo " ID: " . $paymentIntent->id . "\n";
|
||||
echo " Montant: " . ($paymentIntent->amount / 100) . " EUR\n";
|
||||
echo " Status: " . $paymentIntent->status . "\n";
|
||||
|
||||
// Annuler le PaymentIntent de test
|
||||
$paymentIntent->cancel();
|
||||
echo " (PaymentIntent annulé pour le test)\n";
|
||||
|
||||
} catch (\Stripe\Exception\ApiErrorException $e) {
|
||||
echo "❌ Erreur Stripe: " . $e->getMessage() . "\n";
|
||||
} catch (Exception $e) {
|
||||
echo "❌ Erreur: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
echo "\n================================\n";
|
||||
echo "Test terminé!\n";
|
||||
echo "================================\n";
|
||||
Reference in New Issue
Block a user