Appearance
Stripe Integration
Stripe is used for processing card payments. The integration handles payment capture, webhook events, and refund processing.
Components
| Component | File | Role |
|---|---|---|
StripeApi | src/CoreBundle/Api/StripeApi.php | Stripe API client |
Configuration
Required parameters in parameters.yml:
yaml
stripe:
secret_key: "sk_..."
publishable_key: "pk_..."
webhook_secret: "whsec_..."Data Flow
View diagram source
sequenceDiagram
participant CUST as Customer
participant MAG as Magento Checkout
participant STRIPE as Stripe API
participant API as StripeApi
participant DB as Database
CUST->>MAG: Submit payment
MAG->>STRIPE: Create PaymentIntent
STRIPE-->>MAG: Confirm payment
STRIPE->>API: Webhook (payment_intent.succeeded)
API->>DB: Record transaction
Payment Flow
- The customer completes checkout on the Magento front-end
- Magento creates a Stripe PaymentIntent
- Stripe processes the card and confirms the payment
- A webhook notifies Logidav of the successful transaction
StripeApirecords the transaction in the database
Refund Flow
View diagram source
sequenceDiagram
participant SVC as Logidav
participant API as StripeApi
participant STRIPE as Stripe API
SVC->>API: initiateRefund(transactionId, amount)
API->>STRIPE: POST /refunds
STRIPE-->>API: Refund confirmation
API->>SVC: Update transaction status
Error Handling
| Scenario | Behavior |
|---|---|
| Card declined | Status recorded; order remains pending |
| Webhook signature invalid | Request rejected; logged as security event |
| Partial refund failure | Alert raised; manual review required |
| API timeout | Retry with exponential backoff |
Webhook verification
Always verify the webhook signature using the webhook_secret. Unverified webhooks should be rejected to prevent fraudulent transaction confirmations.