Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Stripe Php Laravel Package

stripe/stripe-php

Official Stripe PHP SDK for accessing the Stripe API. Install via Composer, configure your API key, and use resource classes to create charges, customers, subscriptions, and more. Works with PHP 7.2+ (requires curl, json, mbstring).

View on GitHub
Deep Wiki
Context7

stripe/stripe-php is Stripe’s official PHP SDK, offering a clean, object-oriented way to call the Stripe API from your PHP applications. It ships with resource classes that dynamically initialize from API responses, helping maintain compatibility across a wide range of Stripe API versions.

Install via Composer (recommended) or manually, then authenticate and start creating charges, customers, subscriptions, and more with minimal boilerplate.

  • Composer-ready with simple autoloading integration
  • Rich set of API resource classes (Customers, Payments, Subscriptions, etc.)
  • Dynamic deserialization from Stripe responses for broad API-version compatibility
  • Works with cURL by default (or plug in a custom HTTP client)
  • Requires common PHP extensions: curl, json, mbstring
Frequently asked questions about Stripe Php
How do I install the Stripe PHP SDK in a Laravel project?
Run `composer require stripe/stripe-php` in your Laravel project directory. The SDK will autoload via Composer’s PSR-4 autoloader, so no additional configuration is needed beyond requiring the `vendor/autoload.php` file.
Which Laravel versions does the Stripe PHP SDK support?
The SDK itself doesn’t enforce Laravel-specific constraints, but it requires PHP 7.2+ (with PHP 7.2/7.3 support dropping soon). It works seamlessly with Laravel 7+ and newer, including PHP 8+ features like typed properties and enums.
How do I handle breaking changes like deprecated tax IDs in Laravel?
For deprecated fields like `bm_crn` or `eg_tin`, update your Laravel models to remove or archive these fields. Use migrations to transform legacy data, and replace direct API calls with the SDK’s updated resource classes (e.g., `Account` for V2.Core.Account).
Can I use the Stripe SDK with Laravel’s Payment Gateway interfaces?
Yes. The SDK supports Delegated Checkout and payment methods like `bizum` (Spain) and `sunbit`. Extend Laravel’s `PaymentGateway` contract to wrap Stripe’s `PaymentIntent` or `CheckoutSession` classes, handling `requires_action` statuses with Laravel’s redirect helpers.
How do I configure Stripe webhooks in Laravel to handle new fields like `fleet_data`?
Update your Laravel webhook event handlers to dynamically parse new fields using `data_get()` or JSON decoding. For example, cast `fleet_data` to a JSON column in your database or use Laravel’s `HasAttributes` trait to handle dynamic payloads.
What’s the best way to integrate Radar fraud detection with Laravel’s event system?
Use Laravel’s event system to trigger custom events (e.g., `FraudAlert`) when Radar enums like `risk_level` or `event_type` are updated. Store `Radar.CustomerEvaluation` data in a JSON column (e.g., `risk_signals:json`) and dispatch events like `new FraudAlert($evaluation)`.
How do I handle nullable fields (e.g., `emptyable(literal('account_funding'))`) in Laravel Eloquent models?
Define nullable fields in your Eloquent models using PHP 8’s `?string` or `null` types. For example, add `protected ?string $transaction_type;` and use Laravel’s `fillable` array to allow null values. Use the nullsafe operator (`?->`) to avoid `NullPointerException`.
Are there alternatives to the Stripe PHP SDK for Laravel?
While the official `stripe/stripe-php` SDK is the most feature-complete, alternatives like `laravel-cashier` (for subscriptions) or `omnipay/stripe` (for payment gateways) exist. However, these often rely on the same underlying SDK or lack support for newer Stripe features like Delegated Checkout or Radar enhancements.
How do I test Stripe webhooks locally in Laravel?
Use Laravel’s `HttpTesting` facade to simulate webhook requests. Mock the Stripe SDK’s `Webhook` class to return test payloads, then assert responses using `assertJson()`. For testing preview features (e.g., `payment_record`), use Stripe’s test mode and validate dynamic fields with `assertArrayHasKey()`.
What are the performance implications of using the Stripe SDK in production?
The SDK is optimized for performance, using cURL by default for low-latency API calls. For high-throughput Laravel apps, consider caching Stripe API responses (e.g., `Customer` objects) with Laravel’s cache system. Monitor telemetry usage and disable it in production if GDPR compliance is critical.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport