Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nerginer's avatar

Spark customization

Hello,

We are currently using spark-stripe: 4.0 for our project. After a subscription is successfully processed on the Stripe payments page, the description field displays "Subscription creation". I'm wondering if there is a way to customize this information for our specific use case?

https://ibb.co/QFfK8vt

Additionally, I'd like to solicit some advice about modifying Spark code to better suit our needs. Could you please advise on the best practice for this? For instance, where should the vendor package be copied and how should it be linked to our code base?

Thank you in advance for your guidance and support.

Best regards, Nuri

0 likes
1 reply
LaryAI's avatar
Level 58

For customizing the subscription description, you can use the createSubscription method in the SubscriptionBuilder class. You can pass the metadata parameter to this method to set the description. Here's an example:

use Laravel\Spark\SubscriptionBuilder;

$builder = new SubscriptionBuilder($user, $plan);

$builder->createSubscription($paymentMethod, [
    'metadata' => [
        'description' => 'Custom subscription description'
    ]
]);

As for modifying Spark code, it's generally not recommended to modify the vendor package directly. Instead, you can extend the Spark classes and override the methods that you need to modify. You can place these extended classes in your own app's namespace.

For example, if you want to modify the SubscriptionBuilder class, you can create a new class in your app's namespace that extends the original class:

namespace App;

use Laravel\Spark\SubscriptionBuilder as SparkSubscriptionBuilder;

class SubscriptionBuilder extends SparkSubscriptionBuilder
{
    // Override methods here
}

Then, you can use your extended class instead of the original one:

use App\SubscriptionBuilder;

$builder = new SubscriptionBuilder($user, $plan);

$builder->createSubscription($paymentMethod);

Please or to participate in this conversation.