: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace WPForms\Integrations\Stripe\Api\Webhooks;
use WPForms\Db\Payments\UpdateHelpers;
* Webhook customer.subscription.deleted class.
class CustomerSubscriptionDeleted extends Base {
* Handle the Webhook's data.
* @throws RuntimeException If payment not found or not updated.
public function handle() {
$payment = wpforms()->get( 'payment' )->get_by( 'subscription_id', $this->data->id );
if ( isset( $this->data->metadata->canceled_by ) && $this->data->metadata->canceled_by === 'wpforms_dashboard' ) {
if ( ! UpdateHelpers::cancel_subscription( $payment->id, 'Stripe subscription cancelled from the Stripe dashboard.' ) ) {
throw new RuntimeException( 'Payment not updated' );