Search by

astral-php / astral-payment

astral-php

Intégration Stripe pour Astral — PaymentIntent, webhooks, events, remboursements

Package info

github.com/astral-php/astral-payment

pkg:composer/astral-php/astral-payment

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.2 2026-10-08 15:52 UTC

This package is auto-updated.

Last update: 2026-10-08 15:52:43 UTC


README

Intégration Stripe pour Astral — PaymentIntent, webhooks, events, remboursements.

PHP Stripe Tests License: MIT

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