#deepakkumar_wizniche

1 messages ยท Page 1 of 1 (latest)

amber heraldBOT
magic saddle
#

I use the Stripe webhook for keeping track of subscriptions update

errant jackal
#

Hello ๐Ÿ‘‹
The error doesn't seem to be thrown by Stripe SDK. It seems to be thrown by your code that calls

Spatie\StripeWebhooks\ProcessStripeWebhookJob::storeWebhook()

I'd recommend looking into that.

magic saddle
#

class ProcessStripeWebhookJob extends ProcessWebhookJob
{
public function handle()
{
if (! isset($this->webhookCall->payload['type']) || $this->webhookCall->payload['type'] === '') {
throw WebhookFailed::missingType($this->webhookCall);
}

    event("stripe-webhooks::{$this->webhookCall->payload['type']}", $this->webhookCall);

    $jobClass = $this->determineJobClass($this->webhookCall->payload['type']);

    if ($jobClass === '') {
        return;
    }

    if (! class_exists($jobClass)) {
        throw WebhookFailed::jobClassDoesNotExist($jobClass, $this->webhookCall);
    }

    dispatch(new $jobClass($this->webhookCall));
}

protected function determineJobClass(string $eventType): string
{
    $jobConfigKey = str_replace('.', '_', $eventType);
    
    $defaultJob = config('stripe-webhooks.default_job', '');

    return config("stripe-webhooks.jobs.{$jobConfigKey}", $defaultJob);
}

}

#

I am not calling storeWebhook()

errant jackal
#

None of the code you shared looks to be related to Stripe SDK ๐Ÿค”
Are you using a connector or a plugin for this?

magic saddle
#

This code is downloaded from the SDK

#

storeWebhook()

errant jackal
#

Downloaded from what SDK?
Is there a guide you're following for this?

magic saddle
#

That's how my config looks like:<?php

return [

/*
 * Stripe will sign each webhook using a secret. You can find the used secret at the
 * webhook configuration settings: https://dashboard.stripe.com/account/webhooks.
 */
'signing_secret_account' => env('STRIPE_WEBHOOK_SECRET_ACCOUNT'),
'signing_secret_connect' => env('STRIPE_WEBHOOK_SECRET_CONNECT'),

/*
 * You can define the job that should be run when a certain webhook hits your application
 * here. The key is the name of the Stripe event type with the `.` replaced by a `_`.
 *
 * You can find a list of Stripe webhook types here:
 * https://stripe.com/docs/api#event_types.
 */
'jobs' => [
    // 'source_chargeable' => \App\Jobs\StripeWebhooks\HandleChargeableSource::class,
    // 'charge_failed' => \App\Jobs\StripeWebhooks\HandleFailedCharge::class,
    'invoice_payment_failed' => \App\Jobs\InvoiceFailedJob::class,
    'invoice_payment_action_required' => \App\Jobs\InvoiceFailedJob::class,
    'invoice_payment_succeeded' => \App\Jobs\InvoiceSucceedJob::class,

// 'account_updated' => \App\Jobs\ConnectAccountJob::class,
],

/*
 * The classname of the model to be used. The class should equal or extend
 * Spatie\StripeWebhooks\ProcessStripeWebhookJob.
 */
'model' => \Spatie\StripeWebhooks\ProcessStripeWebhookJob::class,

];

#

"spatie/laravel-stripe-webhooks": "^3.0", this SDK