Skip to main content

Command Palette

Search for a command to run...

Creem Laravel Package: Payment Integration That Feels Like Laravel

Updated
2 min read
Creem Laravel Package: Payment Integration That Feels Like Laravel
Y

I am a software engineer with experience in PHP, Laravel, JavaScript, and ReactJS. I have strong skills in database management, including mySql, Postgres, and MongoDB. I am dedicated to delivering high-quality software solutions and am always looking for ways to improve my skills and stay up-to-date on the latest technologies. In addition to my technical expertise, I am a proactive and detail-oriented team player who is able to deliver projects on time and to the highest standards.

Why I Built This Package.

I needed Creem in a Laravel project and realized I was writing the same integration patterns I'd written dozens of times before: facade wrappers, webhook verification middleware, event dispatchers. This package is what I wish had existed: battle-tested, properly documented, and genuinely useful.

What Makes It Different

Fluent, Laravel-native syntax:

$checkout = Creem::createCheckout([
    'product_id' => 'prod_123',
    'customer_email' => $user->email,
    'success_url' => route('checkout.success'),
]);

Event-driven webhooks using Laravel's native event system:

Event::listen(CheckoutSucceeded::class, function ($event) {
    $user = User::where('email', $event->customer->email)->first();
    $user->grantPremiumAccess();
});

Automatic security with built-in webhook signature verification—no configuration needed.

Complete API Coverage

Every endpoint in the Creem API is accessible through clean, documented methods:

Checkouts & Payments

Creem::createCheckout($params);
Creem::getCheckout($checkoutId);

Products & Catalog

Creem::createProduct($params);
Creem::getProduct($productId);
Creem::searchProducts(['limit' => 20]);

Customer Management

Creem::getCustomer($customerId);
Creem::listCustomers(['email' => 'user@example.com']);
Creem::createPortalLink(['customer_id' => $customerId]);

Subscriptions

Full lifecycle management:

Creem::getSubscription($subscriptionId);
Creem::updateSubscription($id, ['quantity' => 5]);
Creem::upgradeSubscription($id, ['product_id' => 'prod_new']);
Creem::pauseSubscription($id);
Creem::cancelSubscription($id);

License Validation

Perfect for SaaS applications:

Creem::validateLicense($key, $instanceId);
Creem::activateLicense($key, $instanceName);
Creem::deactivateLicense($key, $instanceId);

Discount Codes

Creem::createDiscount($params);
Creem::getDiscount($code);
Creem::deleteDiscount($id);

Webhook Events That Make Sense

The package automatically verifies webhook signatures and dispatches Laravel events you can listen to:

// In your EventServiceProvider
protected $listen = [
    CheckoutSucceeded::class => [
        SendWelcomeEmail::class,
        GrantPremiumAccess::class,
    ],
    SubscriptionUpdated::class => [
        HandleSubscriptionChange::class,
    ],
    WebhookReceived::class => [
        LogAllWebhooks::class, // Catch everything
    ],
];

No manual signature verification. No parsing payloads. Just Laravel events.

Built-In Artisan Commands

View your product catalog:

php artisan creem:sync-products

Fetches all products from Creem and displays them in a table perfect for verifying your setup or debugging pricing.

Generate webhook secrets:

php artisan creem:webhook-secret

Generates a secure random secret and automatically updates your .env file. Or provide your own:

php artisan creem:webhook-secret whsec_your_secret_from_dashboard

Get Started in 5 Minutes

1. Install:

composer require devmohy/creem-laravel

2. Publish config:

php artisan vendor:publish --tag=creem-config

3. Add credentials to .env:

CREEM_API_KEY=your_api_key_here
CREEM_WEBHOOK_SECRET=your_webhook_secret_here

That's it. Start building.

Built for Production

  • Secure by default – Automatic webhook signature verification

  • Fully tested – Comprehensive test suite included

  • Laravel HTTP Client – Works with Http::fake() for testing

  • Proper error handling – Descriptive exceptions and failed response handling

Open Source & Ready to Use

The package is MIT-licensed and open source. Contributions welcome.

Links:

Happy coding! 🍦