astral-php / astral-payment
Intégration Stripe pour Astral — PaymentIntent, webhooks, events, remboursements
0.1.2
2026-10-08 15:52 UTC
Requires
- php: ^8.1
- astral-php/astral-core: ^1.2
- stripe/stripe-php: ^13.0 || ^14.0 || ^15.0 || ^16.0
Requires (Dev)
- phpunit/phpunit: ^10.0 || ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Intégration Stripe pour Astral — PaymentIntent, webhooks, events, remboursements.
Prérequis
| Dépendance | Version |
|---|---|
| PHP | ^8.1 |
| astral-php/astral-core | ^1.2 |
| stripe/stripe-php | ^13+ |
| Compte Stripe | stripe.com |
Installation
composer require astral-php/astral-payment
1. Variables d'environnement
Copier stubs/.env.payment.example dans votre .env :
STRIPE_PUBLIC_KEY=pk_test_… STRIPE_SECRET_KEY=sk_test_… STRIPE_WEBHOOK_SECRET=whsec_… APP_URL=http://localhost
2. Service provider
Dans config/dependencies.php :
AstralPayment\PaymentServiceProvider::class,
3. Migrations
Copier stubs/database/migrations/* vers database/migrations/, puis :
php bin/console migrate
4. Routes
Fusionner stubs/config/routes.payment.php dans config/routes.php
(checkout sous AuthMiddleware, webhook sans CSRF).
5. Vue + JS
stubs/views/payment/checkout.php→views/payment/stubs/resources/js/stripe-checkout.js→resources/js/(si astral-vite)npm install @stripe/stripe-js
Usage rapide
use AstralPayment\PaymentService; $data = $paymentService->createPaymentIntent( amountCents: 2999, currency: 'eur', metadata: ['order_id' => $orderId], ); // $data['clientSecret'], $data['intentId']
Flux : checkout → Stripe Elements → webhook payment_intent.succeeded →
events PaymentSucceeded / PaymentFailed.
Structure
src/
PaymentService.php
PaymentServiceProvider.php
Controllers/
Dao/
Events/
Listeners/
Middleware/
Models/
stubs/
.env.payment.example
config/routes.payment.php
database/migrations/
views/payment/
resources/js/
Tests
composer test # ou vendor/bin/phpunit
Suite obligatoire avant publication (helpers, models, events, listeners, middleware).
Compatibilité
| astral-core | PHP | astral-payment |
|---|---|---|
| ^1.2 | 8.1 → 8.4 | 0.x |
Licence
MIT — voir LICENSE